diff --git a/README.md b/README.md index 8bdab87f..e6d9d1ed 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ max_input_vars = 5000 + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Cost Benefit Projection](https://www.staffhealthcbp.com/) + *First Build*: 15th June, 2012 -+ *Last Build*: 6th January, 2021 ++ *Last Build*: 2nd March, 2022 + *Version*: 3.4.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **86905** ++ *Line count*: **86587** + *File count*: **587** + *Folder count*: **103** diff --git a/admin/README.txt b/admin/README.txt index 8bdab87f..e6d9d1ed 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -22,11 +22,11 @@ max_input_vars = 5000 + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Cost Benefit Projection](https://www.staffhealthcbp.com/) + *First Build*: 15th June, 2012 -+ *Last Build*: 6th January, 2021 ++ *Last Build*: 2nd March, 2022 + *Version*: 3.4.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **86905** ++ *Line count*: **86587** + *File count*: **587** + *Folder count*: **103** diff --git a/admin/access.xml b/admin/access.xml index de8ec395..fdbdd9a4 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -1,5 +1,5 @@ - - + +
@@ -258,5 +258,5 @@ -
+
\ No newline at end of file diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 11ffa753..c7aa6667 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -1,23 +1,23 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage admin.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ -.no-click { - pointer-events: none; -} - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage admin.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ +.no-click { + pointer-events: none; +} + diff --git a/admin/assets/css/causerisk.css b/admin/assets/css/causerisk.css index 335b8501..8c46bd6c 100644 --- a/admin/assets/css/causerisk.css +++ b/admin/assets/css/causerisk.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage causerisk.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causerisk.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/causesrisks.css b/admin/assets/css/causesrisks.css index 547b2d47..a4fede36 100644 --- a/admin/assets/css/causesrisks.css +++ b/admin/assets/css/causesrisks.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage causesrisks.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causesrisks.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/combinedresults.css b/admin/assets/css/combinedresults.css index 13d39e83..b5b9b2ea 100644 --- a/admin/assets/css/combinedresults.css +++ b/admin/assets/css/combinedresults.css @@ -1,23 +1,23 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage combinedresults.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage combinedresults.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + /* ---- Table ---- */ table { @@ -207,4 +207,4 @@ table th.sort-up:after { position: absolute; right: -32px; top: 6px; -} +} diff --git a/admin/assets/css/companies.css b/admin/assets/css/companies.css index 8d76fe0e..817d39e7 100644 --- a/admin/assets/css/companies.css +++ b/admin/assets/css/companies.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage companies.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companies.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/company.css b/admin/assets/css/company.css index c6d44fe5..89d749e7 100644 --- a/admin/assets/css/company.css +++ b/admin/assets/css/company.css @@ -1,24 +1,24 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage company.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage company.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + input[type="checkbox"] { margin: 0 !important; -} +} diff --git a/admin/assets/css/companyresults.css b/admin/assets/css/companyresults.css index 52cc27d0..43fdd0cc 100644 --- a/admin/assets/css/companyresults.css +++ b/admin/assets/css/companyresults.css @@ -1,23 +1,23 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage companyresults.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companyresults.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + /* ---- Table ---- */ table { @@ -207,4 +207,4 @@ table th.sort-up:after { position: absolute; right: -32px; top: 6px; -} +} diff --git a/admin/assets/css/countries.css b/admin/assets/css/countries.css index fd80d90f..ccbd523d 100644 --- a/admin/assets/css/countries.css +++ b/admin/assets/css/countries.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage countries.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage countries.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/country.css b/admin/assets/css/country.css index 53cf8645..1b9406dc 100644 --- a/admin/assets/css/country.css +++ b/admin/assets/css/country.css @@ -1,24 +1,24 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage country.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage country.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + input[type="checkbox"] { margin: 0 !important; -} +} diff --git a/admin/assets/css/currencies.css b/admin/assets/css/currencies.css index b70848cf..78c78fe3 100644 --- a/admin/assets/css/currencies.css +++ b/admin/assets/css/currencies.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage currencies.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage currencies.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/currency.css b/admin/assets/css/currency.css index 0f03cab9..467330f4 100644 --- a/admin/assets/css/currency.css +++ b/admin/assets/css/currency.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage currency.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage currency.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 0ead9a50..29817097 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -1,171 +1,171 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage dashboard.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* 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; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage dashboard.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* 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/health_data.css b/admin/assets/css/health_data.css index 86b7ff52..f641f739 100644 --- a/admin/assets/css/health_data.css +++ b/admin/assets/css/health_data.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage health_data.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage health_data.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/health_data_sets.css b/admin/assets/css/health_data_sets.css index 701c9b26..d9f38d4c 100644 --- a/admin/assets/css/health_data_sets.css +++ b/admin/assets/css/health_data_sets.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage health_data_sets.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage health_data_sets.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/help_document.css b/admin/assets/css/help_document.css index 1b08eb11..5b065a88 100644 --- a/admin/assets/css/help_document.css +++ b/admin/assets/css/help_document.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage help_document.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage help_document.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/help_documents.css b/admin/assets/css/help_documents.css index 376957b7..cc20f79a 100644 --- a/admin/assets/css/help_documents.css +++ b/admin/assets/css/help_documents.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage help_documents.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage help_documents.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/intervention.css b/admin/assets/css/intervention.css index db5ab5ca..a6298fc2 100644 --- a/admin/assets/css/intervention.css +++ b/admin/assets/css/intervention.css @@ -1,23 +1,23 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage intervention.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage intervention.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + .text_area{ height: 200px; @@ -25,4 +25,4 @@ } .causewidth { width: 100%; -} +} diff --git a/admin/assets/css/interventions.css b/admin/assets/css/interventions.css index a87f0825..9375c30c 100644 --- a/admin/assets/css/interventions.css +++ b/admin/assets/css/interventions.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage interventions.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage interventions.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/scaling_factor.css b/admin/assets/css/scaling_factor.css index 75c6711a..3cd52af3 100644 --- a/admin/assets/css/scaling_factor.css +++ b/admin/assets/css/scaling_factor.css @@ -1,25 +1,25 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage scaling_factor.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factor.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + .text_area{ height: 200px; width: 100%; -} +} diff --git a/admin/assets/css/scaling_factors.css b/admin/assets/css/scaling_factors.css index 39dda439..d5f73db6 100644 --- a/admin/assets/css/scaling_factors.css +++ b/admin/assets/css/scaling_factors.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage scaling_factors.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factors.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/service_provider.css b/admin/assets/css/service_provider.css index b527e723..3697221a 100644 --- a/admin/assets/css/service_provider.css +++ b/admin/assets/css/service_provider.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage service_provider.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage service_provider.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/service_providers.css b/admin/assets/css/service_providers.css index f79f5c76..54ca08a0 100644 --- a/admin/assets/css/service_providers.css +++ b/admin/assets/css/service_providers.css @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage service_providers.css - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage service_providers.css + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js index e2094e9d..f244a346 100644 --- a/admin/assets/js/admin.js +++ b/admin/assets/js/admin.js @@ -1,19 +1,19 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage admin.js - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage admin.js + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ /* JS Document */ diff --git a/admin/config.xml b/admin/config.xml index 8c3460d1..bca51a38 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -1,5 +1,5 @@ - - + +
-
-
- -
+ +
+ +
\ No newline at end of file diff --git a/admin/controller.php b/admin/controller.php index cb661641..1cf8d830 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -1,104 +1,104 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * General Controller of Costbenefitprojection component - */ -class CostbenefitprojectionController 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'] = 'costbenefitprojection'; - - parent::__construct($config); - } - - /** - * display task - * - * @return void - */ - function display($cachable = false, $urlparams = false) - { - // set default view if not set - $view = $this->input->getCmd('view', 'costbenefitprojection'); - $data = $this->getViewRelation($view); - $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); - - // Check for edit form. - if(CostbenefitprojectionHelper::checkArray($data)) - { - if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_costbenefitprojection.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 && CostbenefitprojectionHelper::checkString($ref)) - { - // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); - } - elseif (CostbenefitprojectionHelper::checkString($ref)) - { - - // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view='.(string)$ref, false)); - } - else - { - // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view='.$data['views'], false)); - } - - return false; - } - } - - return parent::display($cachable, $urlparams); - } - - protected function getViewRelation($view) - { - // check the we have a value - if (CostbenefitprojectionHelper::checkString($view)) - { - // the view relationships +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage controller.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * General Controller of Costbenefitprojection component + */ +class CostbenefitprojectionController 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'] = 'costbenefitprojection'; + + parent::__construct($config); + } + + /** + * display task + * + * @return void + */ + function display($cachable = false, $urlparams = false) + { + // set default view if not set + $view = $this->input->getCmd('view', 'costbenefitprojection'); + $data = $this->getViewRelation($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); + + // Check for edit form. + if(CostbenefitprojectionHelper::checkArray($data)) + { + if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_costbenefitprojection.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 && CostbenefitprojectionHelper::checkString($ref)) + { + // redirect to item of ref + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + } + elseif (CostbenefitprojectionHelper::checkString($ref)) + { + + // redirect to ref + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view='.(string)$ref, false)); + } + else + { + // normal redirect back to the list view + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view='.$data['views'], false)); + } + + return false; + } + } + + return parent::display($cachable, $urlparams); + } + + protected function getViewRelation($view) + { + // check the we have a value + if (CostbenefitprojectionHelper::checkString($view)) + { + // the view relationships $views = array( 'company' => 'companies', 'service_provider' => 'service_providers', @@ -108,21 +108,21 @@ class CostbenefitprojectionController extends JControllerLegacy 'scaling_factor' => 'scaling_factors', 'intervention' => 'interventions', 'currency' => 'currencies', - 'help_document' => 'help_documents' - ); - // 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; - } -} + 'help_document' => 'help_documents' + ); + // 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/ajax.json.php b/admin/controllers/ajax.json.php index 832d614e..c8390553 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -1,63 +1,71 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Ajax Controller - */ -class CostbenefitprojectionControllerAjax 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", "*"); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage ajax.json.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Ajax Controller + */ +class CostbenefitprojectionControllerAjax extends JControllerLegacy +{ + public function __construct($config) + { + parent::__construct($config); + // make sure all json stuff are set + JFactory::getDocument()->setMimeEncoding( 'application/json' ); + // get the application + $app = JFactory::getApplication(); + $app->setHeader('Content-Disposition','attachment;filename="getajax.json"'); + $app->setHeader('Access-Control-Allow-Origin', '*'); // load the tasks $this->registerTask('calculatedResult', 'ajax'); $this->registerTask('interventionBuildTable', 'ajax'); $this->registerTask('getClusterData', 'ajax'); $this->registerTask('isNew', 'ajax'); - $this->registerTask('isRead', '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) + $this->registerTask('isRead', 'ajax'); + } + + public function ajax() + { + // get the user for later use + $user = JFactory::getUser(); + // get the input values + $jinput = JFactory::getApplication()->input; + // check if we should return raw + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + // return to a callback function + $callback = $jinput->get('callback', null, 'CMD'); + // Check Token! + $token = JSession::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) + { + // get the task + $task = $this->getTask(); + switch($task) { case 'calculatedResult': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idValue = $jinput->get('id', NULL, 'INT'); $dataValue = $jinput->get('data', NULL, 'BASE64'); if($idValue && $dataValue) @@ -68,7 +76,7 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -83,10 +91,14 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -96,7 +108,6 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy case 'interventionBuildTable': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idNameValue = $jinput->get('idName', NULL, 'CMD'); $ojectValue = $jinput->get('oject', NULL, 'STRING'); $clusterValue = $jinput->get('cluster', NULL, 'WORD'); @@ -108,7 +119,7 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -123,10 +134,14 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -136,7 +151,6 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy case 'getClusterData': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $idNameValue = $jinput->get('idName', NULL, 'CMD'); $clusterValue = $jinput->get('cluster', NULL, 'STRING'); if($idNameValue && $user->id != 0 && $clusterValue) @@ -147,7 +161,7 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -162,10 +176,14 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -175,7 +193,6 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy case 'isNew': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { @@ -185,7 +202,7 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -200,10 +217,14 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo json_encode($e); + } else { echo "(".json_encode($e).");"; @@ -213,7 +234,6 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy case 'isRead': try { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $noticeValue = $jinput->get('notice', NULL, 'STRING'); if($noticeValue && $user->id != 0) { @@ -223,7 +243,7 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy { $result = false; } - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback . "(".json_encode($result).");"; } @@ -238,28 +258,37 @@ class CostbenefitprojectionControllerAjax extends JControllerLegacy } catch(Exception $e) { - if($callback = $jinput->get('callback', null, 'CMD')) + if($callback) { echo $callback."(".json_encode($e).");"; } + elseif($returnRaw) + { + echo 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).");"; - } - } - } -} + break; + } + } + else + { + // return to a callback function + if($callback) + { + echo $callback."(".json_encode(false).");"; + } + elseif($returnRaw) + { + echo json_encode(false); + } + else + { + echo "(".json_encode(false).");"; + } + } + } +} diff --git a/admin/controllers/causerisk.php b/admin/controllers/causerisk.php index d120018b..11678f58 100644 --- a/admin/controllers/causerisk.php +++ b/admin/controllers/causerisk.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Causerisk Controller - */ -class CostbenefitprojectionControllerCauserisk 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 = 'Causesrisks'; // 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()) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causerisk.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Causerisk Controller + */ +class CostbenefitprojectionControllerCauserisk 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 = 'Causesrisks'; // 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(); @@ -70,20 +70,20 @@ class CostbenefitprojectionControllerCauserisk extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('causerisk.create', $this->option); - } - - /** - * 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') + return $user->authorise('causerisk.create', $this->option); + } + + /** + * 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(); @@ -133,199 +133,199 @@ class CostbenefitprojectionControllerCauserisk extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('causerisk.edit', $this->option); - } - - /** - * 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('Causerisk', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=causesrisks' . $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 $user->authorise('causerisk.edit', $this->option); + } + + /** + * 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') { - return; - } - -} + // 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('Causerisk', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=causesrisks' . $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/causesrisks.php b/admin/controllers/causesrisks.php index a9b95615..03a4c43f 100644 --- a/admin/controllers/causesrisks.php +++ b/admin/controllers/causesrisks.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Causesrisks Controller - */ -class CostbenefitprojectionControllerCausesrisks extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_CAUSESRISKS'; - - /** - * 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 = 'Causerisk', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causesrisks.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Causesrisks Controller + */ +class CostbenefitprojectionControllerCausesrisks extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_CAUSESRISKS'; + + /** + * 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 = 'Causerisk', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -112,5 +112,5 @@ class CostbenefitprojectionControllerCausesrisks extends JControllerAdmin $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=causesrisks', false), $message, 'error'); return; - } -} + } +} diff --git a/admin/controllers/combinedresults.php b/admin/controllers/combinedresults.php index fb33445b..5e839a91 100644 --- a/admin/controllers/combinedresults.php +++ b/admin/controllers/combinedresults.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Combinedresults Controller - */ -class CostbenefitprojectionControllerCombinedresults extends JControllerAdmin -{ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_COMBINEDRESULTS'; - /** - * Proxy for getModel. - * @since 2.5 - */ - public function getModel($name = 'Combinedresults', $prefix = 'CostbenefitprojectionModel', $config = array()) - { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; - } - - public function dashboard() - { - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection', false)); - return; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage combinedresults.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Combinedresults Controller + */ +class CostbenefitprojectionControllerCombinedresults extends JControllerAdmin +{ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_COMBINEDRESULTS'; + /** + * Proxy for getModel. + * @since 2.5 + */ + public function getModel($name = 'Combinedresults', $prefix = 'CostbenefitprojectionModel', $config = array()) + { + $model = parent::getModel($name, $prefix, array('ignore_request' => true)); + + return $model; + } + + public function dashboard() + { + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection', false)); + return; } public function gotoCompanies() @@ -51,5 +51,5 @@ class CostbenefitprojectionControllerCombinedresults extends JControllerAdmin JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); // set the redirecting $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=companies', false)); - } -} + } +} diff --git a/admin/controllers/companies.php b/admin/controllers/companies.php index a7ddc502..94393e53 100644 --- a/admin/controllers/companies.php +++ b/admin/controllers/companies.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Companies Controller - */ -class CostbenefitprojectionControllerCompanies extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_COMPANIES'; - - /** - * 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 = 'Company', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companies.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Companies Controller + */ +class CostbenefitprojectionControllerCompanies extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_COMPANIES'; + + /** + * 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 = 'Company', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -136,5 +136,5 @@ class CostbenefitprojectionControllerCompanies extends JControllerAdmin $message = JText::_('COM_COSTBENEFITPROJECTION_ACCESS_TO_COMBINEDRESULTS_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=companies', false), $message, 'error'); return; - } -} + } +} diff --git a/admin/controllers/company.php b/admin/controllers/company.php index 71cd8b64..bed34609 100644 --- a/admin/controllers/company.php +++ b/admin/controllers/company.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Company Controller - */ -class CostbenefitprojectionControllerCompany 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 = 'Companies'; // 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()) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage company.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Company Controller + */ +class CostbenefitprojectionControllerCompany 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 = 'Companies'; // 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(); @@ -70,20 +70,20 @@ class CostbenefitprojectionControllerCompany extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('company.create', $this->option); - } - - /** - * 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') + return $user->authorise('company.create', $this->option); + } + + /** + * 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(); @@ -148,197 +148,197 @@ class CostbenefitprojectionControllerCompany extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('company.edit', $this->option); - } - - /** - * 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('Company', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=companies' . $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 $user->authorise('company.edit', $this->option); + } + + /** + * 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('Company', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=companies' . $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()) { if ($validData['id'] >= 0) { @@ -580,7 +580,7 @@ class CostbenefitprojectionControllerCompany extends JControllerForm } } - return; - } - -} + return; + } + +} diff --git a/admin/controllers/companyresults.php b/admin/controllers/companyresults.php index fc33146f..89bb8193 100644 --- a/admin/controllers/companyresults.php +++ b/admin/controllers/companyresults.php @@ -1,41 +1,41 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Companyresults Controller - */ -class CostbenefitprojectionControllerCompanyresults extends JControllerLegacy -{ - public function __construct($config) - { - parent::__construct($config); - } - - public function dashboard() - { - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection', false)); - return; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companyresults.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Companyresults Controller + */ +class CostbenefitprojectionControllerCompanyresults extends JControllerLegacy +{ + public function __construct($config) + { + parent::__construct($config); + } + + public function dashboard() + { + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection', false)); + return; } public function editCompany() @@ -55,5 +55,5 @@ class CostbenefitprojectionControllerCompanyresults extends JControllerLegacy JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); // set the redirecting $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=companies', false)); - } -} + } +} diff --git a/admin/controllers/costbenefitprojection.php b/admin/controllers/costbenefitprojection.php index d47716f0..33d662c2 100644 --- a/admin/controllers/costbenefitprojection.php +++ b/admin/controllers/costbenefitprojection.php @@ -1,29 +1,31 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Costbenefitprojection Controller - */ -class CostbenefitprojectionControllerCostbenefitprojection extends JControllerAdmin -{ - -} +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage costbenefitprojection.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + + + +/** + * Costbenefitprojection Controller + */ +class CostbenefitprojectionControllerCostbenefitprojection extends JControllerAdmin +{ + +} diff --git a/admin/controllers/countries.php b/admin/controllers/countries.php index fdd6ffa4..ae297c46 100644 --- a/admin/controllers/countries.php +++ b/admin/controllers/countries.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Countries Controller - */ -class CostbenefitprojectionControllerCountries extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_COUNTRIES'; - - /** - * 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 = 'Country', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage countries.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Countries Controller + */ +class CostbenefitprojectionControllerCountries extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_COUNTRIES'; + + /** + * 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 = 'Country', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -112,5 +112,5 @@ class CostbenefitprojectionControllerCountries extends JControllerAdmin $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=countries', false), $message, 'error'); return; - } -} + } +} diff --git a/admin/controllers/country.php b/admin/controllers/country.php index 2fd0f593..b8999e7d 100644 --- a/admin/controllers/country.php +++ b/admin/controllers/country.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Country Controller - */ -class CostbenefitprojectionControllerCountry 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 = 'Countries'; // 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()) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage country.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Country Controller + */ +class CostbenefitprojectionControllerCountry 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 = 'Countries'; // 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(); @@ -70,20 +70,20 @@ class CostbenefitprojectionControllerCountry extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('country.create', $this->option); - } - - /** - * 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') + return $user->authorise('country.create', $this->option); + } + + /** + * 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(); @@ -142,197 +142,197 @@ class CostbenefitprojectionControllerCountry extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('country.edit', $this->option); - } - - /** - * 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('Country', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=countries' . $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 $user->authorise('country.edit', $this->option); + } + + /** + * 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('Country', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=countries' . $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()) { if ($validData['id'] >= 0) { @@ -502,7 +502,7 @@ class CostbenefitprojectionControllerCountry extends JControllerForm } } - return; - } - -} + return; + } + +} diff --git a/admin/controllers/currencies.php b/admin/controllers/currencies.php index 166a9471..4cb0e5f8 100644 --- a/admin/controllers/currencies.php +++ b/admin/controllers/currencies.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Currencies Controller - */ -class CostbenefitprojectionControllerCurrencies extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_CURRENCIES'; - - /** - * 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 = 'Currency', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage currencies.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Currencies Controller + */ +class CostbenefitprojectionControllerCurrencies extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_CURRENCIES'; + + /** + * 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 = 'Currency', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -112,5 +112,5 @@ class CostbenefitprojectionControllerCurrencies extends JControllerAdmin $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=currencies', false), $message, 'error'); return; - } -} + } +} diff --git a/admin/controllers/currency.php b/admin/controllers/currency.php index 0e8ba5a8..4234344a 100644 --- a/admin/controllers/currency.php +++ b/admin/controllers/currency.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Currency Controller - */ -class CostbenefitprojectionControllerCurrency 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 = 'Currencies'; // 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()) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage currency.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Currency Controller + */ +class CostbenefitprojectionControllerCurrency 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 = 'Currencies'; // 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(); @@ -70,20 +70,20 @@ class CostbenefitprojectionControllerCurrency extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('currency.create', $this->option); - } - - /** - * 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') + return $user->authorise('currency.create', $this->option); + } + + /** + * 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(); @@ -133,199 +133,199 @@ class CostbenefitprojectionControllerCurrency extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('currency.edit', $this->option); - } - - /** - * 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('Currency', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=currencies' . $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 $user->authorise('currency.edit', $this->option); + } + + /** + * 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') { - return; - } - -} + // 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('Currency', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=currencies' . $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_data.php b/admin/controllers/health_data.php index 7436d27c..7bfc48e7 100644 --- a/admin/controllers/health_data.php +++ b/admin/controllers/health_data.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Health_data Controller - */ -class CostbenefitprojectionControllerHealth_data 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_data_sets'; // 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()) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage health_data.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Health_data Controller + */ +class CostbenefitprojectionControllerHealth_data 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_data_sets'; // 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(); @@ -70,20 +70,20 @@ class CostbenefitprojectionControllerHealth_data extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('health_data.create', $this->option); - } - - /** - * 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') + return $user->authorise('health_data.create', $this->option); + } + + /** + * 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(); @@ -143,199 +143,199 @@ class CostbenefitprojectionControllerHealth_data extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('health_data.edit', $this->option); - } - - /** - * 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_data', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=health_data_sets' . $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 $user->authorise('health_data.edit', $this->option); + } + + /** + * 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') { - return; - } - -} + // 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_data', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=health_data_sets' . $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_data_sets.php b/admin/controllers/health_data_sets.php index c4265ada..5f45922f 100644 --- a/admin/controllers/health_data_sets.php +++ b/admin/controllers/health_data_sets.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Health_data_sets Controller - */ -class CostbenefitprojectionControllerHealth_data_sets extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_SETS'; - - /** - * 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_data', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage health_data_sets.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Health_data_sets Controller + */ +class CostbenefitprojectionControllerHealth_data_sets extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_SETS'; + + /** + * 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_data', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -155,5 +155,5 @@ class CostbenefitprojectionControllerHealth_data_sets extends JControllerAdmin $message = JText::_('COM_COSTBENEFITPROJECTION_YOU_DO_NOT_HAVE_PERMISSION_TO_DO_A_BULK_EXPORT_OF_HEALTH_DATA_SETS'); } $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=health_data_sets', false), $message, $status); - } -} + } +} diff --git a/admin/controllers/help.php b/admin/controllers/help.php index f5f25255..044c73f9 100644 --- a/admin/controllers/help.php +++ b/admin/controllers/help.php @@ -1,123 +1,123 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Help Controller - */ -class CostbenefitprojectionControllerHelp extends JControllerLegacy -{ - public function __construct($config) - { - parent::__construct($config); - // load the tasks - $this->registerTask('getText', 'help'); - } - - public function help() - { - $user = JFactory::getUser(); - $jinput = JFactory::getApplication()->input; - // Check Token! - $token = JSession::getFormToken(); - $call_token = $jinput->get('token', 0, 'ALNUM'); - if($user->id != 0 && $token == $call_token) - { - $task = $this->getTask(); - switch($task){ - case 'getText': - try - { - $idValue = $jinput->get('id', 0, 'INT'); - if($idValue) - { - $result = $this->getHelpDocumentText($idValue); - } - else - { - $result = ''; - } - echo $result; - // stop execution gracefully - jexit(); - } - catch(Exception $e) - { - // stop execution gracefully - jexit(); - } - break; - } - } - else - { - // stop execution gracefully - jexit(); - } - } - - protected function getHelpDocumentText($id) - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - $query->select(array('a.title','a.content')); - $query->from('#__costbenefitprojection_help_document AS a'); - $query->where('a.id = '.(int) $id); - $query->where('a.published = 1'); - $db->setQuery($query); - $db->execute(); - if($db->getNumRows()) - { - $text = array(); - $document = $db->loadObject(); - // fix image issue - $images['src="images'] = 'src="'.JURI::root().'images'; - $images["src='images"] = "src='".JURI::root()."images"; - $images['src="/images'] = 'src="'.JURI::root().'images'; - $images["src='/images"] = "src='".JURI::root()."images"; - // set document template - $text[] = ""; - $text[] = ''; - $text[] = ""; - $text[] = ''; - $text[] = "".$document->title.""; - $text[] = ''; - $text[] = ''; - $text[] = ""; - $text[] = '
'; - $text[] = '
'; - $text[] = '
'; - // build the help text - $text[] = '

'.$document->title."

"; - $text[] = str_replace(array_keys($images),array_values($images),$document->content); - // end template - $text[] = '


'; - $text[] = '
'; - $text[] = ""; - $text[] = ""; - - return implode("\n",$text); - } - return false; - } -} +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage help.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Help Controller + */ +class CostbenefitprojectionControllerHelp extends JControllerLegacy +{ + public function __construct($config) + { + parent::__construct($config); + // load the tasks + $this->registerTask('getText', 'help'); + } + + public function help() + { + $user = JFactory::getUser(); + $jinput = JFactory::getApplication()->input; + // Check Token! + $token = JSession::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($user->id != 0 && $token == $call_token) + { + $task = $this->getTask(); + switch($task){ + case 'getText': + try + { + $idValue = $jinput->get('id', 0, 'INT'); + if($idValue) + { + $result = $this->getHelpDocumentText($idValue); + } + else + { + $result = ''; + } + echo $result; + // stop execution gracefully + jexit(); + } + catch(Exception $e) + { + // stop execution gracefully + jexit(); + } + break; + } + } + else + { + // stop execution gracefully + jexit(); + } + } + + protected function getHelpDocumentText($id) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select(array('a.title','a.content')); + $query->from('#__costbenefitprojection_help_document AS a'); + $query->where('a.id = '.(int) $id); + $query->where('a.published = 1'); + $db->setQuery($query); + $db->execute(); + if($db->getNumRows()) + { + $text = array(); + $document = $db->loadObject(); + // fix image issue + $images['src="images'] = 'src="'.JURI::root().'images'; + $images["src='images"] = "src='".JURI::root()."images"; + $images['src="/images'] = 'src="'.JURI::root().'images'; + $images["src='/images"] = "src='".JURI::root()."images"; + // set document template + $text[] = ""; + $text[] = ''; + $text[] = ""; + $text[] = ''; + $text[] = "".$document->title.""; + $text[] = ''; + $text[] = ''; + $text[] = ""; + $text[] = '
'; + $text[] = '
'; + $text[] = '
'; + // build the help text + $text[] = '

'.$document->title."

"; + $text[] = str_replace(array_keys($images),array_values($images),$document->content); + // end template + $text[] = '


'; + $text[] = '
'; + $text[] = ""; + $text[] = ""; + + return implode("\n",$text); + } + return false; + } +} diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index 353be0dc..8922e935 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Help_document Controller - */ -class CostbenefitprojectionControllerHelp_document 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 = 'Help_documents'; // 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()) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage help_document.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Help_document Controller + */ +class CostbenefitprojectionControllerHelp_document 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 = 'Help_documents'; // 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(); @@ -70,20 +70,20 @@ class CostbenefitprojectionControllerHelp_document extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('help_document.create', $this->option); - } - - /** - * 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') + return $user->authorise('help_document.create', $this->option); + } + + /** + * 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(); @@ -133,199 +133,199 @@ class CostbenefitprojectionControllerHelp_document extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('help_document.edit', $this->option); - } - - /** - * 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('Help_document', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=help_documents' . $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 $user->authorise('help_document.edit', $this->option); + } + + /** + * 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') { - return; - } - -} + // 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('Help_document', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=help_documents' . $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/help_documents.php b/admin/controllers/help_documents.php index bda5b150..a1ec03dc 100644 --- a/admin/controllers/help_documents.php +++ b/admin/controllers/help_documents.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Help_documents Controller - */ -class CostbenefitprojectionControllerHelp_documents extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_HELP_DOCUMENTS'; - - /** - * 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 = 'Help_document', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage help_documents.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Help_documents Controller + */ +class CostbenefitprojectionControllerHelp_documents extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_HELP_DOCUMENTS'; + + /** + * 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 = 'Help_document', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -112,5 +112,5 @@ class CostbenefitprojectionControllerHelp_documents extends JControllerAdmin $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=help_documents', false), $message, 'error'); return; - } -} + } +} diff --git a/admin/controllers/import.php b/admin/controllers/import.php index 8feaa1aa..729e0052 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -1,63 +1,63 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Import Controller - */ -class CostbenefitprojectionControllerImport 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_costbenefitprojection.redirect_url'); - if (empty($redirect_url)) - { - $redirect_url = JRoute::_('index.php?option=com_costbenefitprojection&view=import', false); - } - else - { - // wipe out the user state when we're going to redirect - $app->setUserState('com_costbenefitprojection.redirect_url', ''); - $app->setUserState('com_costbenefitprojection.message', ''); - $app->setUserState('com_costbenefitprojection.extension_message', ''); - } - $this->setRedirect($redirect_url); - } -} +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage import.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Import Controller + */ +class CostbenefitprojectionControllerImport 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_costbenefitprojection.redirect_url'); + if (empty($redirect_url)) + { + $redirect_url = JRoute::_('index.php?option=com_costbenefitprojection&view=import', false); + } + else + { + // wipe out the user state when we're going to redirect + $app->setUserState('com_costbenefitprojection.redirect_url', ''); + $app->setUserState('com_costbenefitprojection.message', ''); + $app->setUserState('com_costbenefitprojection.extension_message', ''); + } + $this->setRedirect($redirect_url); + } +} diff --git a/admin/controllers/import_health_data_sets.php b/admin/controllers/import_health_data_sets.php index 3f92573e..1fb3c0ca 100644 --- a/admin/controllers/import_health_data_sets.php +++ b/admin/controllers/import_health_data_sets.php @@ -1,63 +1,63 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Import_health_data_sets Controller - */ -class CostbenefitprojectionControllerImport_health_data_sets 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_health_data_sets'); - 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_costbenefitprojection.redirect_url'); - if (empty($redirect_url)) - { - $redirect_url = JRoute::_('index.php?option=com_costbenefitprojection&view=import_health_data_sets', false); - } - else - { - // wipe out the user state when we're going to redirect - $app->setUserState('com_costbenefitprojection.redirect_url', ''); - $app->setUserState('com_costbenefitprojection.message', ''); - $app->setUserState('com_costbenefitprojection.extension_message', ''); - } - $this->setRedirect($redirect_url); - } -} +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage import_health_data_sets.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Import_health_data_sets Controller + */ +class CostbenefitprojectionControllerImport_health_data_sets 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_health_data_sets'); + 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_costbenefitprojection.redirect_url'); + if (empty($redirect_url)) + { + $redirect_url = JRoute::_('index.php?option=com_costbenefitprojection&view=import_health_data_sets', false); + } + else + { + // wipe out the user state when we're going to redirect + $app->setUserState('com_costbenefitprojection.redirect_url', ''); + $app->setUserState('com_costbenefitprojection.message', ''); + $app->setUserState('com_costbenefitprojection.extension_message', ''); + } + $this->setRedirect($redirect_url); + } +} diff --git a/admin/controllers/intervention.php b/admin/controllers/intervention.php index 8edc77d0..4ffab043 100644 --- a/admin/controllers/intervention.php +++ b/admin/controllers/intervention.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Intervention Controller - */ -class CostbenefitprojectionControllerIntervention 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 = 'Interventions'; // 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()) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage intervention.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Intervention Controller + */ +class CostbenefitprojectionControllerIntervention 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 = 'Interventions'; // 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(); @@ -70,20 +70,20 @@ class CostbenefitprojectionControllerIntervention extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('intervention.create', $this->option); - } - - /** - * 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') + return $user->authorise('intervention.create', $this->option); + } + + /** + * 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(); @@ -148,199 +148,199 @@ class CostbenefitprojectionControllerIntervention extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('intervention.edit', $this->option); - } - - /** - * 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('Intervention', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=interventions' . $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 $user->authorise('intervention.edit', $this->option); + } + + /** + * 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') { - return; - } - -} + // 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('Intervention', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=interventions' . $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/interventions.php b/admin/controllers/interventions.php index e80560d6..b7976928 100644 --- a/admin/controllers/interventions.php +++ b/admin/controllers/interventions.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Interventions Controller - */ -class CostbenefitprojectionControllerInterventions extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_INTERVENTIONS'; - - /** - * 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 = 'Intervention', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage interventions.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Interventions Controller + */ +class CostbenefitprojectionControllerInterventions extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_INTERVENTIONS'; + + /** + * 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 = 'Intervention', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -112,5 +112,5 @@ class CostbenefitprojectionControllerInterventions extends JControllerAdmin $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=interventions', false), $message, 'error'); return; - } -} + } +} diff --git a/admin/controllers/scaling_factor.php b/admin/controllers/scaling_factor.php index 3232a018..2c54a613 100644 --- a/admin/controllers/scaling_factor.php +++ b/admin/controllers/scaling_factor.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Scaling_factor Controller - */ -class CostbenefitprojectionControllerScaling_factor 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 = 'Scaling_factors'; // 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()) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factor.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Scaling_factor Controller + */ +class CostbenefitprojectionControllerScaling_factor 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 = 'Scaling_factors'; // 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(); @@ -70,20 +70,20 @@ class CostbenefitprojectionControllerScaling_factor extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('scaling_factor.create', $this->option); - } - - /** - * 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') + return $user->authorise('scaling_factor.create', $this->option); + } + + /** + * 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(); @@ -142,199 +142,199 @@ class CostbenefitprojectionControllerScaling_factor extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('scaling_factor.edit', $this->option); - } - - /** - * 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('Scaling_factor', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=scaling_factors' . $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 $user->authorise('scaling_factor.edit', $this->option); + } + + /** + * 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') { - return; - } - -} + // 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('Scaling_factor', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=scaling_factors' . $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/scaling_factors.php b/admin/controllers/scaling_factors.php index 78e2b136..ece6ad87 100644 --- a/admin/controllers/scaling_factors.php +++ b/admin/controllers/scaling_factors.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Scaling_factors Controller - */ -class CostbenefitprojectionControllerScaling_factors extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_SCALING_FACTORS'; - - /** - * 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 = 'Scaling_factor', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factors.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Scaling_factors Controller + */ +class CostbenefitprojectionControllerScaling_factors extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_SCALING_FACTORS'; + + /** + * 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 = 'Scaling_factor', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -112,5 +112,5 @@ class CostbenefitprojectionControllerScaling_factors extends JControllerAdmin $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=scaling_factors', false), $message, 'error'); return; - } -} + } +} diff --git a/admin/controllers/service_provider.php b/admin/controllers/service_provider.php index 2b92e85b..4752041f 100644 --- a/admin/controllers/service_provider.php +++ b/admin/controllers/service_provider.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Service_provider Controller - */ -class CostbenefitprojectionControllerService_provider 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 = 'Service_providers'; // 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()) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage service_provider.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Service_provider Controller + */ +class CostbenefitprojectionControllerService_provider 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 = 'Service_providers'; // 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(); @@ -70,20 +70,20 @@ class CostbenefitprojectionControllerService_provider extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('service_provider.create', $this->option); - } - - /** - * 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') + return $user->authorise('service_provider.create', $this->option); + } + + /** + * 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(); @@ -141,197 +141,197 @@ class CostbenefitprojectionControllerService_provider extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('service_provider.edit', $this->option); - } - - /** - * 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('Service_provider', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=service_providers' . $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 $user->authorise('service_provider.edit', $this->option); + } + + /** + * 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('Service_provider', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=service_providers' . $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()) { if ($validData['id'] >= 0) { @@ -393,7 +393,7 @@ class CostbenefitprojectionControllerService_provider extends JControllerForm } } - return; - } - -} + return; + } + +} diff --git a/admin/controllers/service_providers.php b/admin/controllers/service_providers.php index ccf822d4..c62daa7f 100644 --- a/admin/controllers/service_providers.php +++ b/admin/controllers/service_providers.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Service_providers Controller - */ -class CostbenefitprojectionControllerService_providers extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION_SERVICE_PROVIDERS'; - - /** - * 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 = 'Service_provider', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage service_providers.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Service_providers Controller + */ +class CostbenefitprojectionControllerService_providers extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION_SERVICE_PROVIDERS'; + + /** + * 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 = 'Service_provider', $prefix = 'CostbenefitprojectionModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -112,5 +112,5 @@ class CostbenefitprojectionControllerService_providers extends JControllerAdmin $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=service_providers', false), $message, 'error'); return; - } -} + } +} diff --git a/admin/costbenefitprojection.php b/admin/costbenefitprojection.php index 2e10cc29..833a681d 100644 --- a/admin/costbenefitprojection.php +++ b/admin/costbenefitprojection.php @@ -1,47 +1,47 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::_('behavior.tabstate'); - -// Access check. -if (!JFactory::getUser()->authorise('core.manage', 'com_costbenefitprojection')) -{ - throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); -}; - -// Add CSS file for all pages -$document = JFactory::getDocument(); -$document->addStyleSheet('components/com_costbenefitprojection/assets/css/admin.css'); -$document->addScript('components/com_costbenefitprojection/assets/js/admin.js'); - -// require helper files -JLoader::register('CostbenefitprojectionHelper', __DIR__ . '/helpers/costbenefitprojection.php'); -JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); - -// Get an instance of the controller prefixed by Costbenefitprojection -$controller = JControllerLegacy::getInstance('Costbenefitprojection'); - -// Perform the Request task -$controller->execute(JFactory::getApplication()->input->get('task')); - -// Redirect if set by the controller -$controller->redirect(); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage costbenefitprojection.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + + + +// Access check. +if (!JFactory::getUser()->authorise('core.manage', 'com_costbenefitprojection')) +{ + throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); +}; + +// Add CSS file for all pages +$document = JFactory::getDocument(); +$document->addStyleSheet('components/com_costbenefitprojection/assets/css/admin.css'); +$document->addScript('components/com_costbenefitprojection/assets/js/admin.js'); + +// require helper files +JLoader::register('CostbenefitprojectionHelper', __DIR__ . '/helpers/costbenefitprojection.php'); +JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); + +// Get an instance of the controller prefixed by Costbenefitprojection +$controller = JControllerLegacy::getInstance('Costbenefitprojection'); + +// Perform the Request task +$controller->execute(JFactory::getApplication()->input->get('task')); + +// Redirect if set by the controller +$controller->redirect(); diff --git a/admin/helpers/costbenefitprojection.php b/admin/helpers/costbenefitprojection.php index ae450231..468f3b33 100644 --- a/admin/helpers/costbenefitprojection.php +++ b/admin/helpers/costbenefitprojection.php @@ -1,50 +1,51 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage costbenefitprojection.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +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; - -/** - * Costbenefitprojection component helper. - */ -abstract class CostbenefitprojectionHelper -{ - /** - * Composer Switch - * - * @var array - */ - protected static $composer = array(); - - /** - * The Main Active Language - * - * @var string - */ +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +/** + * Costbenefitprojection component helper. + */ +abstract class CostbenefitprojectionHelper +{ + /** + * Composer Switch + * + * @var array + */ + protected static $composer = array(); + + /** + * The Main Active Language + * + * @var string + */ public static $langTag; public static function userIs($id = null) @@ -775,91 +776,91 @@ abstract class CostbenefitprojectionHelper self::$localkey = md5(JComponentHelper::getParams('com_costbenefitprojection')->get('basic', 'localKey34fdWEkl')); } return self::$localkey; - } - - /** - * 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_costbenefitprojection/costbenefitprojection.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_costbenefitprojection'); - // 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; + } + + /** + * 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_costbenefitprojection/costbenefitprojection.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_costbenefitprojection'); + // 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; } /** @@ -932,16 +933,16 @@ abstract class CostbenefitprojectionHelper { $token = JSession::getFormToken(); return 'index.php?option=com_costbenefitprojection&task=help.getText&id=' . (int) $id . '&token=' . $token; - } - - /** - * Configure the Linkbar. - */ - public static function addSubmenu($submenu) - { - // load user for access menus - $user = JFactory::getUser(); - // load the submenus to sidebar + } + + /** + * 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_COSTBENEFITPROJECTION_SUBMENU_DASHBOARD'), 'index.php?option=com_costbenefitprojection&view=costbenefitprojection', $submenu === 'costbenefitprojection'); if ($user->authorise('company.access', 'com_costbenefitprojection') && $user->authorise('company.submenu', 'com_costbenefitprojection')) { @@ -978,7 +979,7 @@ abstract class CostbenefitprojectionHelper if ($user->authorise('help_document.access', 'com_costbenefitprojection') && $user->authorise('help_document.submenu', 'com_costbenefitprojection')) { JHtmlSidebar::addEntry(JText::_('COM_COSTBENEFITPROJECTION_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_costbenefitprojection&view=help_documents', $submenu === 'help_documents'); - } + } } /** @@ -1301,7 +1302,7 @@ abstract class CostbenefitprojectionHelper /** * Prepares the xml document */ - public static function xls($rows, $fileName = null, $title = null, $subjectTab = null, $creator = 'Joomla Component Builder', $description = null, $category = null,$keywords = null, $modified = null) + public static function xls($rows, $fileName = null, $title = null, $subjectTab = null, $creator = 'Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb', $description = null, $category = null,$keywords = null, $modified = null) { // set the user $user = JFactory::getUser(); @@ -1335,7 +1336,7 @@ abstract class CostbenefitprojectionHelper // Set document properties $spreadsheet->getProperties() ->setCreator($creator) - ->setCompany('Joomla Component Builder') + ->setCompany('Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb') ->setLastModifiedBy($modified) ->setTitle($title) ->setSubject($subjectTab); @@ -1515,1211 +1516,1211 @@ abstract class CostbenefitprojectionHelper 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 = 'costbenefitprojection') - { - 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 = 'costbenefitprojection', $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('#__costbenefitprojection_'.$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 = 'costbenefitprojection', $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 = 'Costbenefitprojection', $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 (JFile::exists($filePath)) - { - // get the file - require_once $filePath; - } - elseif (JFile::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_costbenefitprojection'); - - $parentId = $parent->id; - $name = 'com_costbenefitprojection.'.$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_costbenefitprojection', $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('#__costbenefitprojection_'.$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_costbenefitprojection')->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); + } + + /** + * 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 = 'costbenefitprojection') + { + 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 = 'costbenefitprojection', $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('#__costbenefitprojection_'.$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 = 'costbenefitprojection', $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 = 'Costbenefitprojection', $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_costbenefitprojection'); + + $parentId = $parent->id; + $name = 'com_costbenefitprojection.'.$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_costbenefitprojection', $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('#__costbenefitprojection_'.$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_costbenefitprojection')->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); } /** @@ -2751,5 +2752,5 @@ abstract class CostbenefitprojectionHelper } return $default; - } -} + } +} diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index 8ccb273a..9ac56654 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -1,79 +1,79 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -class costbenefitprojectionHeaderCheck -{ - 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; - } +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage headercheck.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +class costbenefitprojectionHeaderCheck +{ + 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 index 11c39b19..a68729e2 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -1,86 +1,86 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('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; - } -} +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage batch_.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('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/sum.php b/admin/helpers/sum.php index 657bad0b..333050b2 100644 --- a/admin/helpers/sum.php +++ b/admin/helpers/sum.php @@ -1,20 +1,20 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage sum.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file diff --git a/admin/helpers/sumcombine.php b/admin/helpers/sumcombine.php index dd508072..cc0d350e 100644 --- a/admin/helpers/sumcombine.php +++ b/admin/helpers/sumcombine.php @@ -1,20 +1,20 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage sumcombine.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file diff --git a/admin/language/en-GB/en-GB.com_costbenefitprojection.ini b/admin/language/en-GB/en-GB.com_costbenefitprojection.ini index 1d91647d..16a00572 100644 --- a/admin/language/en-GB/en-GB.com_costbenefitprojection.ini +++ b/admin/language/en-GB/en-GB.com_costbenefitprojection.ini @@ -19,14 +19,12 @@ COM_COSTBENEFITPROJECTION_BULK_EXPORT="Bulk Export" COM_COSTBENEFITPROJECTION_BULK_EXPORT_OF_HEALTH_DATA_SETS_FAILED_SHOULD_THIS_ISSUE_CONTINUE_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="Bulk export of health_data_sets failed should this issue continue, please inform your system administrator." COM_COSTBENEFITPROJECTION_CALCULATED_COSTS_IN_DETAIL="Calculated Costs in Detail" COM_COSTBENEFITPROJECTION_CAUSERISK="Cause/Risk" -COM_COSTBENEFITPROJECTION_CAUSERISK_ALIAS="Alias" COM_COSTBENEFITPROJECTION_CAUSERISK_ALIAS_HINT="Auto-generated from name" COM_COSTBENEFITPROJECTION_CAUSERISK_ALIAS_LABEL="Alias" COM_COSTBENEFITPROJECTION_CAUSERISK_CREATED_BY_DESC="The user that created this Cause/Risk." COM_COSTBENEFITPROJECTION_CAUSERISK_CREATED_BY_LABEL="Created By" COM_COSTBENEFITPROJECTION_CAUSERISK_CREATED_DATE_DESC="The date this Cause/Risk was created." COM_COSTBENEFITPROJECTION_CAUSERISK_CREATED_DATE_LABEL="Created Date" -COM_COSTBENEFITPROJECTION_CAUSERISK_DESCRIPTION="Description" COM_COSTBENEFITPROJECTION_CAUSERISK_DESCRIPTION_DESCRIPTION="Add Description Here" COM_COSTBENEFITPROJECTION_CAUSERISK_DESCRIPTION_HINT="Add Description Here" COM_COSTBENEFITPROJECTION_CAUSERISK_DESCRIPTION_LABEL="Description" @@ -35,12 +33,10 @@ COM_COSTBENEFITPROJECTION_CAUSERISK_EDIT="Editing the Cause/Risk" COM_COSTBENEFITPROJECTION_CAUSERISK_ERROR_UNIQUE_ALIAS="Another Cause/Risk has the same alias." COM_COSTBENEFITPROJECTION_CAUSERISK_FACTOR="Cause/Risk Factor" COM_COSTBENEFITPROJECTION_CAUSERISK_ID="Id" -COM_COSTBENEFITPROJECTION_CAUSERISK_IMPORTNAME="Importname" COM_COSTBENEFITPROJECTION_CAUSERISK_IMPORTNAME_DESCRIPTION="Enter Import Name Here" COM_COSTBENEFITPROJECTION_CAUSERISK_IMPORTNAME_HINT="Import Name Here" COM_COSTBENEFITPROJECTION_CAUSERISK_IMPORTNAME_LABEL="Import Name" COM_COSTBENEFITPROJECTION_CAUSERISK_IMPORTNAME_MESSAGE="Error! Please add import name here." -COM_COSTBENEFITPROJECTION_CAUSERISK_IMPORT_ID="Import Id" COM_COSTBENEFITPROJECTION_CAUSERISK_IMPORT_ID_DESCRIPTION="This is the id that is used during import of the health data." COM_COSTBENEFITPROJECTION_CAUSERISK_IMPORT_ID_LABEL="Import ID" COM_COSTBENEFITPROJECTION_CAUSERISK_IMPORT_ID_MESSAGE="Error! Please add some the import ID here." @@ -48,7 +44,6 @@ COM_COSTBENEFITPROJECTION_CAUSERISK_MODIFIED_BY_DESC="The last user that modifie COM_COSTBENEFITPROJECTION_CAUSERISK_MODIFIED_BY_LABEL="Modified By" COM_COSTBENEFITPROJECTION_CAUSERISK_MODIFIED_DATE_DESC="The date this Cause/Risk was modified." COM_COSTBENEFITPROJECTION_CAUSERISK_MODIFIED_DATE_LABEL="Modified Date" -COM_COSTBENEFITPROJECTION_CAUSERISK_NAME="Name" COM_COSTBENEFITPROJECTION_CAUSERISK_NAME_DESCRIPTION="Enter Name Here" COM_COSTBENEFITPROJECTION_CAUSERISK_NAME_HINT="Name Here" COM_COSTBENEFITPROJECTION_CAUSERISK_NAME_LABEL="Name" @@ -57,7 +52,6 @@ COM_COSTBENEFITPROJECTION_CAUSERISK_NEW="A New Cause/Risk" COM_COSTBENEFITPROJECTION_CAUSERISK_ORDERING_LABEL="Ordering" COM_COSTBENEFITPROJECTION_CAUSERISK_PERMISSION="Permissions" COM_COSTBENEFITPROJECTION_CAUSERISK_PUBLISHING="Publishing" -COM_COSTBENEFITPROJECTION_CAUSERISK_REF="Ref" COM_COSTBENEFITPROJECTION_CAUSERISK_REF_DESCRIPTION="The reference number for this cause/risk" COM_COSTBENEFITPROJECTION_CAUSERISK_REF_HINT="Ref Number Here" COM_COSTBENEFITPROJECTION_CAUSERISK_REF_LABEL="Ref Nr" @@ -212,31 +206,25 @@ COM_COSTBENEFITPROJECTION_COMPANY_AGE_GROUPS_PERCENTAGES="Age Groups Percentages COM_COSTBENEFITPROJECTION_COMPANY_AGE_LABEL="Age Group" COM_COSTBENEFITPROJECTION_COMPANY_BASIC="Basic" COM_COSTBENEFITPROJECTION_COMPANY_CAUSERISK_SELECTION="Cause/Risk Selection" -COM_COSTBENEFITPROJECTION_COMPANY_CAUSESRISKS="Causesrisks" COM_COSTBENEFITPROJECTION_COMPANY_CAUSESRISKS_LABEL="Causes/Risks" COM_COSTBENEFITPROJECTION_COMPANY_CAUSE_RISK_SELECTION_NOTE_DESCRIPTION="This feature is only available to the advanced department." COM_COSTBENEFITPROJECTION_COMPANY_CAUSE_RISK_SELECTION_NOTE_LABEL="Cause/Risk Selection" -COM_COSTBENEFITPROJECTION_COMPANY_COUNTRY="Country" COM_COSTBENEFITPROJECTION_COMPANY_COUNTRY_DESCRIPTION="List of available countries" COM_COSTBENEFITPROJECTION_COMPANY_COUNTRY_LABEL="Country" COM_COSTBENEFITPROJECTION_COMPANY_CREATED_BY_DESC="The user that created this Company." COM_COSTBENEFITPROJECTION_COMPANY_CREATED_BY_LABEL="Created By" COM_COSTBENEFITPROJECTION_COMPANY_CREATED_DATE_DESC="The date this Company was created." COM_COSTBENEFITPROJECTION_COMPANY_CREATED_DATE_LABEL="Created Date" -COM_COSTBENEFITPROJECTION_COMPANY_DATAYEAR="Datayear" COM_COSTBENEFITPROJECTION_COMPANY_DATAYEAR_DESCRIPTION="Select which year's data should be used in calculations." COM_COSTBENEFITPROJECTION_COMPANY_DATAYEAR_LABEL="Data Year" -COM_COSTBENEFITPROJECTION_COMPANY_DEPARTMENT="Department" COM_COSTBENEFITPROJECTION_COMPANY_DEPARTMENT_LABEL="Department" COM_COSTBENEFITPROJECTION_COMPANY_DETAILS="Details" COM_COSTBENEFITPROJECTION_COMPANY_EDIT="Editing the Company" -COM_COSTBENEFITPROJECTION_COMPANY_EMAIL="Email" COM_COSTBENEFITPROJECTION_COMPANY_EMAIL_DESCRIPTION="Enter Email" COM_COSTBENEFITPROJECTION_COMPANY_EMAIL_HINT="demo@example.com" COM_COSTBENEFITPROJECTION_COMPANY_EMAIL_LABEL="Email" COM_COSTBENEFITPROJECTION_COMPANY_EMAIL_MESSAGE="Error! Please add email address here." COM_COSTBENEFITPROJECTION_COMPANY_ERROR_UNIQUE_ALIAS="Another Company has the same alias." -COM_COSTBENEFITPROJECTION_COMPANY_FEMALES="Females" COM_COSTBENEFITPROJECTION_COMPANY_FEMALES_DESCRIPTION="The Total Number of Female Employees." COM_COSTBENEFITPROJECTION_COMPANY_FEMALES_HINT="Just A Number" COM_COSTBENEFITPROJECTION_COMPANY_FEMALES_LABEL="Total Female Employees" @@ -249,17 +237,14 @@ COM_COSTBENEFITPROJECTION_COMPANY_FORTY_FIVEFORTY_NINE="45-49" COM_COSTBENEFITPROJECTION_COMPANY_ID="Id" COM_COSTBENEFITPROJECTION_COMPANY_INTERVENTIONS="Interventions" COM_COSTBENEFITPROJECTION_COMPANY_LOCKED="Locked" -COM_COSTBENEFITPROJECTION_COMPANY_MALES="Males" COM_COSTBENEFITPROJECTION_COMPANY_MALES_DESCRIPTION="The Total Number of Male Employees." COM_COSTBENEFITPROJECTION_COMPANY_MALES_HINT="Just A Number" COM_COSTBENEFITPROJECTION_COMPANY_MALES_LABEL="Total Male Employees" COM_COSTBENEFITPROJECTION_COMPANY_MALES_MESSAGE="Error! Please add total male employees here." -COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_FEMALES="Medical Turnovers Females" COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_FEMALES_DESCRIPTION="The total number of medical turnovers for females per/year." COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_FEMALES_HINT="per/year" COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_FEMALES_LABEL="Total Number Medical Turnovers Female" COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_FEMALES_MESSAGE="Error! Please add total number of medical turnovers for females here." -COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_MALES="Medical Turnovers Males" COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_MALES_DESCRIPTION="The total number of medical turnovers for males per/year." COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_MALES_HINT="per/year" COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_MALES_LABEL="Total Number Medical Turnovers Male" @@ -268,7 +253,6 @@ COM_COSTBENEFITPROJECTION_COMPANY_MODIFIED_BY_DESC="The last user that modified COM_COSTBENEFITPROJECTION_COMPANY_MODIFIED_BY_LABEL="Modified By" COM_COSTBENEFITPROJECTION_COMPANY_MODIFIED_DATE_DESC="The date this Company was modified." COM_COSTBENEFITPROJECTION_COMPANY_MODIFIED_DATE_LABEL="Modified Date" -COM_COSTBENEFITPROJECTION_COMPANY_NAME="Name" COM_COSTBENEFITPROJECTION_COMPANY_NAME_DESCRIPTION="Enter Company Name Here" COM_COSTBENEFITPROJECTION_COMPANY_NAME_HINT="Company Name Here" COM_COSTBENEFITPROJECTION_COMPANY_NAME_LABEL="Company Name" @@ -277,12 +261,9 @@ COM_COSTBENEFITPROJECTION_COMPANY_NEW="A New Company" COM_COSTBENEFITPROJECTION_COMPANY_NOT_REQUIRED="Not Required" COM_COSTBENEFITPROJECTION_COMPANY_OPEN="Open" COM_COSTBENEFITPROJECTION_COMPANY_ORDERING_LABEL="Ordering" -COM_COSTBENEFITPROJECTION_COMPANY_PER="Per" -COM_COSTBENEFITPROJECTION_COMPANY_PERCENTFEMALE="Percentfemale" COM_COSTBENEFITPROJECTION_COMPANY_PERCENTFEMALE_DESCRIPTION="Here you can add females age groups percent." COM_COSTBENEFITPROJECTION_COMPANY_PERCENTFEMALE_LABEL="Set Females Age Groups Percent" COM_COSTBENEFITPROJECTION_COMPANY_PERCENTFEMALE_SELECT="Edit/Add" -COM_COSTBENEFITPROJECTION_COMPANY_PERCENTMALE="Percentmale" COM_COSTBENEFITPROJECTION_COMPANY_PERCENTMALE_DESCRIPTION="Here you can add males age groups percent." COM_COSTBENEFITPROJECTION_COMPANY_PERCENTMALE_LABEL="Set Males Age Groups Percent" COM_COSTBENEFITPROJECTION_COMPANY_PERCENTMALE_SELECT="Edit/Add" @@ -292,7 +273,6 @@ COM_COSTBENEFITPROJECTION_COMPANY_PERCENT_MESSAGE="Error! Please add percent her COM_COSTBENEFITPROJECTION_COMPANY_PERMISSION="Permissions" COM_COSTBENEFITPROJECTION_COMPANY_PER_DESCRIPTION="Select your profile access status" COM_COSTBENEFITPROJECTION_COMPANY_PER_LABEL="Profile Status" -COM_COSTBENEFITPROJECTION_COMPANY_PRODUCTIVITY_LOSSES="Productivity Losses" COM_COSTBENEFITPROJECTION_COMPANY_PRODUCTIVITY_LOSSES_DESCRIPTION="The proportion of annual salary that it costs to replace an employee for medical reasons." COM_COSTBENEFITPROJECTION_COMPANY_PRODUCTIVITY_LOSSES_HINT="0.05" COM_COSTBENEFITPROJECTION_COMPANY_PRODUCTIVITY_LOSSES_LABEL="Medical Turnover Cost Factor" @@ -308,14 +288,11 @@ COM_COSTBENEFITPROJECTION_COMPANY_RESULTS_EDIT_BUTTON_ACCESS="Company Results Ed COM_COSTBENEFITPROJECTION_COMPANY_RESULTS_EDIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the edit button." COM_COSTBENEFITPROJECTION_COMPANY_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Company to customise the alias." COM_COSTBENEFITPROJECTION_COMPANY_SCALING_FACTORS="Scaling Factors" -COM_COSTBENEFITPROJECTION_COMPANY_SERVICE_PROVIDER="Service Provider" COM_COSTBENEFITPROJECTION_COMPANY_SERVICE_PROVIDER_LABEL="Service Provider" -COM_COSTBENEFITPROJECTION_COMPANY_SICK_LEAVE_FEMALES="Sick Leave Females" COM_COSTBENEFITPROJECTION_COMPANY_SICK_LEAVE_FEMALES_DESCRIPTION="The total number of sick leave days for females per/year." COM_COSTBENEFITPROJECTION_COMPANY_SICK_LEAVE_FEMALES_HINT="per/year" COM_COSTBENEFITPROJECTION_COMPANY_SICK_LEAVE_FEMALES_LABEL="Total Number Sick Leave Days Females" COM_COSTBENEFITPROJECTION_COMPANY_SICK_LEAVE_FEMALES_MESSAGE="Error! Please add total number of sick leave days for females here." -COM_COSTBENEFITPROJECTION_COMPANY_SICK_LEAVE_MALES="Sick Leave Males" COM_COSTBENEFITPROJECTION_COMPANY_SICK_LEAVE_MALES_DESCRIPTION="The total number of sick leave days for males per/year." COM_COSTBENEFITPROJECTION_COMPANY_SICK_LEAVE_MALES_HINT="per/year" COM_COSTBENEFITPROJECTION_COMPANY_SICK_LEAVE_MALES_LABEL="Total Number Sick Leave Days Males" @@ -324,28 +301,23 @@ COM_COSTBENEFITPROJECTION_COMPANY_SIXTYSIXTY_FOUR="60-64" COM_COSTBENEFITPROJECTION_COMPANY_STATUS="Status" COM_COSTBENEFITPROJECTION_COMPANY_THIRTYTHIRTY_FOUR="30-34" COM_COSTBENEFITPROJECTION_COMPANY_THIRTY_FIVETHIRTY_NINE="35-39" -COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_HEALTHCARE="Total Healthcare" COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_HEALTHCARE_DESCRIPTION="The total healthcare payed per/year" COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_HEALTHCARE_HINT="per/year" COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_HEALTHCARE_LABEL="Total Healthcare Costs" COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_HEALTHCARE_MESSAGE="Error! Please add total healthcare costs here." -COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_SALARY="Total Salary" COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_SALARY_DESCRIPTION="The total salary payed per/year" COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_SALARY_HINT="per/year" COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_SALARY_LABEL="Total Salary" COM_COSTBENEFITPROJECTION_COMPANY_TOTAL_SALARY_MESSAGE="Error! Please add total salary here." -COM_COSTBENEFITPROJECTION_COMPANY_TURNOVER_COMMENT="Turnover Comment" COM_COSTBENEFITPROJECTION_COMPANY_TURNOVER_COMMENT_DESCRIPTION="Here you can explain how many deaths your company has had over any given period. This will help us understand how you came to the numbers used above in the male and female medical turnovers." COM_COSTBENEFITPROJECTION_COMPANY_TURNOVER_COMMENT_HINT="You can make a comment here to indicate how you arrived at the given numbers above for male and female medical turnovers." COM_COSTBENEFITPROJECTION_COMPANY_TURNOVER_COMMENT_LABEL="Turnover Comment" COM_COSTBENEFITPROJECTION_COMPANY_TWENTYTWENTY_FOUR="20-24" COM_COSTBENEFITPROJECTION_COMPANY_TWENTY_FIVETWENTY_NINE="25-29" -COM_COSTBENEFITPROJECTION_COMPANY_USER="User" COM_COSTBENEFITPROJECTION_COMPANY_USER_HINT="select a member" COM_COSTBENEFITPROJECTION_COMPANY_USER_LABEL="User (Member)" COM_COSTBENEFITPROJECTION_COMPANY_VERSION_DESC="A count of the number of times this Company has been revised." COM_COSTBENEFITPROJECTION_COMPANY_VERSION_LABEL="Version" -COM_COSTBENEFITPROJECTION_COMPANY_WORKING_DAYS="Working Days" COM_COSTBENEFITPROJECTION_COMPANY_WORKING_DAYS_DESCRIPTION="Number of working days per/year" COM_COSTBENEFITPROJECTION_COMPANY_WORKING_DAYS_LABEL="Work Days" COM_COSTBENEFITPROJECTION_CONFIG_ADMIN_CHART_NOTE_DESC="The following settings are used on the back-end of the site called (admin)." @@ -452,7 +424,7 @@ COM_COSTBENEFITPROJECTION_CONFIG_VAXISTEXTSTYLEFONTCOLOR_DESC="Select the vertic COM_COSTBENEFITPROJECTION_CONFIG_VAXISTEXTSTYLEFONTCOLOR_LABEL="vAxis Font Color" COM_COSTBENEFITPROJECTION_CONFIG_WHMCS_KEY_DESC="Add the key you recieved from Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb here." COM_COSTBENEFITPROJECTION_CONFIG_WHMCS_KEY_LABEL="Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb Key" -COM_COSTBENEFITPROJECTION_CONFIG_WHMCS_KEY_NOTE_DESC="You need to get this key from Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb.
When using the Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb field encryption you can never change this key once it is set! DATA WILL GET CORRUPTED IF YOU DO!" +COM_COSTBENEFITPROJECTION_CONFIG_WHMCS_KEY_NOTE_DESC="You need to get this key from Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb.
When using the Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb field encryption you can never change this key once it is set! DATA WILL GET CORRUPTED IF YOU DO!" COM_COSTBENEFITPROJECTION_CONFIG_WHMCS_KEY_NOTE_LABEL="Your Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb Field Encryption Key" COM_COSTBENEFITPROJECTION_CONFIG_YES="Yes" COM_COSTBENEFITPROJECTION_CONTRIBUTION_TO_COSTS="Contribution to Costs" @@ -521,18 +493,14 @@ COM_COSTBENEFITPROJECTION_COUNTRIES_SUBMENU_DESC="Allows the users in this group COM_COSTBENEFITPROJECTION_COUNTRY="Country" COM_COSTBENEFITPROJECTION_COUNTRY_AGE_GROUPS_PERCENTAGES="Age Groups Percentages" COM_COSTBENEFITPROJECTION_COUNTRY_AGE_LABEL="Age Group" -COM_COSTBENEFITPROJECTION_COUNTRY_ALIAS="Alias" COM_COSTBENEFITPROJECTION_COUNTRY_ALIAS_HINT="Auto-generated from name" COM_COSTBENEFITPROJECTION_COUNTRY_ALIAS_LABEL="Alias" COM_COSTBENEFITPROJECTION_COUNTRY_CAUSERISK_SELECTION="Cause/Risk Selection" -COM_COSTBENEFITPROJECTION_COUNTRY_CAUSESRISKS="Causesrisks" COM_COSTBENEFITPROJECTION_COUNTRY_CAUSESRISKS_LABEL="Causes/Risks" -COM_COSTBENEFITPROJECTION_COUNTRY_CODETHREE="Codethree" COM_COSTBENEFITPROJECTION_COUNTRY_CODETHREE_DESCRIPTION="ISO 3166-1 alpha-3 codes are three-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special areas of geographical interest." COM_COSTBENEFITPROJECTION_COUNTRY_CODETHREE_HINT="NAM" COM_COSTBENEFITPROJECTION_COUNTRY_CODETHREE_LABEL="Code Three" COM_COSTBENEFITPROJECTION_COUNTRY_CODETHREE_MESSAGE="Error! Please add three-letter country code here." -COM_COSTBENEFITPROJECTION_COUNTRY_CODETWO="Codetwo" COM_COSTBENEFITPROJECTION_COUNTRY_CODETWO_DESCRIPTION="ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special areas of geographical interest." COM_COSTBENEFITPROJECTION_COUNTRY_CODETWO_HINT="NA" COM_COSTBENEFITPROJECTION_COUNTRY_CODETWO_LABEL="Code Two" @@ -542,20 +510,16 @@ COM_COSTBENEFITPROJECTION_COUNTRY_CREATED_BY_DESC="The user that created this Co COM_COSTBENEFITPROJECTION_COUNTRY_CREATED_BY_LABEL="Created By" COM_COSTBENEFITPROJECTION_COUNTRY_CREATED_DATE_DESC="The date this Country was created." COM_COSTBENEFITPROJECTION_COUNTRY_CREATED_DATE_LABEL="Created Date" -COM_COSTBENEFITPROJECTION_COUNTRY_CURRENCY="Currency" COM_COSTBENEFITPROJECTION_COUNTRY_CURRENCY_DESCRIPTION="List of available currencies" COM_COSTBENEFITPROJECTION_COUNTRY_CURRENCY_LABEL="Currency" -COM_COSTBENEFITPROJECTION_COUNTRY_DATAYEAR="Datayear" COM_COSTBENEFITPROJECTION_COUNTRY_DATAYEAR_DESCRIPTION="Select which year's data should be used in calculations." COM_COSTBENEFITPROJECTION_COUNTRY_DATAYEAR_LABEL="Data Year" COM_COSTBENEFITPROJECTION_COUNTRY_DETAILS="Details" COM_COSTBENEFITPROJECTION_COUNTRY_EDIT="Editing the Country" COM_COSTBENEFITPROJECTION_COUNTRY_ERROR_UNIQUE_ALIAS="Another Country has the same alias." -COM_COSTBENEFITPROJECTION_COUNTRY_FEMALEDEATH="Femaledeath" COM_COSTBENEFITPROJECTION_COUNTRY_FEMALEDEATH_DESCRIPTION="Here you can add total females death data." COM_COSTBENEFITPROJECTION_COUNTRY_FEMALEDEATH_LABEL="Set Females Total Deaths" COM_COSTBENEFITPROJECTION_COUNTRY_FEMALEDEATH_SELECT="Edit/Add" -COM_COSTBENEFITPROJECTION_COUNTRY_FEMALEYLD="Femaleyld" COM_COSTBENEFITPROJECTION_COUNTRY_FEMALEYLD_DESCRIPTION="Here you can add females total YLD data." COM_COSTBENEFITPROJECTION_COUNTRY_FEMALEYLD_LABEL="Set Females Total YLDs" COM_COSTBENEFITPROJECTION_COUNTRY_FEMALEYLD_SELECT="Edit/Add" @@ -564,7 +528,6 @@ COM_COSTBENEFITPROJECTION_COUNTRY_FIFTYFIFTY_FOUR="50-54" COM_COSTBENEFITPROJECTION_COUNTRY_FIFTY_FIVEFIFTY_NINE="55-59" COM_COSTBENEFITPROJECTION_COUNTRY_FORTYFORTY_FOUR="40-44" COM_COSTBENEFITPROJECTION_COUNTRY_FORTY_FIVEFORTY_NINE="45-49" -COM_COSTBENEFITPROJECTION_COUNTRY_HEALTHCARE="Healthcare" COM_COSTBENEFITPROJECTION_COUNTRY_HEALTHCARE_DESCRIPTION="The healthcare costs as a % of total salary costs. This figure is used for the calculations as default." COM_COSTBENEFITPROJECTION_COUNTRY_HEALTHCARE_HINT="10" COM_COSTBENEFITPROJECTION_COUNTRY_HEALTHCARE_LABEL="Default Healthcare Costs" @@ -572,15 +535,12 @@ COM_COSTBENEFITPROJECTION_COUNTRY_HEALTHCARE_MESSAGE="Error! Please add healthca COM_COSTBENEFITPROJECTION_COUNTRY_HEALTH_DATA_TOTALS="Health Data Totals" COM_COSTBENEFITPROJECTION_COUNTRY_ID="Id" COM_COSTBENEFITPROJECTION_COUNTRY_INTERVENTIONS="Interventions" -COM_COSTBENEFITPROJECTION_COUNTRY_MALEDEATH="Maledeath" COM_COSTBENEFITPROJECTION_COUNTRY_MALEDEATH_DESCRIPTION="Here you can add males total death data." COM_COSTBENEFITPROJECTION_COUNTRY_MALEDEATH_LABEL="Set Males Total Deaths" COM_COSTBENEFITPROJECTION_COUNTRY_MALEDEATH_SELECT="Edit/Add" -COM_COSTBENEFITPROJECTION_COUNTRY_MALEYLD="Maleyld" COM_COSTBENEFITPROJECTION_COUNTRY_MALEYLD_DESCRIPTION="Here you can add males total YLD data." COM_COSTBENEFITPROJECTION_COUNTRY_MALEYLD_LABEL="Set Males Total YLDs" COM_COSTBENEFITPROJECTION_COUNTRY_MALEYLD_SELECT="Edit/Add" -COM_COSTBENEFITPROJECTION_COUNTRY_MEDICAL_TURNOVERS="Medical Turnovers" COM_COSTBENEFITPROJECTION_COUNTRY_MEDICAL_TURNOVERS_DESCRIPTION="The average medical turnover per/100,000." COM_COSTBENEFITPROJECTION_COUNTRY_MEDICAL_TURNOVERS_HINT="12" COM_COSTBENEFITPROJECTION_COUNTRY_MEDICAL_TURNOVERS_LABEL="Default Ave. Medical Turnover" @@ -599,11 +559,9 @@ COM_COSTBENEFITPROJECTION_COUNTRY_NUMBER_HINT="Number Here" COM_COSTBENEFITPROJECTION_COUNTRY_NUMBER_LABEL="Number" COM_COSTBENEFITPROJECTION_COUNTRY_NUMBER_MESSAGE="Error! Please add number here." COM_COSTBENEFITPROJECTION_COUNTRY_ORDERING_LABEL="Ordering" -COM_COSTBENEFITPROJECTION_COUNTRY_PERCENTFEMALE="Percentfemale" COM_COSTBENEFITPROJECTION_COUNTRY_PERCENTFEMALE_DESCRIPTION="Here you can add females age groups percent." COM_COSTBENEFITPROJECTION_COUNTRY_PERCENTFEMALE_LABEL="Set Females Age Groups Percent" COM_COSTBENEFITPROJECTION_COUNTRY_PERCENTFEMALE_SELECT="Edit/Add" -COM_COSTBENEFITPROJECTION_COUNTRY_PERCENTMALE="Percentmale" COM_COSTBENEFITPROJECTION_COUNTRY_PERCENTMALE_DESCRIPTION="Here you can add males age groups percent." COM_COSTBENEFITPROJECTION_COUNTRY_PERCENTMALE_LABEL="Set Males Age Groups Percent" COM_COSTBENEFITPROJECTION_COUNTRY_PERCENTMALE_SELECT="Edit/Add" @@ -611,29 +569,23 @@ COM_COSTBENEFITPROJECTION_COUNTRY_PERCENT_HINT="Percent Here" COM_COSTBENEFITPROJECTION_COUNTRY_PERCENT_LABEL="Percent" COM_COSTBENEFITPROJECTION_COUNTRY_PERCENT_MESSAGE="Error! Please add percent here." COM_COSTBENEFITPROJECTION_COUNTRY_PERMISSION="Permissions" -COM_COSTBENEFITPROJECTION_COUNTRY_PRESENTEEISM="Presenteeism" COM_COSTBENEFITPROJECTION_COUNTRY_PRESENTEEISM_DESCRIPTION="The presenteeism constant." COM_COSTBENEFITPROJECTION_COUNTRY_PRESENTEEISM_HINT="0.25" COM_COSTBENEFITPROJECTION_COUNTRY_PRESENTEEISM_LABEL="Presenteeism Constant" COM_COSTBENEFITPROJECTION_COUNTRY_PRESENTEEISM_MESSAGE="Error! Please add presenteeism constant here." -COM_COSTBENEFITPROJECTION_COUNTRY_PRODUCTIVITY_LOSSES="Productivity Losses" COM_COSTBENEFITPROJECTION_COUNTRY_PRODUCTIVITY_LOSSES_DESCRIPTION="The interim number between 0 and 1 reflecting the amount of a year in lost productivity due to medical retirement/death of an employee. This figure is used for the default." COM_COSTBENEFITPROJECTION_COUNTRY_PRODUCTIVITY_LOSSES_HINT="0.5" COM_COSTBENEFITPROJECTION_COUNTRY_PRODUCTIVITY_LOSSES_LABEL="Default Productivity Losses" COM_COSTBENEFITPROJECTION_COUNTRY_PRODUCTIVITY_LOSSES_MESSAGE="Error! Please add productivity losses here." -COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICADDRESS="Publicaddress" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICADDRESS_LABEL="Public Address" -COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICEMAIL="Publicemail" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICEMAIL_DESCRIPTION="The email we may use publicly" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICEMAIL_HINT="Public Email Here" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICEMAIL_LABEL="Public Email" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICEMAIL_MESSAGE="Error! Please public email address here." -COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICNAME="Publicname" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICNAME_DESCRIPTION="The name we may use publicly" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICNAME_HINT="Public Name Here" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICNAME_LABEL="Public Name" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICNAME_MESSAGE="Error! Please add public name here." -COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICNUMBER="Publicnumber" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICNUMBER_DESCRIPTION="The phone number we may use publicly" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICNUMBER_HINT="Public Phone Here" COM_COSTBENEFITPROJECTION_COUNTRY_PUBLICNUMBER_LABEL="Public Phone" @@ -643,7 +595,6 @@ COM_COSTBENEFITPROJECTION_COUNTRY_PUBLISHING="Publishing" COM_COSTBENEFITPROJECTION_COUNTRY_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Country to customise the alias." COM_COSTBENEFITPROJECTION_COUNTRY_SELECT_A_YEAR="Select a year" COM_COSTBENEFITPROJECTION_COUNTRY_SERVICE_PROVIDERS="Service Providers" -COM_COSTBENEFITPROJECTION_COUNTRY_SICK_LEAVE="Sick Leave" COM_COSTBENEFITPROJECTION_COUNTRY_SICK_LEAVE_DESCRIPTION="The average sick leave days per/person." COM_COSTBENEFITPROJECTION_COUNTRY_SICK_LEAVE_HINT="12" COM_COSTBENEFITPROJECTION_COUNTRY_SICK_LEAVE_LABEL="Default Ave. Sick Leave" @@ -669,15 +620,12 @@ COM_COSTBENEFITPROJECTION_COUNTRY_TWO_THOUSAND_AND_TWENTY_FOUR="2024" COM_COSTBENEFITPROJECTION_COUNTRY_TWO_THOUSAND_AND_TWENTY_ONE="2021" COM_COSTBENEFITPROJECTION_COUNTRY_TWO_THOUSAND_AND_TWENTY_THREE="2023" COM_COSTBENEFITPROJECTION_COUNTRY_TWO_THOUSAND_AND_TWENTY_TWO="2022" -COM_COSTBENEFITPROJECTION_COUNTRY_USER="User" COM_COSTBENEFITPROJECTION_COUNTRY_USER_HINT="select a country user" COM_COSTBENEFITPROJECTION_COUNTRY_USER_LABEL="User (Country)" COM_COSTBENEFITPROJECTION_COUNTRY_VERSION_DESC="A count of the number of times this Country has been revised." COM_COSTBENEFITPROJECTION_COUNTRY_VERSION_LABEL="Version" -COM_COSTBENEFITPROJECTION_COUNTRY_WORKING_DAYS="Working Days" COM_COSTBENEFITPROJECTION_COUNTRY_WORKING_DAYS_DESCRIPTION="Number of working days per/year" COM_COSTBENEFITPROJECTION_COUNTRY_WORKING_DAYS_LABEL="Work Days" -COM_COSTBENEFITPROJECTION_COUNTRY_WORLDZONE="Worldzone" COM_COSTBENEFITPROJECTION_COUNTRY_WORLDZONE_DESCRIPTION="The zone this country belongs to" COM_COSTBENEFITPROJECTION_COUNTRY_WORLDZONE_HINT="only number" COM_COSTBENEFITPROJECTION_COUNTRY_WORLDZONE_LABEL="Worldzone" @@ -736,10 +684,8 @@ COM_COSTBENEFITPROJECTION_CURRENCIES_N_ITEMS_UNPUBLISHED_1="%s Currency unpublis COM_COSTBENEFITPROJECTION_CURRENCIES_SUBMENU="Currencies Submenu" COM_COSTBENEFITPROJECTION_CURRENCIES_SUBMENU_DESC="Allows the users in this group to submenu of currency" COM_COSTBENEFITPROJECTION_CURRENCY="Currency" -COM_COSTBENEFITPROJECTION_CURRENCY_ALIAS="Alias" COM_COSTBENEFITPROJECTION_CURRENCY_ALIAS_HINT="Auto-generated from name" COM_COSTBENEFITPROJECTION_CURRENCY_ALIAS_LABEL="Alias" -COM_COSTBENEFITPROJECTION_CURRENCY_CODETHREE="Codethree" COM_COSTBENEFITPROJECTION_CURRENCY_CODETHREE_DESCRIPTION="The following is a list of active codes of official ISO 4217 currency names." COM_COSTBENEFITPROJECTION_CURRENCY_CODETHREE_HINT="NAD" COM_COSTBENEFITPROJECTION_CURRENCY_CODETHREE_LABEL="Code Three" @@ -748,12 +694,10 @@ COM_COSTBENEFITPROJECTION_CURRENCY_CREATED_BY_DESC="The user that created this C COM_COSTBENEFITPROJECTION_CURRENCY_CREATED_BY_LABEL="Created By" COM_COSTBENEFITPROJECTION_CURRENCY_CREATED_DATE_DESC="The date this Currency was created." COM_COSTBENEFITPROJECTION_CURRENCY_CREATED_DATE_LABEL="Created Date" -COM_COSTBENEFITPROJECTION_CURRENCY_DECIMALPLACE="Decimalplace" COM_COSTBENEFITPROJECTION_CURRENCY_DECIMALPLACE_DESCRIPTION="The position of a digit to the right of a decimal point, usually identified by successive ascending ordinal numbers with the digit immediately to the right of the decimal point being first: a figure accurate to the third decimal place." COM_COSTBENEFITPROJECTION_CURRENCY_DECIMALPLACE_HINT="2" COM_COSTBENEFITPROJECTION_CURRENCY_DECIMALPLACE_LABEL="Decimal place" COM_COSTBENEFITPROJECTION_CURRENCY_DECIMALPLACE_MESSAGE="Error! Please add currency decimal place here." -COM_COSTBENEFITPROJECTION_CURRENCY_DECIMALSYMBOL="Decimalsymbol" COM_COSTBENEFITPROJECTION_CURRENCY_DECIMALSYMBOL_DESCRIPTION="The symbol used to separate the integer part of a decimal number from its fractional part is called the decimal point." COM_COSTBENEFITPROJECTION_CURRENCY_DECIMALSYMBOL_HINT="." COM_COSTBENEFITPROJECTION_CURRENCY_DECIMALSYMBOL_LABEL="Decimal symbol" @@ -767,25 +711,21 @@ COM_COSTBENEFITPROJECTION_CURRENCY_MODIFIED_BY_DESC="The last user that modified COM_COSTBENEFITPROJECTION_CURRENCY_MODIFIED_BY_LABEL="Modified By" COM_COSTBENEFITPROJECTION_CURRENCY_MODIFIED_DATE_DESC="The date this Currency was modified." COM_COSTBENEFITPROJECTION_CURRENCY_MODIFIED_DATE_LABEL="Modified Date" -COM_COSTBENEFITPROJECTION_CURRENCY_NAME="Name" COM_COSTBENEFITPROJECTION_CURRENCY_NAME_DESCRIPTION="Enter Name Here" COM_COSTBENEFITPROJECTION_CURRENCY_NAME_HINT="Name Here" COM_COSTBENEFITPROJECTION_CURRENCY_NAME_LABEL="Name" COM_COSTBENEFITPROJECTION_CURRENCY_NAME_MESSAGE="Error! Please add name here." -COM_COSTBENEFITPROJECTION_CURRENCY_NEGATIVESTYLE="Negativestyle" COM_COSTBENEFITPROJECTION_CURRENCY_NEGATIVESTYLE_DESCRIPTION="Please use the following placeholders {sign}{number} {symbol} to build the currency negative style." COM_COSTBENEFITPROJECTION_CURRENCY_NEGATIVESTYLE_HINT="{sign}{number} {symbol}" COM_COSTBENEFITPROJECTION_CURRENCY_NEGATIVESTYLE_LABEL="Negative style" COM_COSTBENEFITPROJECTION_CURRENCY_NEGATIVESTYLE_MESSAGE="Error! Please add currency negative style here." COM_COSTBENEFITPROJECTION_CURRENCY_NEW="A New Currency" -COM_COSTBENEFITPROJECTION_CURRENCY_NUMERICCODE="Numericcode" COM_COSTBENEFITPROJECTION_CURRENCY_NUMERICCODE_DESCRIPTION="There is also a three-digit code number assigned to each currency, in the same manner as there is also a three-digit code number assigned to each country as part of ISO 3166. This numeric code is usually the same as the ISO 3166-1 numeric code. For example, USD (United States dollar) has code 840 which is also the numeric code for the US (United States)." COM_COSTBENEFITPROJECTION_CURRENCY_NUMERICCODE_HINT="516" COM_COSTBENEFITPROJECTION_CURRENCY_NUMERICCODE_LABEL="Numeric Code" COM_COSTBENEFITPROJECTION_CURRENCY_NUMERICCODE_MESSAGE="Error! Please add numeric code here." COM_COSTBENEFITPROJECTION_CURRENCY_ORDERING_LABEL="Ordering" COM_COSTBENEFITPROJECTION_CURRENCY_PERMISSION="Permissions" -COM_COSTBENEFITPROJECTION_CURRENCY_POSITIVESTYLE="Positivestyle" COM_COSTBENEFITPROJECTION_CURRENCY_POSITIVESTYLE_DESCRIPTION="Please use the following placeholders {number} {symbol} to build the currency positive style." COM_COSTBENEFITPROJECTION_CURRENCY_POSITIVESTYLE_HINT="{number} {symbol}" COM_COSTBENEFITPROJECTION_CURRENCY_POSITIVESTYLE_LABEL="Positive style" @@ -793,12 +733,10 @@ COM_COSTBENEFITPROJECTION_CURRENCY_POSITIVESTYLE_MESSAGE="Error! Please add curr COM_COSTBENEFITPROJECTION_CURRENCY_PUBLISHING="Publishing" COM_COSTBENEFITPROJECTION_CURRENCY_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Currency to customise the alias." COM_COSTBENEFITPROJECTION_CURRENCY_STATUS="Status" -COM_COSTBENEFITPROJECTION_CURRENCY_SYMBOL="Symbol" COM_COSTBENEFITPROJECTION_CURRENCY_SYMBOL_DESCRIPTION="A currency symbol is a graphic symbol used as a shorthand for a currency's name, especially in reference to amounts of money." COM_COSTBENEFITPROJECTION_CURRENCY_SYMBOL_HINT="N$" COM_COSTBENEFITPROJECTION_CURRENCY_SYMBOL_LABEL="Symbol" COM_COSTBENEFITPROJECTION_CURRENCY_SYMBOL_MESSAGE="Error! Please add currency symbol here." -COM_COSTBENEFITPROJECTION_CURRENCY_THOUSANDS="Thousands" COM_COSTBENEFITPROJECTION_CURRENCY_THOUSANDS_HINT="" COM_COSTBENEFITPROJECTION_CURRENCY_THOUSANDS_LABEL="Thousands separator" COM_COSTBENEFITPROJECTION_CURRENCY_THOUSANDS_MESSAGE="Error! Please add currency thousands separator here." @@ -851,9 +789,7 @@ COM_COSTBENEFITPROJECTION_HEALTH_DATA="Health Data" COM_COSTBENEFITPROJECTION_HEALTH_DATA_AGE_LABEL="Age Group" COM_COSTBENEFITPROJECTION_HEALTH_DATA_BULK_EXPORT_BUTTON_ACCESS="Health Data Bulk Export Button Access" COM_COSTBENEFITPROJECTION_HEALTH_DATA_BULK_EXPORT_BUTTON_ACCESS_DESC="Allows the users in this group to access the bulk export button." -COM_COSTBENEFITPROJECTION_HEALTH_DATA_CAUSERISK="Causerisk" COM_COSTBENEFITPROJECTION_HEALTH_DATA_CAUSERISK_LABEL="Cause/Risk" -COM_COSTBENEFITPROJECTION_HEALTH_DATA_COUNTRY="Country" COM_COSTBENEFITPROJECTION_HEALTH_DATA_COUNTRY_DESCRIPTION="List of available countries" COM_COSTBENEFITPROJECTION_HEALTH_DATA_COUNTRY_LABEL="Country" COM_COSTBENEFITPROJECTION_HEALTH_DATA_CREATED_BY_DESC="The user that created this Health Data." @@ -863,11 +799,9 @@ COM_COSTBENEFITPROJECTION_HEALTH_DATA_CREATED_DATE_LABEL="Created Date" COM_COSTBENEFITPROJECTION_HEALTH_DATA_DETAILS="Details" COM_COSTBENEFITPROJECTION_HEALTH_DATA_EDIT="Editing the Health Data" COM_COSTBENEFITPROJECTION_HEALTH_DATA_ERROR_UNIQUE_ALIAS="Another Health Data has the same alias." -COM_COSTBENEFITPROJECTION_HEALTH_DATA_FEMALEDEATH="Femaledeath" COM_COSTBENEFITPROJECTION_HEALTH_DATA_FEMALEDEATH_DESCRIPTION="Here you can add females death data." COM_COSTBENEFITPROJECTION_HEALTH_DATA_FEMALEDEATH_LABEL="Set Females Death" COM_COSTBENEFITPROJECTION_HEALTH_DATA_FEMALEDEATH_SELECT="Edit/Add" -COM_COSTBENEFITPROJECTION_HEALTH_DATA_FEMALEYLD="Femaleyld" COM_COSTBENEFITPROJECTION_HEALTH_DATA_FEMALEYLD_DESCRIPTION="Here you can add females YLD data." COM_COSTBENEFITPROJECTION_HEALTH_DATA_FEMALEYLD_LABEL="Set Females YLD" COM_COSTBENEFITPROJECTION_HEALTH_DATA_FEMALEYLD_SELECT="Edit/Add" @@ -877,11 +811,9 @@ COM_COSTBENEFITPROJECTION_HEALTH_DATA_FIFTY_FIVEFIFTY_NINE="55-59" COM_COSTBENEFITPROJECTION_HEALTH_DATA_FORTYFORTY_FOUR="40-44" COM_COSTBENEFITPROJECTION_HEALTH_DATA_FORTY_FIVEFORTY_NINE="45-49" COM_COSTBENEFITPROJECTION_HEALTH_DATA_ID="Id" -COM_COSTBENEFITPROJECTION_HEALTH_DATA_MALEDEATH="Maledeath" COM_COSTBENEFITPROJECTION_HEALTH_DATA_MALEDEATH_DESCRIPTION="Here you can add males death data." COM_COSTBENEFITPROJECTION_HEALTH_DATA_MALEDEATH_LABEL="Set Males Death" COM_COSTBENEFITPROJECTION_HEALTH_DATA_MALEDEATH_SELECT="Edit/Add" -COM_COSTBENEFITPROJECTION_HEALTH_DATA_MALEYLD="Maleyld" COM_COSTBENEFITPROJECTION_HEALTH_DATA_MALEYLD_DESCRIPTION="Here you can add males YLD data." COM_COSTBENEFITPROJECTION_HEALTH_DATA_MALEYLD_LABEL="Set Males YLD" COM_COSTBENEFITPROJECTION_HEALTH_DATA_MALEYLD_SELECT="Edit/Add" @@ -981,7 +913,6 @@ COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_TWENTY_THREE="2023" COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_TWENTY_TWO="2022" COM_COSTBENEFITPROJECTION_HEALTH_DATA_VERSION_DESC="A count of the number of times this Health Data has been revised." COM_COSTBENEFITPROJECTION_HEALTH_DATA_VERSION_LABEL="Version" -COM_COSTBENEFITPROJECTION_HEALTH_DATA_YEAR="Year" COM_COSTBENEFITPROJECTION_HEALTH_DATA_YEAR_LABEL="Data Year" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT="Help Document" COM_COSTBENEFITPROJECTION_HELP_DOCUMENTS="Help Documents" @@ -1031,16 +962,12 @@ COM_COSTBENEFITPROJECTION_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED_1="%s Help Document COM_COSTBENEFITPROJECTION_HELP_DOCUMENTS_SUBMENU="Help Documents Submenu" COM_COSTBENEFITPROJECTION_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to submenu of help document" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ADMIN="Admin" -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ADMIN_VIEW="Admin View" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION="Select the view being target." COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ADMIN_VIEW_LABEL="Admin Views" -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ALIAS="Alias" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ALIAS_HINT="Auto-generated from name" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ALIAS_LABEL="Alias" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ALL="All" -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ARTICLE="Article" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ARTICLE_LABEL="Article" -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_CONTENT="Content" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_CONTENT_LABEL="Content" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_CREATED_BY_DESC="The user that created this Help Document." COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_CREATED_BY_LABEL="Created By" @@ -1049,12 +976,10 @@ COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_CREATED_DATE_LABEL="Created Date" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_DETAILS="Details" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_EDIT="Editing the Help Document" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS="Another Help Document has the same alias." -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_GROUPS="Groups" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_GROUPS_DESCRIPTION="Select a group/s" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_GROUPS_LABEL="Group/s" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ID="Id" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_JOOMLA_ARTICLE="Joomla Article" -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_LOCATION="Location" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_LOCATION_DESCRIPTION="Select the help target location." COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_LOCATION_LABEL="Location" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_MODIFIED_BY_DESC="The last user that modified this Help Document." @@ -1068,21 +993,17 @@ COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_PUBLISHING="Publishing" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Help Document to customise the alias." COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_SELECT_AN_OPTION="Select an option" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_SITE="Site" -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_SITE_VIEW="Site View" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_SITE_VIEW_DESCRIPTION="Select the view being target." COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_SITE_VIEW_LABEL="Site Views" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_SOME="Some" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_STATUS="Status" -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TARGET="Target" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TARGET_DESCRIPTION="Select the target option in relation to groups." COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TARGET_LABEL="Target Groups" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TEXT="Text" -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TITLE="Title" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TITLE_DESCRIPTION="Enter Title Here" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TITLE_HINT="Title Here" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TITLE_LABEL="Title" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TITLE_MESSAGE="Error! Please add title here." -COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TYPE="Type" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TYPE_DESCRIPTION="Select the help type." COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TYPE_LABEL="Type" COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_URL="URL" @@ -1193,13 +1114,10 @@ COM_COSTBENEFITPROJECTION_INTERVENTION_ALL_SERVICE_PROVIDERS_AND_ADMIN="All Serv COM_COSTBENEFITPROJECTION_INTERVENTION_CAUSERISK="Causerisk" COM_COSTBENEFITPROJECTION_INTERVENTION_CAUSERISK_LABEL="Cause/Risk" COM_COSTBENEFITPROJECTION_INTERVENTION_CLUSTER="Cluster" -COM_COSTBENEFITPROJECTION_INTERVENTION_COMPANY="Company" COM_COSTBENEFITPROJECTION_INTERVENTION_COMPANY_LABEL="Company" COM_COSTBENEFITPROJECTION_INTERVENTION_COST_BENEFIT="Intervention Cost Benefit" -COM_COSTBENEFITPROJECTION_INTERVENTION_COUNTRY="Country" COM_COSTBENEFITPROJECTION_INTERVENTION_COUNTRY_DESCRIPTION="List of available countries" COM_COSTBENEFITPROJECTION_INTERVENTION_COUNTRY_LABEL="Country" -COM_COSTBENEFITPROJECTION_INTERVENTION_COVERAGE="Coverage" COM_COSTBENEFITPROJECTION_INTERVENTION_COVERAGE_DESCRIPTION="Proportion of employees covered" COM_COSTBENEFITPROJECTION_INTERVENTION_COVERAGE_LABEL="Coverage" COM_COSTBENEFITPROJECTION_INTERVENTION_CPE_DESCRIPTION="Estimate cost per employee" @@ -1208,19 +1126,15 @@ COM_COSTBENEFITPROJECTION_INTERVENTION_CREATED_BY_DESC="The user that created th COM_COSTBENEFITPROJECTION_INTERVENTION_CREATED_BY_LABEL="Created By" COM_COSTBENEFITPROJECTION_INTERVENTION_CREATED_DATE_DESC="The date this Intervention was created." COM_COSTBENEFITPROJECTION_INTERVENTION_CREATED_DATE_LABEL="Created Date" -COM_COSTBENEFITPROJECTION_INTERVENTION_DESCRIPTION="Description" COM_COSTBENEFITPROJECTION_INTERVENTION_DESCRIPTION_DESCRIPTION="Add Description Here" COM_COSTBENEFITPROJECTION_INTERVENTION_DESCRIPTION_HINT="Add Description Here" COM_COSTBENEFITPROJECTION_INTERVENTION_DESCRIPTION_LABEL="Description" COM_COSTBENEFITPROJECTION_INTERVENTION_DETAILS="Details" -COM_COSTBENEFITPROJECTION_INTERVENTION_DURATION="Duration" COM_COSTBENEFITPROJECTION_INTERVENTION_DURATION_DESCRIPTION="Set in number of years" COM_COSTBENEFITPROJECTION_INTERVENTION_DURATION_LABEL="Duration (years)" COM_COSTBENEFITPROJECTION_INTERVENTION_EDIT="Editing the Intervention" COM_COSTBENEFITPROJECTION_INTERVENTION_ERROR_UNIQUE_ALIAS="Another Intervention has the same alias." COM_COSTBENEFITPROJECTION_INTERVENTION_ID="Id" -COM_COSTBENEFITPROJECTION_INTERVENTION_INTERVENTION="Intervention" -COM_COSTBENEFITPROJECTION_INTERVENTION_INTERVENTIONS="Interventions" COM_COSTBENEFITPROJECTION_INTERVENTION_INTERVENTIONS_LABEL="Interventions" COM_COSTBENEFITPROJECTION_INTERVENTION_INTERVENTION_DESCRIPTION="Here you can add & edit interventions." COM_COSTBENEFITPROJECTION_INTERVENTION_INTERVENTION_LABEL="Set Intervention" @@ -1233,7 +1147,6 @@ COM_COSTBENEFITPROJECTION_INTERVENTION_MODIFIED_DATE_DESC="The date this Interve COM_COSTBENEFITPROJECTION_INTERVENTION_MODIFIED_DATE_LABEL="Modified Date" COM_COSTBENEFITPROJECTION_INTERVENTION_MTR_DESCRIPTION="Percentage estimate" COM_COSTBENEFITPROJECTION_INTERVENTION_MTR_LABEL="Mortality Reduction" -COM_COSTBENEFITPROJECTION_INTERVENTION_NAME="Name" COM_COSTBENEFITPROJECTION_INTERVENTION_NAME_DESCRIPTION="Enter Intervention Name Here" COM_COSTBENEFITPROJECTION_INTERVENTION_NAME_HINT="Name Here" COM_COSTBENEFITPROJECTION_INTERVENTION_NAME_LABEL="Name" @@ -1246,18 +1159,15 @@ COM_COSTBENEFITPROJECTION_INTERVENTION_ONLY_MY_SERVICE_PROVIDER="Only My Service COM_COSTBENEFITPROJECTION_INTERVENTION_ORDERING_LABEL="Ordering" COM_COSTBENEFITPROJECTION_INTERVENTION_PERMISSION="Permissions" COM_COSTBENEFITPROJECTION_INTERVENTION_PUBLISHING="Publishing" -COM_COSTBENEFITPROJECTION_INTERVENTION_REFERENCE="Reference" COM_COSTBENEFITPROJECTION_INTERVENTION_REFERENCE_DESCRIPTION="Please give reference to the source of your data used in the intervention." COM_COSTBENEFITPROJECTION_INTERVENTION_REFERENCE_HINT="// Source of your data" COM_COSTBENEFITPROJECTION_INTERVENTION_REFERENCE_LABEL="Reference" COM_COSTBENEFITPROJECTION_INTERVENTION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Intervention to customise the alias." COM_COSTBENEFITPROJECTION_INTERVENTION_SETTINGS="Settings" -COM_COSTBENEFITPROJECTION_INTERVENTION_SHARE="Share" COM_COSTBENEFITPROJECTION_INTERVENTION_SHARE_DESCRIPTION="Select a sharing option" COM_COSTBENEFITPROJECTION_INTERVENTION_SHARE_LABEL="Sharing Options" COM_COSTBENEFITPROJECTION_INTERVENTION_SINGLE="Single" COM_COSTBENEFITPROJECTION_INTERVENTION_STATUS="Status" -COM_COSTBENEFITPROJECTION_INTERVENTION_TYPE="Type" COM_COSTBENEFITPROJECTION_INTERVENTION_TYPE_DESCRIPTION="Select the intervention type." COM_COSTBENEFITPROJECTION_INTERVENTION_TYPE_LABEL="Type" COM_COSTBENEFITPROJECTION_INTERVENTION_VERSION_DESC="A count of the number of times this Intervention has been revised." @@ -1365,11 +1275,8 @@ COM_COSTBENEFITPROJECTION_SCALING_FACTORS_N_ITEMS_UNPUBLISHED="%s Scaling Factor COM_COSTBENEFITPROJECTION_SCALING_FACTORS_N_ITEMS_UNPUBLISHED_1="%s Scaling Factor unpublished." COM_COSTBENEFITPROJECTION_SCALING_FACTORS_SUBMENU="Scaling Factors Submenu" COM_COSTBENEFITPROJECTION_SCALING_FACTORS_SUBMENU_DESC="Allows the users in this group to submenu of scaling factor" -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_CAUSERISK="Causerisk" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_CAUSERISK_LABEL="Cause/Risk" -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_COMPANY="Company" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_COMPANY_LABEL="Company" -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_COUNTRY="Country" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_COUNTRY_DESCRIPTION="List of available countries" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_COUNTRY_LABEL="Country" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_CREATED_BY_DESC="The user that created this Scaling Factor." @@ -1379,7 +1286,6 @@ COM_COSTBENEFITPROJECTION_SCALING_FACTOR_CREATED_DATE_LABEL="Created Date" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_DETAILS="Details" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_EDIT="Editing the Scaling Factor" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_ERROR_UNIQUE_ALIAS="Another Scaling Factor has the same alias." -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_HEALTH_SCALING_FACTOR="Health Scaling Factor" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_HEALTH_SCALING_FACTOR_DESCRIPTION="Health scaling factor" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_HEALTH_SCALING_FACTOR_HINT="Number Here" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_HEALTH_SCALING_FACTOR_LABEL="Health Scaling" @@ -1389,12 +1295,10 @@ COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MODIFIED_BY_DESC="The last user that mo COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MODIFIED_BY_LABEL="Modified By" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MODIFIED_DATE_DESC="The date this Scaling Factor was modified." COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MODIFIED_DATE_LABEL="Modified Date" -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_FEMALES="Mortality Scaling Factor Females" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_FEMALES_DESCRIPTION="Mortality scaling factor for females" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_FEMALES_HINT="Number Here" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_FEMALES_LABEL="Mortality Scaling Female" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_FEMALES_MESSAGE="Error! Please add scaling factor for females here." -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_MALES="Mortality Scaling Factor Males" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_MALES_DESCRIPTION="Mortality scaling factor for males" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_MALES_HINT="Number Here" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_MALES_LABEL="Mortality Scaling Male" @@ -1402,18 +1306,15 @@ COM_COSTBENEFITPROJECTION_SCALING_FACTOR_MORTALITY_SCALING_FACTOR_MALES_MESSAGE= COM_COSTBENEFITPROJECTION_SCALING_FACTOR_NEW="A New Scaling Factor" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_ORDERING_LABEL="Ordering" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PERMISSION="Permissions" -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_FEMALES="Presenteeism Scaling Factor Females" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_FEMALES_DESCRIPTION="Presenteeism scaling factor for females" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_FEMALES_HINT="Number Here" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_FEMALES_LABEL="Presenteeism Scaling Female" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_FEMALES_MESSAGE="Error! Please add scaling factor for females here." -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_MALES="Presenteeism Scaling Factor Males" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_MALES_DESCRIPTION="Presenteeism scaling factor for Males" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_MALES_HINT="Number Here" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_MALES_LABEL="Presenteeism Scaling Male" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PRESENTEEISM_SCALING_FACTOR_MALES_MESSAGE="Error! Please add scaling factor for males here." COM_COSTBENEFITPROJECTION_SCALING_FACTOR_PUBLISHING="Publishing" -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_REFERENCE="Reference" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_REFERENCE_DESCRIPTION="Please give reference to the source of your data used in the scaling factors." COM_COSTBENEFITPROJECTION_SCALING_FACTOR_REFERENCE_HINT="// Source of your data" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_REFERENCE_LABEL="Reference" @@ -1421,16 +1322,16 @@ COM_COSTBENEFITPROJECTION_SCALING_FACTOR_SAVE_WARNING="Alias already existed so COM_COSTBENEFITPROJECTION_SCALING_FACTOR_STATUS="Status" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_VERSION_DESC="A count of the number of times this Scaling Factor has been revised." COM_COSTBENEFITPROJECTION_SCALING_FACTOR_VERSION_LABEL="Version" -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_FEMALES="Yld Scaling Factor Females" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_FEMALES_DESCRIPTION="Absenteeism scaling factor for females" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_FEMALES_HINT="Number Here" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_FEMALES_LABEL="Absenteeism Scaling Female" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_FEMALES_MESSAGE="Error! Please add scaling factor for females here." -COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_MALES="Yld Scaling Factor Males" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_MALES_DESCRIPTION="Absenteeism scaling factor for males" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_MALES_HINT="Number Here" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_MALES_LABEL="Absenteeism Scaling Male" COM_COSTBENEFITPROJECTION_SCALING_FACTOR_YLD_SCALING_FACTOR_MALES_MESSAGE="Error! Please add scaling factor for males here." +COM_COSTBENEFITPROJECTION_SELECT_AN_ADMIN_VIEW="Select an admin view" +COM_COSTBENEFITPROJECTION_SELECT_A_SITE_VIEW="Select a site view" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER="Service Provider" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDERS="Service Providers" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDERS_ACCESS="Service Providers Access" @@ -1481,7 +1382,6 @@ COM_COSTBENEFITPROJECTION_SERVICE_PROVIDERS_N_ITEMS_UNPUBLISHED_1="%s Service Pr COM_COSTBENEFITPROJECTION_SERVICE_PROVIDERS_SUBMENU="Service Providers Submenu" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDERS_SUBMENU_DESC="Allows the users in this group to submenu of service provider" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_COMPANIES="Companies" -COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_COUNTRY="Country" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_COUNTRY_DESCRIPTION="List of available countries" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_COUNTRY_LABEL="Country" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_CREATED_BY_DESC="The user that created this Service Provider." @@ -1499,19 +1399,15 @@ COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_MODIFIED_DATE_LABEL="Modified Date" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_NEW="A New Service Provider" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_ORDERING_LABEL="Ordering" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PERMISSION="Permissions" -COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICADDRESS="Publicaddress" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICADDRESS_LABEL="Public Address" -COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICEMAIL="Publicemail" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICEMAIL_DESCRIPTION="The email we may use publicly" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICEMAIL_HINT="Public Email Here" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICEMAIL_LABEL="Public Email" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICEMAIL_MESSAGE="Error! Please public email address here." -COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICNAME="Publicname" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICNAME_DESCRIPTION="The name we may use publicly" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICNAME_HINT="Public Name Here" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICNAME_LABEL="Public Name" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICNAME_MESSAGE="Error! Please add public name here." -COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICNUMBER="Publicnumber" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICNUMBER_DESCRIPTION="The phone number we may use publicly" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICNUMBER_HINT="Public Phone Here" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLICNUMBER_LABEL="Public Phone" @@ -1520,10 +1416,8 @@ COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLIC_DETAILS_NOTE_DESCRIPTION="Your COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_PUBLISHING="Publishing" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Service Provider to customise the alias." COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_STATUS="Status" -COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_TESTCOMPANIES="Testcompanies" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_TESTCOMPANIES_DESCRIPTION="Select companies that are not real companies or only used for testing purposes." COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_TESTCOMPANIES_LABEL="Set Testing Companies" -COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_USER="User" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_USER_HINT="select a service provider" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_USER_LABEL="User (Service Provider)" COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_VERSION_DESC="A count of the number of times this Service Provider has been revised." diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index a7dbecdd..682d087c 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -1,56 +1,56 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('JPATH_BASE') or die; - -JHtmlBehavior::core(); -$divWrapper = range(1,120,2); -$counter = 0; -?> -ListSelection) : ?> -
- ListSelection as $ListSelection) : ?> -
-
- - -
-
- -
-
- - - -
-
-
- - -
-
+/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage batchselection.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('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/causerisk/details_above.php b/admin/layouts/causerisk/details_above.php index 57cb29bc..7be9d6c2 100644 --- a/admin/layouts/causerisk/details_above.php +++ b/admin/layouts/causerisk/details_above.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'ref', - 'alias' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + '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/causerisk/details_fullwidth.php b/admin/layouts/causerisk/details_fullwidth.php index 981db21a..53fbe952 100644 --- a/admin/layouts/causerisk/details_fullwidth.php +++ b/admin/layouts/causerisk/details_fullwidth.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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/causerisk/details_left.php b/admin/layouts/causerisk/details_left.php index 408dcb80..170991ab 100644 --- a/admin/layouts/causerisk/details_left.php +++ b/admin/layouts/causerisk/details_left.php @@ -1,50 +1,50 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'importname' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'importname' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/causerisk/details_right.php b/admin/layouts/causerisk/details_right.php index 0b6356a0..6fa6d23c 100644 --- a/admin/layouts/causerisk/details_right.php +++ b/admin/layouts/causerisk/details_right.php @@ -1,50 +1,50 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'import_id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'import_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/causerisk/publishing.php b/admin/layouts/causerisk/publishing.php index 1c812463..60f93718 100644 --- a/admin/layouts/causerisk/publishing.php +++ b/admin/layouts/causerisk/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/causerisk/publlshing.php b/admin/layouts/causerisk/publlshing.php index f9fb69fd..f6aa269c 100644 --- a/admin/layouts/causerisk/publlshing.php +++ b/admin/layouts/causerisk/publlshing.php @@ -1,55 +1,55 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/company/age_groups_percentages_fullwidth.php b/admin/layouts/company/age_groups_percentages_fullwidth.php index d84c13b3..b2487b7c 100644 --- a/admin/layouts/company/age_groups_percentages_fullwidth.php +++ b/admin/layouts/company/age_groups_percentages_fullwidth.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'age_groups_note' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage age_groups_percentages_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'age_groups_note' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/company/age_groups_percentages_left.php b/admin/layouts/company/age_groups_percentages_left.php index c4055545..aada4c4d 100644 --- a/admin/layouts/company/age_groups_percentages_left.php +++ b/admin/layouts/company/age_groups_percentages_left.php @@ -1,50 +1,50 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'percentmale' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage age_groups_percentages_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'percentmale' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/company/age_groups_percentages_right.php b/admin/layouts/company/age_groups_percentages_right.php index ae238030..13345fe1 100644 --- a/admin/layouts/company/age_groups_percentages_right.php +++ b/admin/layouts/company/age_groups_percentages_right.php @@ -1,50 +1,50 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'percentfemale' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage age_groups_percentages_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'percentfemale' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/company/causerisk_selection_fullwidth.php b/admin/layouts/company/causerisk_selection_fullwidth.php index 9e65dd44..0d16678d 100644 --- a/admin/layouts/company/causerisk_selection_fullwidth.php +++ b/admin/layouts/company/causerisk_selection_fullwidth.php @@ -1,53 +1,53 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causerisk_selection_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'causesrisks', - 'cause_risk_selection_note' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'cause_risk_selection_note' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/company/details_above.php b/admin/layouts/company/details_above.php index 942cbccc..b0b1e402 100644 --- a/admin/layouts/company/details_above.php +++ b/admin/layouts/company/details_above.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'user', - 'department' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'department' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/company/details_left.php b/admin/layouts/company/details_left.php index 6ed8e7d8..f706d39d 100644 --- a/admin/layouts/company/details_left.php +++ b/admin/layouts/company/details_left.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'per', 'email', 'country', 'service_provider', - 'datayear' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'datayear' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/company/details_right.php b/admin/layouts/company/details_right.php index 22ccf773..32aa6b18 100644 --- a/admin/layouts/company/details_right.php +++ b/admin/layouts/company/details_right.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'working_days', 'total_salary', 'total_healthcare', @@ -44,17 +44,17 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'medical_turnovers_females', 'turnover_comment', 'sick_leave_males', - 'sick_leave_females' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'sick_leave_females' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/company/details_under.php b/admin/layouts/company/details_under.php index 0b043c60..d83e7a0a 100644 --- a/admin/layouts/company/details_under.php +++ b/admin/layouts/company/details_under.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'not_required' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_under.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'not_required' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/company/interventions_fullwidth.php b/admin/layouts/company/interventions_fullwidth.php index 7ceb502e..5f37c923 100644 --- a/admin/layouts/company/interventions_fullwidth.php +++ b/admin/layouts/company/interventions_fullwidth.php @@ -1,29 +1,29 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// set the defaults -$items = $displayData->vwdinterventions; -$user = JFactory::getUser(); -$id = $displayData->item->id; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage interventions_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// set the defaults +$items = $displayData->vwdinterventions; +$user = JFactory::getUser(); +$id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_costbenefitprojection&view=interventions&task=intervention.edit"; // set a return value @@ -47,10 +47,10 @@ else // set the create new URL $new = "index.php?option=com_costbenefitprojection&view=interventions&task=intervention.edit" . $ref; // load the action object -$can = CostbenefitprojectionHelper::getActions('intervention'); - -?> -
+$can = CostbenefitprojectionHelper::getActions('intervention'); + +?> +
get('intervention.create')): ?>

@@ -160,5 +160,5 @@ $can = CostbenefitprojectionHelper::getActions('intervention');
- -
+ +
diff --git a/admin/layouts/company/publishing.php b/admin/layouts/company/publishing.php index 1c812463..60f93718 100644 --- a/admin/layouts/company/publishing.php +++ b/admin/layouts/company/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/company/publlshing.php b/admin/layouts/company/publlshing.php index f9fb69fd..f6aa269c 100644 --- a/admin/layouts/company/publlshing.php +++ b/admin/layouts/company/publlshing.php @@ -1,55 +1,55 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/company/scaling_factors_fullwidth.php b/admin/layouts/company/scaling_factors_fullwidth.php index 5ce9d3a6..12ab7506 100644 --- a/admin/layouts/company/scaling_factors_fullwidth.php +++ b/admin/layouts/company/scaling_factors_fullwidth.php @@ -1,29 +1,29 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// set the defaults -$items = $displayData->vwcscaling_factors; -$user = JFactory::getUser(); -$id = $displayData->item->id; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factors_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// set the defaults +$items = $displayData->vwcscaling_factors; +$user = JFactory::getUser(); +$id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_costbenefitprojection&view=scaling_factors&task=scaling_factor.edit"; // set a return value @@ -43,10 +43,10 @@ if (CostbenefitprojectionHelper::checkString($return)) else { $ref = ($id) ? "&ref=company&refid=" . $id : ""; -} - -?> -
+} + +?> +
@@ -165,5 +165,5 @@ else
- - + + diff --git a/admin/layouts/country/age_groups_percentages_left.php b/admin/layouts/country/age_groups_percentages_left.php index c4055545..aada4c4d 100644 --- a/admin/layouts/country/age_groups_percentages_left.php +++ b/admin/layouts/country/age_groups_percentages_left.php @@ -1,50 +1,50 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'percentmale' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage age_groups_percentages_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'percentmale' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/country/age_groups_percentages_right.php b/admin/layouts/country/age_groups_percentages_right.php index ae238030..13345fe1 100644 --- a/admin/layouts/country/age_groups_percentages_right.php +++ b/admin/layouts/country/age_groups_percentages_right.php @@ -1,50 +1,50 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'percentfemale' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage age_groups_percentages_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'percentfemale' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/country/causerisk_selection_fullwidth.php b/admin/layouts/country/causerisk_selection_fullwidth.php index f11d4f9a..d13855fc 100644 --- a/admin/layouts/country/causerisk_selection_fullwidth.php +++ b/admin/layouts/country/causerisk_selection_fullwidth.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'causesrisks' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causerisk_selection_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'causesrisks' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/country/companies_fullwidth.php b/admin/layouts/country/companies_fullwidth.php index 6f818976..928728b0 100644 --- a/admin/layouts/country/companies_fullwidth.php +++ b/admin/layouts/country/companies_fullwidth.php @@ -1,29 +1,29 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// set the defaults -$items = $displayData->vwhcompanies; -$user = JFactory::getUser(); -$id = $displayData->item->id; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companies_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// set the defaults +$items = $displayData->vwhcompanies; +$user = JFactory::getUser(); +$id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_costbenefitprojection&view=companies&task=company.edit"; // set a return value @@ -47,10 +47,10 @@ else // set the create new URL $new = "index.php?option=com_costbenefitprojection&view=companies&task=company.edit" . $ref; // load the action object -$can = CostbenefitprojectionHelper::getActions('company'); - -?> -
+$can = CostbenefitprojectionHelper::getActions('company'); + +?> +
get('company.create')): ?>

@@ -175,5 +175,5 @@ $can = CostbenefitprojectionHelper::getActions('company');
- -
+ +
diff --git a/admin/layouts/country/details_above.php b/admin/layouts/country/details_above.php index b3f83ce4..1a29e406 100644 --- a/admin/layouts/country/details_above.php +++ b/admin/layouts/country/details_above.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', - 'user' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'user' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/country/details_left.php b/admin/layouts/country/details_left.php index f4b794dc..b48a759d 100644 --- a/admin/layouts/country/details_left.php +++ b/admin/layouts/country/details_left.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'currency', 'datayear', 'worldzone', 'codethree', - 'codetwo' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'codetwo' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/country/details_right.php b/admin/layouts/country/details_right.php index 86976d15..fb38bc3d 100644 --- a/admin/layouts/country/details_right.php +++ b/admin/layouts/country/details_right.php @@ -1,55 +1,55 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'working_days', 'presenteeism', 'medical_turnovers', 'sick_leave', 'healthcare', - 'productivity_losses' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'productivity_losses' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/country/health_data_totals_left.php b/admin/layouts/country/health_data_totals_left.php index 56b89f74..19d4760e 100644 --- a/admin/layouts/country/health_data_totals_left.php +++ b/admin/layouts/country/health_data_totals_left.php @@ -1,51 +1,51 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage health_data_totals_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'maledeath', - 'maleyld' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'maleyld' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/country/health_data_totals_right.php b/admin/layouts/country/health_data_totals_right.php index c7867ac0..3abc64d5 100644 --- a/admin/layouts/country/health_data_totals_right.php +++ b/admin/layouts/country/health_data_totals_right.php @@ -1,51 +1,51 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage health_data_totals_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'femaledeath', - 'femaleyld' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'femaleyld' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/country/interventions_fullwidth.php b/admin/layouts/country/interventions_fullwidth.php index de3f65fd..d1802f81 100644 --- a/admin/layouts/country/interventions_fullwidth.php +++ b/admin/layouts/country/interventions_fullwidth.php @@ -1,29 +1,29 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// set the defaults -$items = $displayData->vwfinterventions; -$user = JFactory::getUser(); -$id = $displayData->item->id; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage interventions_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// set the defaults +$items = $displayData->vwfinterventions; +$user = JFactory::getUser(); +$id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_costbenefitprojection&view=interventions&task=intervention.edit"; // set a return value @@ -47,10 +47,10 @@ else // set the create new URL $new = "index.php?option=com_costbenefitprojection&view=interventions&task=intervention.edit" . $ref; // load the action object -$can = CostbenefitprojectionHelper::getActions('intervention'); - -?> -
+$can = CostbenefitprojectionHelper::getActions('intervention'); + +?> +
get('intervention.create')): ?>

@@ -164,5 +164,5 @@ $can = CostbenefitprojectionHelper::getActions('intervention');
- -
+ +
diff --git a/admin/layouts/country/public_details_fullwidth.php b/admin/layouts/country/public_details_fullwidth.php index 9b583915..5153f5a5 100644 --- a/admin/layouts/country/public_details_fullwidth.php +++ b/admin/layouts/country/public_details_fullwidth.php @@ -1,55 +1,55 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage public_details_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'publicname', 'publicemail', 'publicnumber', - 'publicaddress' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'publicaddress' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/country/publishing.php b/admin/layouts/country/publishing.php index 1c812463..60f93718 100644 --- a/admin/layouts/country/publishing.php +++ b/admin/layouts/country/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/country/publlshing.php b/admin/layouts/country/publlshing.php index f9fb69fd..f6aa269c 100644 --- a/admin/layouts/country/publlshing.php +++ b/admin/layouts/country/publlshing.php @@ -1,55 +1,55 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/country/service_providers_fullwidth.php b/admin/layouts/country/service_providers_fullwidth.php index 987bcd6c..38a7c45f 100644 --- a/admin/layouts/country/service_providers_fullwidth.php +++ b/admin/layouts/country/service_providers_fullwidth.php @@ -1,29 +1,29 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// set the defaults -$items = $displayData->vwgservice_providers; -$user = JFactory::getUser(); -$id = $displayData->item->id; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage service_providers_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// set the defaults +$items = $displayData->vwgservice_providers; +$user = JFactory::getUser(); +$id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_costbenefitprojection&view=service_providers&task=service_provider.edit"; // set a return value @@ -47,10 +47,10 @@ else // set the create new URL $new = "index.php?option=com_costbenefitprojection&view=service_providers&task=service_provider.edit" . $ref; // load the action object -$can = CostbenefitprojectionHelper::getActions('service_provider'); - -?> -
+$can = CostbenefitprojectionHelper::getActions('service_provider'); + +?> +
get('service_provider.create')): ?>

@@ -160,5 +160,5 @@ $can = CostbenefitprojectionHelper::getActions('service_provider');
- -
+ +
diff --git a/admin/layouts/currency/details_above.php b/admin/layouts/currency/details_above.php index 0d087a82..81939fef 100644 --- a/admin/layouts/currency/details_above.php +++ b/admin/layouts/currency/details_above.php @@ -1,53 +1,53 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - -
- + '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/currency/details_left.php b/admin/layouts/currency/details_left.php index ef750b8e..9b92245c 100644 --- a/admin/layouts/currency/details_left.php +++ b/admin/layouts/currency/details_left.php @@ -1,53 +1,53 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'codethree', 'numericcode', 'symbol', - 'thousands' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'thousands' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/currency/details_right.php b/admin/layouts/currency/details_right.php index 909437cf..24ddbb12 100644 --- a/admin/layouts/currency/details_right.php +++ b/admin/layouts/currency/details_right.php @@ -1,53 +1,53 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'decimalplace', 'decimalsymbol', 'positivestyle', - 'negativestyle' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'negativestyle' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/currency/publishing.php b/admin/layouts/currency/publishing.php index 1c812463..60f93718 100644 --- a/admin/layouts/currency/publishing.php +++ b/admin/layouts/currency/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/currency/publlshing.php b/admin/layouts/currency/publlshing.php index f9fb69fd..f6aa269c 100644 --- a/admin/layouts/currency/publlshing.php +++ b/admin/layouts/currency/publlshing.php @@ -1,55 +1,55 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/databreakdownmalefemale.php b/admin/layouts/databreakdownmalefemale.php index ede62762..01815f22 100644 --- a/admin/layouts/databreakdownmalefemale.php +++ b/admin/layouts/databreakdownmalefemale.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage databreakdownmalefemale.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('JPATH_BASE') or die('Restricted access'); $builder = array( @@ -27,8 +27,8 @@ $builder = array( $rounder = array( 'cost' => array('yld','death'), 'day' => array('yld','death','morbidity_'.$displayData->_tmpScale, 'presenteeism_'.$displayData->_tmpScale, 'days_lost_mortality_'.$displayData->_tmpScale) - ); - + ); + ?> male) && isset($displayData->female) ): ?>
@@ -65,4 +65,4 @@ $rounder = array(
- + diff --git a/admin/layouts/health_data/details_above.php b/admin/layouts/health_data/details_above.php index 9af8f01f..ea230624 100644 --- a/admin/layouts/health_data/details_above.php +++ b/admin/layouts/health_data/details_above.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'causerisk' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'causerisk' +); + +$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_data/details_left.php b/admin/layouts/health_data/details_left.php index c85a175d..f7591d00 100644 --- a/admin/layouts/health_data/details_left.php +++ b/admin/layouts/health_data/details_left.php @@ -1,51 +1,51 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'maledeath', - 'maleyld' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'maleyld' +); + +$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_data/details_right.php b/admin/layouts/health_data/details_right.php index 7d5cfcf1..50caa358 100644 --- a/admin/layouts/health_data/details_right.php +++ b/admin/layouts/health_data/details_right.php @@ -1,51 +1,51 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'femaledeath', - 'femaleyld' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'femaleyld' +); + +$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_data/details_rightside.php b/admin/layouts/health_data/details_rightside.php index 5ab50b61..0b3c0c4b 100644 --- a/admin/layouts/health_data/details_rightside.php +++ b/admin/layouts/health_data/details_rightside.php @@ -1,51 +1,51 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_rightside.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'year', - 'country' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'country' +); + +$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_data/publishing.php b/admin/layouts/health_data/publishing.php index 1c812463..60f93718 100644 --- a/admin/layouts/health_data/publishing.php +++ b/admin/layouts/health_data/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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_data/publlshing.php b/admin/layouts/health_data/publlshing.php index f9fb69fd..f6aa269c 100644 --- a/admin/layouts/health_data/publlshing.php +++ b/admin/layouts/health_data/publlshing.php @@ -1,55 +1,55 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/help_document/details_above.php b/admin/layouts/help_document/details_above.php index 94714eb8..252a2b6f 100644 --- a/admin/layouts/help_document/details_above.php +++ b/admin/layouts/help_document/details_above.php @@ -1,53 +1,53 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', - 'alias' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + '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/help_document/details_fullwidth.php b/admin/layouts/help_document/details_fullwidth.php index 4e5fc57d..7d25ec6a 100644 --- a/admin/layouts/help_document/details_fullwidth.php +++ b/admin/layouts/help_document/details_fullwidth.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'content' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'content' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/help_document/details_left.php b/admin/layouts/help_document/details_left.php index c60e7041..7a159885 100644 --- a/admin/layouts/help_document/details_left.php +++ b/admin/layouts/help_document/details_left.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'target', 'groups', 'location', 'admin_view', - 'site_view' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'site_view' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/help_document/details_right.php b/admin/layouts/help_document/details_right.php index c796089d..9c4d3bae 100644 --- a/admin/layouts/help_document/details_right.php +++ b/admin/layouts/help_document/details_right.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'type', 'url', - 'article' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'article' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/help_document/details_under.php b/admin/layouts/help_document/details_under.php index 0b043c60..d83e7a0a 100644 --- a/admin/layouts/help_document/details_under.php +++ b/admin/layouts/help_document/details_under.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'not_required' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_under.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'not_required' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/help_document/publishing.php b/admin/layouts/help_document/publishing.php index 6af480c4..cad86927 100644 --- a/admin/layouts/help_document/publishing.php +++ b/admin/layouts/help_document/publishing.php @@ -1,53 +1,53 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( '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)); ?> - - + '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/help_document/publlshing.php b/admin/layouts/help_document/publlshing.php index 7767bba7..70767966 100644 --- a/admin/layouts/help_document/publlshing.php +++ b/admin/layouts/help_document/publlshing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'version', 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + '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/intervention/details_above.php b/admin/layouts/intervention/details_above.php index 824120c6..4fd4982b 100644 --- a/admin/layouts/intervention/details_above.php +++ b/admin/layouts/intervention/details_above.php @@ -1,55 +1,55 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'company', 'country', - 'type' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + '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/intervention/details_fullwidth.php b/admin/layouts/intervention/details_fullwidth.php index a684b291..1da69d74 100644 --- a/admin/layouts/intervention/details_fullwidth.php +++ b/admin/layouts/intervention/details_fullwidth.php @@ -1,56 +1,56 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'coverage', 'duration', 'share', 'description', - 'reference' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'reference' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/intervention/details_under.php b/admin/layouts/intervention/details_under.php index 0b043c60..d83e7a0a 100644 --- a/admin/layouts/intervention/details_under.php +++ b/admin/layouts/intervention/details_under.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'not_required' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_under.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'not_required' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/intervention/publishing.php b/admin/layouts/intervention/publishing.php index 1c812463..60f93718 100644 --- a/admin/layouts/intervention/publishing.php +++ b/admin/layouts/intervention/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/intervention/publlshing.php b/admin/layouts/intervention/publlshing.php index 7767bba7..70767966 100644 --- a/admin/layouts/intervention/publlshing.php +++ b/admin/layouts/intervention/publlshing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'version', 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + '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/intervention/settings_fullwidth.php b/admin/layouts/intervention/settings_fullwidth.php index ae887369..00abf78b 100644 --- a/admin/layouts/intervention/settings_fullwidth.php +++ b/admin/layouts/intervention/settings_fullwidth.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'intervention' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage settings_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'intervention' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/intervention/settings_left.php b/admin/layouts/intervention/settings_left.php index f41c46a9..e0c44f35 100644 --- a/admin/layouts/intervention/settings_left.php +++ b/admin/layouts/intervention/settings_left.php @@ -1,50 +1,50 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'interventions' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage settings_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'interventions' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/scaling_factor/details_above.php b/admin/layouts/scaling_factor/details_above.php index 88d019c5..182fcc27 100644 --- a/admin/layouts/scaling_factor/details_above.php +++ b/admin/layouts/scaling_factor/details_above.php @@ -1,53 +1,53 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'company', - 'country' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'country' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/scaling_factor/details_left.php b/admin/layouts/scaling_factor/details_left.php index 26c411f9..9d2b2280 100644 --- a/admin/layouts/scaling_factor/details_left.php +++ b/admin/layouts/scaling_factor/details_left.php @@ -1,51 +1,51 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'causerisk', - 'reference' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'reference' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/scaling_factor/details_right.php b/admin/layouts/scaling_factor/details_right.php index 6a1160e2..0a3d8695 100644 --- a/admin/layouts/scaling_factor/details_right.php +++ b/admin/layouts/scaling_factor/details_right.php @@ -1,56 +1,56 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'yld_scaling_factor_males', 'yld_scaling_factor_females', 'mortality_scaling_factor_males', 'mortality_scaling_factor_females', 'presenteeism_scaling_factor_males', 'presenteeism_scaling_factor_females', - 'health_scaling_factor' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'health_scaling_factor' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/scaling_factor/publishing.php b/admin/layouts/scaling_factor/publishing.php index 1c812463..60f93718 100644 --- a/admin/layouts/scaling_factor/publishing.php +++ b/admin/layouts/scaling_factor/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/scaling_factor/publlshing.php b/admin/layouts/scaling_factor/publlshing.php index 7767bba7..70767966 100644 --- a/admin/layouts/scaling_factor/publlshing.php +++ b/admin/layouts/scaling_factor/publlshing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'version', 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + '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/service_provider/companies_fullwidth.php b/admin/layouts/service_provider/companies_fullwidth.php index 1a2ba105..81fd8c1e 100644 --- a/admin/layouts/service_provider/companies_fullwidth.php +++ b/admin/layouts/service_provider/companies_fullwidth.php @@ -1,29 +1,29 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// set the defaults -$items = $displayData->vwecompanies; -$user = JFactory::getUser(); -$id = $displayData->item->id; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companies_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// set the defaults +$items = $displayData->vwecompanies; +$user = JFactory::getUser(); +$id = $displayData->item->id; // set the edit URL $edit = "index.php?option=com_costbenefitprojection&view=companies&task=company.edit"; // set a return value @@ -47,10 +47,10 @@ else // set the create new URL $new = "index.php?option=com_costbenefitprojection&view=companies&task=company.edit" . $ref; // load the action object -$can = CostbenefitprojectionHelper::getActions('company'); - -?> -
+$can = CostbenefitprojectionHelper::getActions('company'); + +?> +
get('company.create')): ?>

@@ -175,5 +175,5 @@ $can = CostbenefitprojectionHelper::getActions('company');
- -
+ +
diff --git a/admin/layouts/service_provider/details_above.php b/admin/layouts/service_provider/details_above.php index 6fef302d..c1edb5e0 100644 --- a/admin/layouts/service_provider/details_above.php +++ b/admin/layouts/service_provider/details_above.php @@ -1,53 +1,53 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'user', - 'country' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'country' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/service_provider/details_left.php b/admin/layouts/service_provider/details_left.php index 5c40310a..338b1a85 100644 --- a/admin/layouts/service_provider/details_left.php +++ b/admin/layouts/service_provider/details_left.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'public_details_note', 'publicname', 'publicemail', 'publicnumber', - 'publicaddress' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'publicaddress' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/service_provider/details_right.php b/admin/layouts/service_provider/details_right.php index 0554ad9f..84687939 100644 --- a/admin/layouts/service_provider/details_right.php +++ b/admin/layouts/service_provider/details_right.php @@ -1,50 +1,50 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'testcompanies' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'testcompanies' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/service_provider/publishing.php b/admin/layouts/service_provider/publishing.php index 1c812463..60f93718 100644 --- a/admin/layouts/service_provider/publishing.php +++ b/admin/layouts/service_provider/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + '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/service_provider/publlshing.php b/admin/layouts/service_provider/publlshing.php index 7767bba7..70767966 100644 --- a/admin/layouts/service_provider/publlshing.php +++ b/admin/layouts/service_provider/publlshing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'version', 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 6c7f95bc..a9082b1b 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -1,40 +1,40 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Ajax Model - */ -class CostbenefitprojectionModelAjax extends JModelList -{ - protected $app_params; - - public function __construct() - { - parent::__construct(); - // get params - $this->app_params = JComponentHelper::getParams('com_costbenefitprojection'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage ajax.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Ajax Model + */ +class CostbenefitprojectionModelAjax extends JModelList +{ + protected $app_params; + + public function __construct() + { + parent::__construct(); + // get params + $this->app_params = JComponentHelper::getParams('com_costbenefitprojection'); + } // Used in company @@ -282,5 +282,5 @@ public function getInterventionBuildTable($idName,$oject,$cluster) return true; } return false; - } -} + } +} diff --git a/admin/models/causerisk.php b/admin/models/causerisk.php index 99f20e5c..29f7a4d3 100644 --- a/admin/models/causerisk.php +++ b/admin/models/causerisk.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causerisk.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Causerisk Model - */ -class CostbenefitprojectionModelCauserisk extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Causerisk Model + */ +class CostbenefitprojectionModelCauserisk extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -51,94 +51,88 @@ class CostbenefitprojectionModelCauserisk extends JModelAdmin 'alias' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.causerisk'; - - /** - * 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 = 'causerisk', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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_costbenefitprojection.causerisk'); - } - } - - 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 + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.causerisk'; + + /** + * 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 = 'causerisk', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + } + } + + 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; @@ -231,29 +225,29 @@ class CostbenefitprojectionModelCauserisk extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/causerisk.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) + 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_costbenefitprojection/js/causerisk.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)) { @@ -266,19 +260,19 @@ class CostbenefitprojectionModelCauserisk extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('causerisk.delete', 'com_costbenefitprojection.causerisk.' . (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) + 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; @@ -293,104 +287,104 @@ class CostbenefitprojectionModelCauserisk extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('causerisk.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('causerisk.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('causerisk.edit', 'com_costbenefitprojection.causerisk.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('causerisk.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_causerisk')); - $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_costbenefitprojection.edit.causerisk.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.causerisk', $data); - } - - return $data; + return $user->authorise('causerisk.edit', 'com_costbenefitprojection.causerisk.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('causerisk.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_causerisk')); + $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_costbenefitprojection.edit.causerisk.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.causerisk', $data); + } + + return $data; } /** @@ -403,141 +397,141 @@ class CostbenefitprojectionModelCauserisk extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('causerisk'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('causerisk'); + $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; } /** @@ -784,38 +778,38 @@ class CostbenefitprojectionModelCauserisk extends JModelAdmin $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; + } + + /** + * 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 @@ -883,37 +877,37 @@ class CostbenefitprojectionModelCauserisk extends JModelAdmin $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; + } + + 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; } /** @@ -961,5 +955,5 @@ class CostbenefitprojectionModelCauserisk extends JModelAdmin } // We only had an alias return $alias; - } -} + } +} diff --git a/admin/models/causesrisks.php b/admin/models/causesrisks.php index f9feb839..6b8ace22 100644 --- a/admin/models/causesrisks.php +++ b/admin/models/causesrisks.php @@ -1,37 +1,37 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Causesrisks Model - */ -class CostbenefitprojectionModelCausesrisks extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causesrisks.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Causesrisks Model + */ +class CostbenefitprojectionModelCausesrisks 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', @@ -39,32 +39,32 @@ class CostbenefitprojectionModelCausesrisks extends JModelList 'a.created_by','created_by', 'a.modified_by','modified_by', 'a.name','name', - 'a.ref','ref' - ); - } - - 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; + 'a.ref','ref' + ); + } + + 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; } $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); @@ -89,23 +89,23 @@ class CostbenefitprojectionModelCausesrisks extends JModelList $this->setState('filter.name', $name); $ref = $this->getUserStateFromRequest($this->context . '.filter.ref', 'filter_ref'); - $this->setState('filter.ref', $ref); - - // 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() + $this->setState('filter.ref', $ref); + + // 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 + // Check in items $this->checkInNow(); - - // load parent items + + // load parent items $items = parent::getItems(); // Set values to display correctly. @@ -127,19 +127,19 @@ class CostbenefitprojectionModelCausesrisks extends JModelList } } - } - - // return items - return $items; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { + } + + // 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. @@ -209,7 +209,7 @@ class CostbenefitprojectionModelCausesrisks extends JModelList $query->order($db->escape($orderCol . ' ' . $orderDirn)); } - return $query; + return $query; } /** @@ -332,16 +332,16 @@ class CostbenefitprojectionModelCausesrisks extends JModelList return $headers; } return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { + } + + /** + * 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'); @@ -351,9 +351,9 @@ class CostbenefitprojectionModelCausesrisks extends JModelList $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.ref'); - - return parent::getStoreId($id); + $id .= ':' . $this->getState('filter.ref'); + + return parent::getStoreId($id); } /** @@ -372,17 +372,19 @@ class CostbenefitprojectionModelCausesrisks extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__costbenefitprojection_causerisk')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -397,7 +399,7 @@ class CostbenefitprojectionModelCausesrisks extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__costbenefitprojection_causerisk'))->set($fields)->where($conditions); $db->setQuery($query); @@ -407,5 +409,5 @@ class CostbenefitprojectionModelCausesrisks extends JModelList } return false; - } -} + } +} diff --git a/admin/models/combinedresults.php b/admin/models/combinedresults.php index 2a40eba1..11016553 100644 --- a/admin/models/combinedresults.php +++ b/admin/models/combinedresults.php @@ -1,62 +1,62 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Model for Combinedresults - */ -class CostbenefitprojectionModelCombinedresults extends JModelList -{ - /** - * Model user data. - * - * @var strings - */ - protected $user; - protected $userId; - protected $guest; - protected $groups; - protected $levels; - protected $app; - protected $input; - protected $uikitComp; - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { - // Get the current user for authorisation checks - $this->user = JFactory::getUser(); - $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->app = JFactory::getApplication(); - $this->input = $this->app->input; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage combinedresults.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Model for Combinedresults + */ +class CostbenefitprojectionModelCombinedresults extends JModelList +{ + /** + * Model user data. + * + * @var strings + */ + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; + protected $app; + protected $input; + protected $uikitComp; + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the current user for authorisation checks + $this->user = JFactory::getUser(); + $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->app = JFactory::getApplication(); + $this->input = $this->app->input; $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); @@ -127,30 +127,30 @@ class CostbenefitprojectionModelCombinedresults extends JModelList } // return the query object - return $query; - } - - /** - * Method to get an array of data items. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getItems() - { - $user = JFactory::getUser(); - // check if this user has permission to access items - if (!$user->authorise('combinedresults.access', 'com_costbenefitprojection')) - { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::_('Not authorised!'), 'error'); - // redirect away if not a correct (TODO for now we go to default view) - $app->redirect('index.php?option=com_costbenefitprojection'); - return false; - } - // load parent items - $items = parent::getItems(); - - // Get the global params + return $query; + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + $user = JFactory::getUser(); + // check if this user has permission to access items + if (!$user->authorise('combinedresults.access', 'com_costbenefitprojection')) + { + $app = JFactory::getApplication(); + $app->enqueueMessage(JText::_('Not authorised!'), 'error'); + // redirect away if not a correct (TODO for now we go to default view) + $app->redirect('index.php?option=com_costbenefitprojection'); + return false; + } + // load parent items + $items = parent::getItems(); + + // Get the global params $globalParams = JComponentHelper::getParams('com_costbenefitprojection', true); // Get the whmcs encryption. @@ -163,7 +163,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's @@ -234,7 +234,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList $_country_publicaddress = new stdClass(); $_country_publicaddress->text =& $item->country_publicaddress; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (country_publicaddress) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.combinedresults.country_publicaddress', &$_country_publicaddress, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.combinedresults.country_publicaddress', &$_country_publicaddress, &$params, 0)); // Checking if country_publicaddress has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->country_publicaddress,$this->uikitComp); // set the global causesrisks value. @@ -260,10 +260,10 @@ class CostbenefitprojectionModelCombinedresults extends JModelList // set countryCountryInterventionDD to the $item object. $item->countryCountryInterventionDD = $this->getCountryCountryInterventionBcbb_DD($item->country); } - } - - // return items - return $items; + } + + // return items + return $items; } /** @@ -311,7 +311,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -351,7 +351,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. @@ -363,7 +363,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList $_reference = new stdClass(); $_reference->text =& $item->reference; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (reference) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.combinedresults.reference', &$_reference, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.combinedresults.reference', &$_reference, &$params, 0)); // Checking if reference has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->reference,$this->uikitComp); } @@ -405,7 +405,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. @@ -423,7 +423,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList $_description = new stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.combinedresults.description', &$_description, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.combinedresults.description', &$_description, &$params, 0)); // Checking if description has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->description,$this->uikitComp); } @@ -453,7 +453,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'g')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('g.id IN (' . implode(',', $array) . ')'); @@ -472,7 +472,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -523,7 +523,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -550,7 +550,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'gg')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('gg.id IN (' . implode(',', $array) . ')'); @@ -569,7 +569,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -608,7 +608,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -630,5 +630,5 @@ class CostbenefitprojectionModelCombinedresults extends JModelList return false; } -// none -} +// none +} diff --git a/admin/models/companies.php b/admin/models/companies.php index 185193ed..9cdcfb3f 100644 --- a/admin/models/companies.php +++ b/admin/models/companies.php @@ -1,37 +1,37 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Companies Model - */ -class CostbenefitprojectionModelCompanies extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companies.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Companies Model + */ +class CostbenefitprojectionModelCompanies 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', @@ -43,32 +43,32 @@ class CostbenefitprojectionModelCompanies extends JModelList 'i.user','service_provider', 'a.per','per', 'a.name','name', - 'g.name','user' - ); - } - - 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; + 'g.name','user' + ); + } + + 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; } $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); @@ -105,23 +105,23 @@ class CostbenefitprojectionModelCompanies extends JModelList $this->setState('filter.name', $name); $user = $this->getUserStateFromRequest($this->context . '.filter.user', 'filter_user'); - $this->setState('filter.user', $user); - - // 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() + $this->setState('filter.user', $user); + + // 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 + // Check in items $this->checkInNow(); - - // load parent items + + // load parent items $items = parent::getItems(); // Set values to display correctly. @@ -156,10 +156,10 @@ class CostbenefitprojectionModelCompanies extends JModelList $item->per = $this->selectionTranslation($item->per, 'per'); } } - - - // return items - return $items; + + + // return items + return $items; } /** @@ -196,15 +196,15 @@ class CostbenefitprojectionModelCompanies extends JModelList } } return $value; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { + } + + /** + * 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. @@ -371,7 +371,7 @@ class CostbenefitprojectionModelCompanies extends JModelList $query->order($db->escape($orderCol . ' ' . $orderDirn)); } - return $query; + return $query; } /** @@ -556,16 +556,16 @@ class CostbenefitprojectionModelCompanies extends JModelList return $headers; } return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { + } + + /** + * 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'); @@ -579,9 +579,9 @@ class CostbenefitprojectionModelCompanies extends JModelList $id .= ':' . $this->getState('filter.service_provider'); $id .= ':' . $this->getState('filter.per'); $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.user'); - - return parent::getStoreId($id); + $id .= ':' . $this->getState('filter.user'); + + return parent::getStoreId($id); } /** @@ -600,17 +600,19 @@ class CostbenefitprojectionModelCompanies extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__costbenefitprojection_company')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -625,7 +627,7 @@ class CostbenefitprojectionModelCompanies extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__costbenefitprojection_company'))->set($fields)->where($conditions); $db->setQuery($query); @@ -635,5 +637,5 @@ class CostbenefitprojectionModelCompanies extends JModelList } return false; - } -} + } +} diff --git a/admin/models/company.php b/admin/models/company.php index b7fd1932..d701e184 100644 --- a/admin/models/company.php +++ b/admin/models/company.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage company.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Company Model - */ -class CostbenefitprojectionModelCompany extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Company Model + */ +class CostbenefitprojectionModelCompany extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -82,68 +82,68 @@ class CostbenefitprojectionModelCompany extends JModelAdmin 'age_groups_note' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.company'; - - /** - * 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 = 'company', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.company'; + + /** + * 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 = 'company', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); } // Get the whmcs encryption. @@ -203,18 +203,12 @@ class CostbenefitprojectionModelCompany extends JModelAdmin { // JSON Decode causesrisks. $item->causesrisks = json_decode($item->causesrisks); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_costbenefitprojection.company'); - } + } } $this->companyvvvv = $item->id; - $this->companyvvvw = $item->id; - - return $item; + $this->companyvvvw = $item->id; + + return $item; } /** @@ -448,22 +442,22 @@ class CostbenefitprojectionModelCompany extends JModelAdmin } } return $value; - } - - /** - * 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 + } + + /** + * 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; @@ -740,29 +734,29 @@ class CostbenefitprojectionModelCompany extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/company.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) + 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_costbenefitprojection/js/company.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)) { @@ -775,19 +769,19 @@ class CostbenefitprojectionModelCompany extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('company.delete', 'com_costbenefitprojection.company.' . (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) + 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; @@ -802,104 +796,104 @@ class CostbenefitprojectionModelCompany extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('company.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('company.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('company.edit', 'com_costbenefitprojection.company.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('company.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_company')); - $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_costbenefitprojection.edit.company.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.company', $data); - } - - return $data; + return $user->authorise('company.edit', 'com_costbenefitprojection.company.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('company.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_company')); + $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_costbenefitprojection.edit.company.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.company', $data); + } + + return $data; } /** @@ -948,141 +942,141 @@ class CostbenefitprojectionModelCompany extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('company'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('company'); + $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; } /** @@ -1388,30 +1382,30 @@ class CostbenefitprojectionModelCompany extends JModelAdmin $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; + } + + /** + * 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 causesrisks item to data @@ -1484,14 +1478,14 @@ class CostbenefitprojectionModelCompany extends JModelAdmin if ($data['id'] == 0 && !$user->authorise('company.edit.per', 'com_costbenefitprojection')) { $data['per'] = 1; - } - - // 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; + } + + // 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 @@ -1506,37 +1500,37 @@ class CostbenefitprojectionModelCompany extends JModelAdmin $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; + } + + 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; } /** @@ -1559,5 +1553,5 @@ class CostbenefitprojectionModelCompany extends JModelAdmin } return $title; - } -} + } +} diff --git a/admin/models/companyresults.php b/admin/models/companyresults.php index e157a1bf..8e3ed486 100644 --- a/admin/models/companyresults.php +++ b/admin/models/companyresults.php @@ -1,105 +1,105 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Companyresults Model - */ -class CostbenefitprojectionModelCompanyresults extends JModelItem -{ - /** - * Model context string. - * - * @var string - */ - protected $_context = 'com_costbenefitprojection.companyresults'; - - /** - * 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('companyresults.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('companyresults.access', 'com_costbenefitprojection')) - { - $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_costbenefitprojection'); - 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; - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companyresults.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Companyresults Model + */ +class CostbenefitprojectionModelCompanyresults extends JModelItem +{ + /** + * Model context string. + * + * @var string + */ + protected $_context = 'com_costbenefitprojection.companyresults'; + + /** + * 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('companyresults.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('companyresults.access', 'com_costbenefitprojection')) + { + $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_costbenefitprojection'); + 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('companyresults.id'); if (!$this->user->authorise('core.options', 'com_costbenefitprojection')) @@ -121,16 +121,16 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem } return false; } - } - - if ($this->_item === null) - { - $this->_item = array(); - } - - if (!isset($this->_item[$pk])) - { - try + } + + if ($this->_item === null) + { + $this->_item = array(); + } + + if (!isset($this->_item[$pk])) + { + try { // Get the whmcs encryption. @@ -177,7 +177,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem } // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); // Check if we can decode males if (!empty($data->males) && $whmcskey && !is_numeric($data->males) && $data->males === base64_encode(base64_decode($data->males, true))) { @@ -244,7 +244,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem $_country_publicaddress = new stdClass(); $_country_publicaddress->text =& $data->country_publicaddress; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (country_publicaddress) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.companyresults.country_publicaddress', &$_country_publicaddress, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.companyresults.country_publicaddress', &$_country_publicaddress, &$params, 0)); // Checking if country_publicaddress has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($data->country_publicaddress,$this->uikitComp); // set the global causesrisks value. @@ -271,24 +271,24 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem $data->countryCountryInterventionDD = $this->getCountryCountryInterventionEbbe_DD($data->country); // 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]; + $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]; } /** @@ -336,7 +336,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -375,7 +375,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. @@ -387,7 +387,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem $_reference = new stdClass(); $_reference->text =& $item->reference; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (reference) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.companyresults.reference', &$_reference, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.companyresults.reference', &$_reference, &$params, 0)); // Checking if reference has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->reference,$this->uikitComp); } @@ -429,7 +429,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. @@ -441,7 +441,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem $_description = new stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.companyresults.description', &$_description, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.companyresults.description', &$_description, &$params, 0)); // Checking if description has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->description,$this->uikitComp); } @@ -471,7 +471,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'g')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('g.id IN (' . implode(',', $array) . ')'); @@ -490,7 +490,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -541,7 +541,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -568,7 +568,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'gg')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('gg.id IN (' . implode(',', $array) . ')'); @@ -587,7 +587,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -625,7 +625,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -647,5 +647,5 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem return false; } -// none -} +// none +} diff --git a/admin/models/costbenefitprojection.php b/admin/models/costbenefitprojection.php index 7ac0b7cb..ce3ecbf9 100644 --- a/admin/models/costbenefitprojection.php +++ b/admin/models/costbenefitprojection.php @@ -1,39 +1,41 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Costbenefitprojection Model - */ -class CostbenefitprojectionModelCostbenefitprojection 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.company.add', 'png.companies', 'png.service_provider.add', 'png.service_providers', 'png.countries', 'png.causerisk.add', 'png.causesrisks', 'png.health_data_sets', 'png.scaling_factor.add', 'png.scaling_factors', 'png.intervention.add', 'png.interventions', 'png.currencies', 'png.help_documents') +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage costbenefitprojection.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + + + +/** + * Costbenefitprojection Model + */ +class CostbenefitprojectionModelCostbenefitprojection 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.company.add', 'png.companies', 'png.service_provider.add', 'png.service_providers', 'png.countries', 'png.causerisk.add', 'png.causesrisks', 'png.health_data_sets', 'png.scaling_factor.add', 'png.scaling_factors', 'png.intervention.add', 'png.interventions', 'png.currencies', 'png.help_documents') ); // view access array $viewAccess = array( @@ -89,191 +91,191 @@ class CostbenefitprojectionModelCostbenefitprojection extends JModelList 'help_documents.access' => 'help_document.access', 'help_document.access' => 'help_document.access', 'help_documents.submenu' => 'help_document.submenu', - 'help_documents.dashboard_list' => 'help_document.dashboard_list'); - // loop over the $views - foreach($viewGroups as $group => $views) - { - $i = 0; - if (CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_DASHBOARD_' . CostbenefitprojectionHelper::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_costbenefitprojection&view=' . $name . '&layout=edit'; - $image = $name . '_' . $action. '.' . $type; - $alt = $name . ' ' . $action; - $name = 'COM_COSTBENEFITPROJECTION_DASHBOARD_'.CostbenefitprojectionHelper::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_costbenefitprojection.' . $name; - } - $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; - $image = $name . '_' . $action . '.' . $type; - $alt = $viewName . ' ' . $action; - $name = 'COM_COSTBENEFITPROJECTION_DASHBOARD_' . CostbenefitprojectionHelper::safeString($name,'U') . '_' . CostbenefitprojectionHelper::safeString($action,'U'); - break; - } - } - else - { - $viewName = $name; - $alt = $name; - $url = 'index.php?option=com_costbenefitprojection&view=' . $name; - $image = $name . '.' . $type; - $name = 'COM_COSTBENEFITPROJECTION_DASHBOARD_' . CostbenefitprojectionHelper::safeString($name,'U'); - $hover = false; - } - } - else - { - $viewName = $view; - $alt = $view; - $url = 'index.php?option=com_costbenefitprojection&view=' . $view; - $image = $view . '.png'; - $name = ucwords($view).'

'; - $hover = false; - } - // first make sure the view access is set - if (CostbenefitprojectionHelper::checkArray($viewAccess)) - { - // setup some defaults - $dashboard_add = false; - $dashboard_list = false; - $accessTo = ''; - $accessAdd = ''; - // access checking start - $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName.'.create']):false; - $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName.'.access']):false; - // set main controllers - $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false; - $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? CostbenefitprojectionHelper::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_costbenefitprojection'); - } - if ($accessDashboard_list) - { - $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_costbenefitprojection'); - } - if (CostbenefitprojectionHelper::checkString($accessAdd) && CostbenefitprojectionHelper::checkString($accessTo)) - { - // check access - if($user->authorise($accessAdd, 'com_costbenefitprojection') && $user->authorise($accessTo, 'com_costbenefitprojection') && $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 (CostbenefitprojectionHelper::checkString($accessTo)) - { - // check access - if($user->authorise($accessTo, 'com_costbenefitprojection') && $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 (CostbenefitprojectionHelper::checkString($accessAdd)) - { - // check access - if($user->authorise($accessAdd, 'com_costbenefitprojection') && $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; + 'help_documents.dashboard_list' => 'help_document.dashboard_list'); + // loop over the $views + foreach($viewGroups as $group => $views) + { + $i = 0; + if (CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_DASHBOARD_' . CostbenefitprojectionHelper::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_costbenefitprojection&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; + $name = 'COM_COSTBENEFITPROJECTION_DASHBOARD_'.CostbenefitprojectionHelper::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_costbenefitprojection.' . $name; + } + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_COSTBENEFITPROJECTION_DASHBOARD_' . CostbenefitprojectionHelper::safeString($name,'U') . '_' . CostbenefitprojectionHelper::safeString($action,'U'); + break; + } + } + else + { + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_costbenefitprojection&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_COSTBENEFITPROJECTION_DASHBOARD_' . CostbenefitprojectionHelper::safeString($name,'U'); + $hover = false; + } + } + else + { + $viewName = $view; + $alt = $view; + $url = 'index.php?option=com_costbenefitprojection&view=' . $view; + $image = $view . '.png'; + $name = ucwords($view).'

'; + $hover = false; + } + // first make sure the view access is set + if (CostbenefitprojectionHelper::checkArray($viewAccess)) + { + // setup some defaults + $dashboard_add = false; + $dashboard_list = false; + $accessTo = ''; + $accessAdd = ''; + // access checking start + $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName.'.create']):false; + $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName.'.access']):false; + // set main controllers + $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false; + $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? CostbenefitprojectionHelper::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_costbenefitprojection'); + } + if ($accessDashboard_list) + { + $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_costbenefitprojection'); + } + if (CostbenefitprojectionHelper::checkString($accessAdd) && CostbenefitprojectionHelper::checkString($accessTo)) + { + // check access + if($user->authorise($accessAdd, 'com_costbenefitprojection') && $user->authorise($accessTo, 'com_costbenefitprojection') && $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 (CostbenefitprojectionHelper::checkString($accessTo)) + { + // check access + if($user->authorise($accessTo, 'com_costbenefitprojection') && $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 (CostbenefitprojectionHelper::checkString($accessAdd)) + { + // check access + if($user->authorise($accessAdd, 'com_costbenefitprojection') && $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; } public function getUsageData() @@ -627,7 +629,7 @@ class CostbenefitprojectionModelCostbenefitprojection extends JModelList .append("

" + issue.title + "

") .append("\"@" ") .append("" + issue.user.login + " '.JText::_('COM_COSTBENEFITPROJECTION_OPENED_THIS').' '.JText::_('COM_COSTBENEFITPROJECTION_ISSUE').'-" + issue.number + " (" + timeago + ") ") - .append(marked(issue.body)) + .append(marked.parse(issue.body)) .append("'.JText::_('COM_COSTBENEFITPROJECTION_RESPOND_TO_THIS_ISSUE_ON_GITHUB').'...
"); }); }); @@ -640,7 +642,7 @@ class CostbenefitprojectionModelCostbenefitprojection extends JModelList .append("

" + issue.title + "

") .append("\"@" ") .append("" + issue.user.login + " '.JText::_('COM_COSTBENEFITPROJECTION_OPENED').' '.JText::_('COM_COSTBENEFITPROJECTION_ISSUE').'-" + issue.number + " (" + timeago + ")") - .append(marked(issue.body)) + .append(marked.parse(issue.body)) .append("'.JText::_('COM_COSTBENEFITPROJECTION_REVIEW_THIS_ISSUE_ON_GITHUB').'...
"); }); }); @@ -679,7 +681,7 @@ class CostbenefitprojectionModelCostbenefitprojection extends JModelList .append(activeNotice) .append("\"@" ") .append("" + tagrelease.author.login + " '.JText::_('COM_COSTBENEFITPROJECTION_RELEASED_THIS').' " + tagrelease.tag_name+ " (" + timeago + ")") - .append(marked(tagrelease.body)) + .append(marked.parse(tagrelease.body)) .append(" " + tagrelease.assets[0].name + " (" + tagrelease.assets[0].download_count + ") ") .append("| '.JText::_('COM_COSTBENEFITPROJECTION_OPEN_ON_GITHUB').'...
"); }); @@ -711,7 +713,7 @@ class CostbenefitprojectionModelCostbenefitprojection extends JModelList jQuery.get(noticeboard) .success(function(board) { if (board.length > 5) { - jQuery("#noticeboard-md").html(marked(board)); + jQuery("#noticeboard-md").html(marked.parse(board)); getIS(1,board).done(function(result) { if (result){ jQuery("#cpanel_tabTabs a").each(function() { @@ -746,7 +748,7 @@ class CostbenefitprojectionModelCostbenefitprojection extends JModelList var getUrl = "index.php?option=com_costbenefitprojection&task=ajax.isRead&format=json&raw=true"; } if(token.length > 0 && notice.length){ - var request = "token="+token+"¬ice="+notice; + var request = token+"=1¬ice="+notice; } return jQuery.ajax({ type: "POST", @@ -789,5 +791,5 @@ jQuery(document).ready( function($) { });'); return '
'.JText::_('COM_COSTBENEFITPROJECTION_THE_README_IS_LOADING').'..
'; - } -} + } +} diff --git a/admin/models/countries.php b/admin/models/countries.php index 278cc6dd..162e2714 100644 --- a/admin/models/countries.php +++ b/admin/models/countries.php @@ -1,37 +1,37 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Countries Model - */ -class CostbenefitprojectionModelCountries extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage countries.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Countries Model + */ +class CostbenefitprojectionModelCountries 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', @@ -43,32 +43,32 @@ class CostbenefitprojectionModelCountries extends JModelList 'g.name','user', 'a.codethree','codethree', 'a.codetwo','codetwo', - 'a.working_days','working_days' - ); - } - - 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; + 'a.working_days','working_days' + ); + } + + 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; } $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); @@ -105,23 +105,23 @@ class CostbenefitprojectionModelCountries extends JModelList $this->setState('filter.codetwo', $codetwo); $working_days = $this->getUserStateFromRequest($this->context . '.filter.working_days', 'filter_working_days'); - $this->setState('filter.working_days', $working_days); - - // 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() + $this->setState('filter.working_days', $working_days); + + // 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 + // Check in items $this->checkInNow(); - - // load parent items + + // load parent items $items = parent::getItems(); // Set values to display correctly. @@ -143,19 +143,19 @@ class CostbenefitprojectionModelCountries extends JModelList } } - } - - // return items - return $items; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { + } + + // 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. @@ -266,7 +266,7 @@ class CostbenefitprojectionModelCountries extends JModelList $query->order($db->escape($orderCol . ' ' . $orderDirn)); } - return $query; + return $query; } /** @@ -405,16 +405,16 @@ class CostbenefitprojectionModelCountries extends JModelList return $headers; } return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { + } + + /** + * 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'); @@ -428,9 +428,9 @@ class CostbenefitprojectionModelCountries extends JModelList $id .= ':' . $this->getState('filter.user'); $id .= ':' . $this->getState('filter.codethree'); $id .= ':' . $this->getState('filter.codetwo'); - $id .= ':' . $this->getState('filter.working_days'); - - return parent::getStoreId($id); + $id .= ':' . $this->getState('filter.working_days'); + + return parent::getStoreId($id); } /** @@ -449,17 +449,19 @@ class CostbenefitprojectionModelCountries extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__costbenefitprojection_country')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -474,7 +476,7 @@ class CostbenefitprojectionModelCountries extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__costbenefitprojection_country'))->set($fields)->where($conditions); $db->setQuery($query); @@ -484,5 +486,5 @@ class CostbenefitprojectionModelCountries extends JModelList } return false; - } -} + } +} diff --git a/admin/models/country.php b/admin/models/country.php index f403f606..6971fa8a 100644 --- a/admin/models/country.php +++ b/admin/models/country.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage country.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Country Model - */ -class CostbenefitprojectionModelCountry extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Country Model + */ +class CostbenefitprojectionModelCountry extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -88,87 +88,81 @@ class CostbenefitprojectionModelCountry extends JModelAdmin 'causesrisks' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.country'; - - /** - * 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 = 'country', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.country'; + + /** + * 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 = 'country', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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->causesrisks)) { // JSON Decode causesrisks. $item->causesrisks = json_decode($item->causesrisks); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_costbenefitprojection.country'); - } + } } $this->countryvvvy = $item->id; $this->countryvvvz = $item->id; - $this->countryvvwa = $item->id; - - return $item; + $this->countryvvwa = $item->id; + + return $item; } /** @@ -573,22 +567,22 @@ class CostbenefitprojectionModelCountry extends JModelAdmin } } return $value; - } - - /** - * 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 + } + + /** + * 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; @@ -681,29 +675,29 @@ class CostbenefitprojectionModelCountry extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/country.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) + 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_costbenefitprojection/js/country.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)) { @@ -716,19 +710,19 @@ class CostbenefitprojectionModelCountry extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('country.delete', 'com_costbenefitprojection.country.' . (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) + 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; @@ -743,104 +737,104 @@ class CostbenefitprojectionModelCountry extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('country.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('country.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('country.edit', 'com_costbenefitprojection.country.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('country.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_country')); - $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_costbenefitprojection.edit.country.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.country', $data); - } - - return $data; + return $user->authorise('country.edit', 'com_costbenefitprojection.country.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('country.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_country')); + $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_costbenefitprojection.edit.country.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.country', $data); + } + + return $data; } /** @@ -853,141 +847,141 @@ class CostbenefitprojectionModelCountry extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('country'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('country'); + $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; } /** @@ -1296,30 +1290,30 @@ class CostbenefitprojectionModelCountry extends JModelAdmin $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; + } + + /** + * 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 causesrisks item to data @@ -1332,14 +1326,14 @@ class CostbenefitprojectionModelCountry extends JModelAdmin if (isset($data['causesrisks'])) { $data['causesrisks'] = (string) json_encode($data['causesrisks']); - } - - // 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; + } + + // 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 @@ -1407,37 +1401,37 @@ class CostbenefitprojectionModelCountry extends JModelAdmin $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; + } + + 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; } /** @@ -1485,5 +1479,5 @@ class CostbenefitprojectionModelCountry extends JModelAdmin } // We only had an alias return $alias; - } -} + } +} diff --git a/admin/models/currencies.php b/admin/models/currencies.php index cccdf9aa..f1575304 100644 --- a/admin/models/currencies.php +++ b/admin/models/currencies.php @@ -1,37 +1,37 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Currencies Model - */ -class CostbenefitprojectionModelCurrencies extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage currencies.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Currencies Model + */ +class CostbenefitprojectionModelCurrencies 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', @@ -41,32 +41,32 @@ class CostbenefitprojectionModelCurrencies extends JModelList 'a.name','name', 'a.codethree','codethree', 'a.numericcode','numericcode', - 'a.decimalplace','decimalplace' - ); - } - - 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; + 'a.decimalplace','decimalplace' + ); + } + + 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; } $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); @@ -97,23 +97,23 @@ class CostbenefitprojectionModelCurrencies extends JModelList $this->setState('filter.numericcode', $numericcode); $decimalplace = $this->getUserStateFromRequest($this->context . '.filter.decimalplace', 'filter_decimalplace'); - $this->setState('filter.decimalplace', $decimalplace); - - // 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() + $this->setState('filter.decimalplace', $decimalplace); + + // 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 + // Check in items $this->checkInNow(); - - // load parent items + + // load parent items $items = parent::getItems(); // Set values to display correctly. @@ -135,19 +135,19 @@ class CostbenefitprojectionModelCurrencies extends JModelList } } - } - - // return items - return $items; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { + } + + // 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. @@ -217,7 +217,7 @@ class CostbenefitprojectionModelCurrencies extends JModelList $query->order($db->escape($orderCol . ' ' . $orderDirn)); } - return $query; + return $query; } /** @@ -340,16 +340,16 @@ class CostbenefitprojectionModelCurrencies extends JModelList return $headers; } return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { + } + + /** + * 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'); @@ -361,9 +361,9 @@ class CostbenefitprojectionModelCurrencies extends JModelList $id .= ':' . $this->getState('filter.name'); $id .= ':' . $this->getState('filter.codethree'); $id .= ':' . $this->getState('filter.numericcode'); - $id .= ':' . $this->getState('filter.decimalplace'); - - return parent::getStoreId($id); + $id .= ':' . $this->getState('filter.decimalplace'); + + return parent::getStoreId($id); } /** @@ -382,17 +382,19 @@ class CostbenefitprojectionModelCurrencies extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__costbenefitprojection_currency')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -407,7 +409,7 @@ class CostbenefitprojectionModelCurrencies extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__costbenefitprojection_currency'))->set($fields)->where($conditions); $db->setQuery($query); @@ -417,5 +419,5 @@ class CostbenefitprojectionModelCurrencies extends JModelList } return false; - } -} + } +} diff --git a/admin/models/currency.php b/admin/models/currency.php index 9ddf1792..dc55fe7d 100644 --- a/admin/models/currency.php +++ b/admin/models/currency.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage currency.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Currency Model - */ -class CostbenefitprojectionModelCurrency extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Currency Model + */ +class CostbenefitprojectionModelCurrency extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -53,94 +53,88 @@ class CostbenefitprojectionModelCurrency extends JModelAdmin 'alias' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.currency'; - - /** - * 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 = 'currency', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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_costbenefitprojection.currency'); - } - } - - 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 + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.currency'; + + /** + * 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 = 'currency', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + } + } + + 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; @@ -233,29 +227,29 @@ class CostbenefitprojectionModelCurrency extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/currency.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) + 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_costbenefitprojection/js/currency.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)) { @@ -268,19 +262,19 @@ class CostbenefitprojectionModelCurrency extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('currency.delete', 'com_costbenefitprojection.currency.' . (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) + 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; @@ -295,104 +289,104 @@ class CostbenefitprojectionModelCurrency extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('currency.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('currency.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('currency.edit', 'com_costbenefitprojection.currency.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('currency.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_currency')); - $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_costbenefitprojection.edit.currency.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.currency', $data); - } - - return $data; + return $user->authorise('currency.edit', 'com_costbenefitprojection.currency.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('currency.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_currency')); + $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_costbenefitprojection.edit.currency.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.currency', $data); + } + + return $data; } /** @@ -405,141 +399,141 @@ class CostbenefitprojectionModelCurrency extends JModelAdmin protected function getUniqueFields() { return array('codethree'); - } - - /** - * 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 = CostbenefitprojectionHelper::getActions('currency'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('currency'); + $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; } /** @@ -786,38 +780,38 @@ class CostbenefitprojectionModelCurrency extends JModelAdmin $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; + } + + /** + * 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 @@ -885,37 +879,37 @@ class CostbenefitprojectionModelCurrency extends JModelAdmin $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; + } + + 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; } /** @@ -963,5 +957,5 @@ class CostbenefitprojectionModelCurrency extends JModelAdmin } // We only had an alias return $alias; - } -} + } +} diff --git a/admin/models/fields/adminviewfolderlist.php b/admin/models/fields/adminviewfolderlist.php index a5b7ab3e..6997bc77 100644 --- a/admin/models/fields/adminviewfolderlist.php +++ b/admin/models/fields/adminviewfolderlist.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Adminviewfolderlist Form Field class for the Costbenefitprojection component - */ -class JFormFieldAdminviewfolderlist extends JFormFieldList -{ - /** - * The adminviewfolderlist field type. - * - * @var string - */ - public $type = 'adminviewfolderlist'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage adminviewfolderlist.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Adminviewfolderlist Form Field class for the Costbenefitprojection component + */ +class JFormFieldAdminviewfolderlist extends JFormFieldList +{ + /** + * The adminviewfolderlist field type. + * + * @var string + */ + public $type = 'adminviewfolderlist'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { // get custom folder files $localfolder = JPATH_COMPONENT_ADMINISTRATOR.'/views'; // set the default @@ -52,11 +52,15 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList // now check if there are files in the folder if (JFolder::exists($localfolder) && $folders = JFolder::folders($localfolder)) { + if ($this->multiple === false) + { + $options[] = JHtml::_('select.option', '', JText::_('COM_COSTBENEFITPROJECTION_SELECT_AN_ADMIN_VIEW')); + } foreach ($folders as $folder) { $options[] = JHtml::_('select.option', $folder, CostbenefitprojectionHelper::safeString($folder, 'W')); } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php index 51b1ace1..22c054da 100644 --- a/admin/models/fields/articles.php +++ b/admin/models/fields/articles.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Articles Form Field class for the Costbenefitprojection component - */ -class JFormFieldArticles extends JFormFieldList -{ - /** - * The articles field type. - * - * @var string - */ - public $type = 'articles'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage articles.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Articles Form Field class for the Costbenefitprojection component + */ +class JFormFieldArticles extends JFormFieldList +{ + /** + * The articles field type. + * + * @var string + */ + public $type = 'articles'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias'))); @@ -60,6 +60,6 @@ class JFormFieldArticles extends JFormFieldList $options[] = JHtml::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')'); } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/causesrisks.php b/admin/models/fields/causesrisks.php index 53907656..96e258c9 100644 --- a/admin/models/fields/causesrisks.php +++ b/admin/models/fields/causesrisks.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Causesrisks Form Field class for the Costbenefitprojection component - */ -class JFormFieldCausesrisks extends JFormFieldList -{ - /** - * The causesrisks field type. - * - * @var string - */ - public $type = 'causesrisks'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causesrisks.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Causesrisks Form Field class for the Costbenefitprojection component + */ +class JFormFieldCausesrisks extends JFormFieldList +{ + /** + * The causesrisks field type. + * + * @var string + */ + public $type = 'causesrisks'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.name','a.ref'),array('id','causerisk_name','ref'))); @@ -77,6 +77,6 @@ class JFormFieldCausesrisks extends JFormFieldList } } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/causesriskscheck.php b/admin/models/fields/causesriskscheck.php index d6dce164..c5fb4f4e 100644 --- a/admin/models/fields/causesriskscheck.php +++ b/admin/models/fields/causesriskscheck.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('checkboxes'); - -/** - * Causesriskscheck Form Field class for the Costbenefitprojection component - */ -class JFormFieldCausesriskscheck extends JFormFieldCheckboxes -{ - /** - * The causesriskscheck field type. - * - * @var string - */ - public $type = 'causesriskscheck'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causesriskscheck.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('checkboxes'); + +/** + * Causesriskscheck Form Field class for the Costbenefitprojection component + */ +class JFormFieldCausesriskscheck extends JFormFieldCheckboxes +{ + /** + * The causesriskscheck field type. + * + * @var string + */ + public $type = 'causesriskscheck'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.name','a.ref'),array('id','causesrisks_name','ref'))); @@ -104,6 +104,6 @@ class JFormFieldCausesriskscheck extends JFormFieldCheckboxes } } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/company.php b/admin/models/fields/company.php index 00831d70..5d450c0e 100644 --- a/admin/models/fields/company.php +++ b/admin/models/fields/company.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Company Form Field class for the Costbenefitprojection component - */ -class JFormFieldCompany extends JFormFieldList -{ - /** - * The company field type. - * - * @var string - */ +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage company.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Company Form Field class for the Costbenefitprojection component + */ +class JFormFieldCompany extends JFormFieldList +{ + /** + * The company field type. + * + * @var string + */ public $type = 'company'; /** @@ -138,15 +138,15 @@ class JFormFieldCompany extends JFormFieldList } } return $html; - } - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { + } + + /** + * 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(); // Create a new query object. @@ -186,6 +186,6 @@ class JFormFieldCompany extends JFormFieldList $options[] = JHtml::_('select.option', $item->id, $item->company_name); } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/companycheck.php b/admin/models/fields/companycheck.php index 1a30db50..07aa014c 100644 --- a/admin/models/fields/companycheck.php +++ b/admin/models/fields/companycheck.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('checkboxes'); - -/** - * Companycheck Form Field class for the Costbenefitprojection component - */ -class JFormFieldCompanycheck extends JFormFieldCheckboxes -{ - /** - * The companycheck field type. - * - * @var string - */ - public $type = 'companycheck'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companycheck.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('checkboxes'); + +/** + * Companycheck Form Field class for the Costbenefitprojection component + */ +class JFormFieldCompanycheck extends JFormFieldCheckboxes +{ + /** + * The companycheck field type. + * + * @var string + */ + public $type = 'companycheck'; + + /** + * 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(); // Create a new query object. @@ -82,6 +82,6 @@ class JFormFieldCompanycheck extends JFormFieldCheckboxes $options[] = (object) $tmp; } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/countries.php b/admin/models/fields/countries.php index 5a4df561..4e14a2c4 100644 --- a/admin/models/fields/countries.php +++ b/admin/models/fields/countries.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Countries Form Field class for the Costbenefitprojection component - */ -class JFormFieldCountries extends JFormFieldList -{ - /** - * The countries field type. - * - * @var string - */ - public $type = 'countries'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage countries.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Countries Form Field class for the Costbenefitprojection component + */ +class JFormFieldCountries extends JFormFieldList +{ + /** + * The countries field type. + * + * @var string + */ + public $type = 'countries'; + + /** + * 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(); // Create a new query object. @@ -78,6 +78,6 @@ class JFormFieldCountries extends JFormFieldList $options[] = JHtml::_('select.option', $item->id, $item->country_name); } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/countryuser.php b/admin/models/fields/countryuser.php index 050ea8b5..d380142e 100644 --- a/admin/models/fields/countryuser.php +++ b/admin/models/fields/countryuser.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('user'); - -/** - * Countryuser Form Field class for the Costbenefitprojection component - */ -class JFormFieldCountryuser extends JFormFieldUser -{ - /** - * The countryuser field type. - * - * @var string - */ - public $type = 'countryuser'; - - /** - * Method to get the filtering groups (null means no filtering) - * - * @return mixed array of filtering groups or null. - * - * @since 1.6 - */ - protected function getGroups() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage countryuser.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('user'); + +/** + * Countryuser Form Field class for the Costbenefitprojection component + */ +class JFormFieldCountryuser extends JFormFieldUser +{ + /** + * The countryuser field type. + * + * @var string + */ + public $type = 'countryuser'; + + /** + * Method to get the filtering groups (null means no filtering) + * + * @return mixed array of filtering groups or null. + * + * @since 1.6 + */ + protected function getGroups() + { // set the groups array $groups = JComponentHelper::getParams('com_costbenefitprojection')->get('countryuser'); - return $groups; - } - - /** - * Method to get the users to exclude from the list of users - * - * @return mixed Array of users to exclude or null to to not exclude them - * - * @since 1.6 - */ - protected function getExcluded() - { + return $groups; + } + + /** + * Method to get the users to exclude from the list of users + * + * @return mixed Array of users to exclude or null to to not exclude them + * + * @since 1.6 + */ + protected function getExcluded() + { // To ensure that there is only one record per user // Get a db connection. $db = JFactory::getDbo(); @@ -75,6 +75,6 @@ class JFormFieldCountryuser extends JFormFieldUser // return all users already used return array_unique($db->loadColumn()); } - return null; - } -} + return null; + } +} diff --git a/admin/models/fields/currency.php b/admin/models/fields/currency.php index 8f7a0772..bb69d5e0 100644 --- a/admin/models/fields/currency.php +++ b/admin/models/fields/currency.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Currency Form Field class for the Costbenefitprojection component - */ -class JFormFieldCurrency extends JFormFieldList -{ - /** - * The currency field type. - * - * @var string - */ - public $type = 'currency'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage currency.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Currency Form Field class for the Costbenefitprojection component + */ +class JFormFieldCurrency extends JFormFieldList +{ + /** + * The currency field type. + * + * @var string + */ + public $type = 'currency'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.codethree','a.name'),array('codethree','currency_name'))); @@ -59,6 +59,6 @@ class JFormFieldCurrency extends JFormFieldList $options[] = JHtml::_('select.option', $item->codethree, $item->currency_name); } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/datayear.php b/admin/models/fields/datayear.php index d4c96fee..c5adc392 100644 --- a/admin/models/fields/datayear.php +++ b/admin/models/fields/datayear.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Datayear Form Field class for the Costbenefitprojection component - */ -class JFormFieldDatayear extends JFormFieldList -{ - /** - * The datayear field type. - * - * @var string - */ - public $type = 'datayear'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage datayear.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Datayear Form Field class for the Costbenefitprojection component + */ +class JFormFieldDatayear extends JFormFieldList +{ + /** + * The datayear field type. + * + * @var string + */ + public $type = 'datayear'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { $jinput = JFactory::getApplication()->input; $client = $jinput->get('id', 0, 'INT'); $countries = CostbenefitprojectionHelper::hisCountries(null,$client,'company'); @@ -79,6 +79,6 @@ class JFormFieldDatayear extends JFormFieldList } } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/interventions.php b/admin/models/fields/interventions.php index f7ecf005..a5e1e73d 100644 --- a/admin/models/fields/interventions.php +++ b/admin/models/fields/interventions.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Interventions Form Field class for the Costbenefitprojection component - */ -class JFormFieldInterventions extends JFormFieldList -{ - /** - * The interventions field type. - * - * @var string - */ - public $type = 'interventions'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage interventions.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Interventions Form Field class for the Costbenefitprojection component + */ +class JFormFieldInterventions extends JFormFieldList +{ + /** + * The interventions field type. + * + * @var string + */ + public $type = 'interventions'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { // get the input from url $jinput = JFactory::getApplication()->input; // get the view name & id @@ -94,6 +94,6 @@ class JFormFieldInterventions extends JFormFieldList } } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/memberuser.php b/admin/models/fields/memberuser.php index 06b6fbe5..4b912aa1 100644 --- a/admin/models/fields/memberuser.php +++ b/admin/models/fields/memberuser.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('user'); - -/** - * Memberuser Form Field class for the Costbenefitprojection component - */ -class JFormFieldMemberuser extends JFormFieldUser -{ - /** - * The memberuser field type. - * - * @var string - */ - public $type = 'memberuser'; - - /** - * Method to get the filtering groups (null means no filtering) - * - * @return mixed array of filtering groups or null. - * - * @since 1.6 - */ - protected function getGroups() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage memberuser.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('user'); + +/** + * Memberuser Form Field class for the Costbenefitprojection component + */ +class JFormFieldMemberuser extends JFormFieldUser +{ + /** + * The memberuser field type. + * + * @var string + */ + public $type = 'memberuser'; + + /** + * Method to get the filtering groups (null means no filtering) + * + * @return mixed array of filtering groups or null. + * + * @since 1.6 + */ + protected function getGroups() + { // set the groups array $groups = JComponentHelper::getParams('com_costbenefitprojection')->get('memberuser'); - return $groups; - } - - /** - * Method to get the users to exclude from the list of users - * - * @return mixed Array of users to exclude or null to to not exclude them - * - * @since 1.6 - */ - protected function getExcluded() - { - return null; - } -} + return $groups; + } + + /** + * Method to get the users to exclude from the list of users + * + * @return mixed Array of users to exclude or null to to not exclude them + * + * @since 1.6 + */ + protected function getExcluded() + { + return null; + } +} diff --git a/admin/models/fields/serviceprovider.php b/admin/models/fields/serviceprovider.php index 4b46f1d5..5ac8720d 100644 --- a/admin/models/fields/serviceprovider.php +++ b/admin/models/fields/serviceprovider.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Serviceprovider Form Field class for the Costbenefitprojection component - */ -class JFormFieldServiceprovider extends JFormFieldList -{ - /** - * The serviceprovider field type. - * - * @var string - */ +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage serviceprovider.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Serviceprovider Form Field class for the Costbenefitprojection component + */ +class JFormFieldServiceprovider extends JFormFieldList +{ + /** + * The serviceprovider field type. + * + * @var string + */ public $type = 'serviceprovider'; /** @@ -138,15 +138,15 @@ class JFormFieldServiceprovider extends JFormFieldList } } return $html; - } - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { + } + + /** + * 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(); // Create a new query object. @@ -181,6 +181,6 @@ class JFormFieldServiceprovider extends JFormFieldList $options[] = JHtml::_('select.option', $item->id, JFactory::getUser($item->service_provider_user)->name); } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/fields/serviceprovideruser.php b/admin/models/fields/serviceprovideruser.php index 3224650f..9839bcfc 100644 --- a/admin/models/fields/serviceprovideruser.php +++ b/admin/models/fields/serviceprovideruser.php @@ -1,64 +1,64 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('user'); - -/** - * Serviceprovideruser Form Field class for the Costbenefitprojection component - */ -class JFormFieldServiceprovideruser extends JFormFieldUser -{ - /** - * The serviceprovideruser field type. - * - * @var string - */ - public $type = 'serviceprovideruser'; - - /** - * Method to get the filtering groups (null means no filtering) - * - * @return mixed array of filtering groups or null. - * - * @since 1.6 - */ - protected function getGroups() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage serviceprovideruser.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('user'); + +/** + * Serviceprovideruser Form Field class for the Costbenefitprojection component + */ +class JFormFieldServiceprovideruser extends JFormFieldUser +{ + /** + * The serviceprovideruser field type. + * + * @var string + */ + public $type = 'serviceprovideruser'; + + /** + * Method to get the filtering groups (null means no filtering) + * + * @return mixed array of filtering groups or null. + * + * @since 1.6 + */ + protected function getGroups() + { // set the groups array $groups = JComponentHelper::getParams('com_costbenefitprojection')->get('serviceprovideruser'); - return $groups; - } - - /** - * Method to get the users to exclude from the list of users - * - * @return mixed Array of users to exclude or null to to not exclude them - * - * @since 1.6 - */ - protected function getExcluded() - { + return $groups; + } + + /** + * Method to get the users to exclude from the list of users + * + * @return mixed Array of users to exclude or null to to not exclude them + * + * @since 1.6 + */ + protected function getExcluded() + { // To ensure that there is only one record per user // Get a db connection. $db = JFactory::getDbo(); @@ -75,6 +75,6 @@ class JFormFieldServiceprovideruser extends JFormFieldUser // return all users already used return array_unique($db->loadColumn()); } - return null; - } -} + return null; + } +} diff --git a/admin/models/fields/siteviewfolderlist.php b/admin/models/fields/siteviewfolderlist.php index 14a0d2c3..0e526840 100644 --- a/admin/models/fields/siteviewfolderlist.php +++ b/admin/models/fields/siteviewfolderlist.php @@ -1,48 +1,48 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Siteviewfolderlist Form Field class for the Costbenefitprojection component - */ -class JFormFieldSiteviewfolderlist extends JFormFieldList -{ - /** - * The siteviewfolderlist field type. - * - * @var string - */ - public $type = 'siteviewfolderlist'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - protected function getOptions() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage siteviewfolderlist.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Siteviewfolderlist Form Field class for the Costbenefitprojection component + */ +class JFormFieldSiteviewfolderlist extends JFormFieldList +{ + /** + * The siteviewfolderlist field type. + * + * @var string + */ + public $type = 'siteviewfolderlist'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { // get custom folder files $localfolder = JPATH_COMPONENT_SITE.'/views'; // set the default @@ -52,11 +52,15 @@ class JFormFieldSiteviewfolderlist extends JFormFieldList // now check if there are files in the folder if (JFolder::exists($localfolder) && $folders = JFolder::folders($localfolder)) { + if ($this->multiple === false) + { + $options[] = JHtml::_('select.option', '', JText::_('COM_COSTBENEFITPROJECTION_SELECT_A_SITE_VIEW')); + } foreach ($folders as $folder) { $options[] = JHtml::_('select.option', $folder, CostbenefitprojectionHelper::safeString($folder, 'W')); } } - return $options; - } -} + return $options; + } +} diff --git a/admin/models/forms/causerisk.xml b/admin/models/forms/causerisk.xml index 2fecf165..8146eafe 100644 --- a/admin/models/forms/causerisk.xml +++ b/admin/models/forms/causerisk.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -102,8 +102,6 @@ maxlength="150" description="COM_COSTBENEFITPROJECTION_CAUSERISK_NAME_DESCRIPTION" class="text_area" - readonly="false" - disabled="false" required="true" filter="STRING" message="COM_COSTBENEFITPROJECTION_CAUSERISK_NAME_MESSAGE" @@ -177,8 +175,8 @@ filter="STRING" hint="COM_COSTBENEFITPROJECTION_CAUSERISK_ALIAS_HINT" /> -
- + +
@@ -199,5 +197,5 @@ component="com_costbenefitprojection" section="causerisk" /> -
+ \ No newline at end of file diff --git a/admin/models/forms/company.xml b/admin/models/forms/company.xml index 6d27626e..d779e054 100644 --- a/admin/models/forms/company.xml +++ b/admin/models/forms/company.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -519,8 +519,8 @@ message="COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_FEMALES_MESSAGE" hint="COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_FEMALES_HINT" /> -
- + +
@@ -541,5 +541,5 @@ component="com_costbenefitprojection" section="company" /> -
+ \ No newline at end of file diff --git a/admin/models/forms/country.xml b/admin/models/forms/country.xml index 6750459e..9af79f02 100644 --- a/admin/models/forms/country.xml +++ b/admin/models/forms/country.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -102,8 +102,6 @@ maxlength="150" description="COM_COSTBENEFITPROJECTION_COUNTRY_NAME_DESCRIPTION" class="text_area" - readonly="false" - disabled="false" required="true" filter="STRING" message="COM_COSTBENEFITPROJECTION_COUNTRY_NAME_MESSAGE" @@ -910,8 +908,8 @@ message="COM_COSTBENEFITPROJECTION_COUNTRY_HEALTHCARE_MESSAGE" hint="COM_COSTBENEFITPROJECTION_COUNTRY_HEALTHCARE_HINT" /> -
- + +
@@ -932,5 +930,5 @@ component="com_costbenefitprojection" section="country" /> -
+ \ No newline at end of file diff --git a/admin/models/forms/currency.xml b/admin/models/forms/currency.xml index 5cff5c3a..4966e1c1 100644 --- a/admin/models/forms/currency.xml +++ b/admin/models/forms/currency.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -102,8 +102,6 @@ maxlength="150" description="COM_COSTBENEFITPROJECTION_CURRENCY_NAME_DESCRIPTION" class="text_area" - readonly="false" - disabled="false" required="true" filter="STRING" message="COM_COSTBENEFITPROJECTION_CURRENCY_NAME_MESSAGE" @@ -234,8 +232,8 @@ message="COM_COSTBENEFITPROJECTION_CURRENCY_THOUSANDS_MESSAGE" hint="COM_COSTBENEFITPROJECTION_CURRENCY_THOUSANDS_HINT" /> -
- + +
@@ -256,5 +254,5 @@ component="com_costbenefitprojection" section="currency" /> -
+ \ No newline at end of file diff --git a/admin/models/forms/health_data.xml b/admin/models/forms/health_data.xml index fd924daf..1bee4af9 100644 --- a/admin/models/forms/health_data.xml +++ b/admin/models/forms/health_data.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -413,8 +413,8 @@
- - + +
@@ -435,5 +435,5 @@ component="com_costbenefitprojection" section="health_data" /> -
+ \ No newline at end of file diff --git a/admin/models/forms/help_document.xml b/admin/models/forms/help_document.xml index ef15c360..9916759b 100644 --- a/admin/models/forms/help_document.xml +++ b/admin/models/forms/help_document.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -228,8 +228,8 @@ -
- + +
@@ -250,5 +250,5 @@ component="com_costbenefitprojection" section="help_document" /> -
+ \ No newline at end of file diff --git a/admin/models/forms/intervention.xml b/admin/models/forms/intervention.xml index e3121ba6..e15d367a 100644 --- a/admin/models/forms/intervention.xml +++ b/admin/models/forms/intervention.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -285,8 +285,8 @@ default="0" required="true" /> -
- + +
@@ -307,5 +307,5 @@ component="com_costbenefitprojection" section="intervention" /> -
+ \ No newline at end of file diff --git a/admin/models/forms/scaling_factor.xml b/admin/models/forms/scaling_factor.xml index a25aae0e..f1db2024 100644 --- a/admin/models/forms/scaling_factor.xml +++ b/admin/models/forms/scaling_factor.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -247,8 +247,8 @@ default="0" required="true" /> -
- + +
@@ -269,5 +269,5 @@ component="com_costbenefitprojection" section="scaling_factor" /> -
+ \ No newline at end of file diff --git a/admin/models/forms/service_provider.xml b/admin/models/forms/service_provider.xml index 363e8377..280777fd 100644 --- a/admin/models/forms/service_provider.xml +++ b/admin/models/forms/service_provider.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -169,8 +169,8 @@ /> -
- + +
@@ -191,5 +191,5 @@ component="com_costbenefitprojection" section="service_provider" /> -
+ \ No newline at end of file diff --git a/admin/models/health_data.php b/admin/models/health_data.php index 7b6f824b..ef2edb6a 100644 --- a/admin/models/health_data.php +++ b/admin/models/health_data.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage health_data.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Health_data Model - */ -class CostbenefitprojectionModelHealth_data extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Health_data Model + */ +class CostbenefitprojectionModelHealth_data extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -52,94 +52,88 @@ class CostbenefitprojectionModelHealth_data extends JModelAdmin 'country' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.health_data'; - - /** - * 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_data', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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_costbenefitprojection.health_data'); - } - } - - 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 + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.health_data'; + + /** + * 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_data', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + } + } + + 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; @@ -363,29 +357,29 @@ class CostbenefitprojectionModelHealth_data extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/health_data.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) + 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_costbenefitprojection/js/health_data.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)) { @@ -398,19 +392,19 @@ class CostbenefitprojectionModelHealth_data extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('health_data.delete', 'com_costbenefitprojection.health_data.' . (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) + 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; @@ -425,104 +419,104 @@ class CostbenefitprojectionModelHealth_data extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('health_data.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('health_data.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('health_data.edit', 'com_costbenefitprojection.health_data.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('health_data.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_health_data')); - $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_costbenefitprojection.edit.health_data.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.health_data', $data); - } - - return $data; + return $user->authorise('health_data.edit', 'com_costbenefitprojection.health_data.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('health_data.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_health_data')); + $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_costbenefitprojection.edit.health_data.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.health_data', $data); + } + + return $data; } /** @@ -535,141 +529,141 @@ class CostbenefitprojectionModelHealth_data extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('health_data'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('health_data'); + $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; } /** @@ -983,38 +977,38 @@ class CostbenefitprojectionModelHealth_data extends JModelAdmin $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; + } + + /** + * 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 @@ -1029,37 +1023,37 @@ class CostbenefitprojectionModelHealth_data extends JModelAdmin $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; + } + + 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; } /** @@ -1082,5 +1076,5 @@ class CostbenefitprojectionModelHealth_data extends JModelAdmin } return $title; - } -} + } +} diff --git a/admin/models/health_data_sets.php b/admin/models/health_data_sets.php index 38e1cc7b..c6db5b70 100644 --- a/admin/models/health_data_sets.php +++ b/admin/models/health_data_sets.php @@ -1,37 +1,37 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Health_data_sets Model - */ -class CostbenefitprojectionModelHealth_data_sets extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage health_data_sets.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Health_data_sets Model + */ +class CostbenefitprojectionModelHealth_data_sets 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', @@ -40,11 +40,11 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList 'a.modified_by','modified_by', 'g.name','causerisk', 'a.year','year', - 'h.name','country' - ); - } - - parent::__construct($config); + 'h.name','country' + ); + } + + parent::__construct($config); } @@ -65,27 +65,27 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList } jexit('Database Error: ' . $e->getMessage()); } - } - - /** - * 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; + } + + /** + * 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; } $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); @@ -113,23 +113,23 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList $this->setState('filter.year', $year); $country = $this->getUserStateFromRequest($this->context . '.filter.country', 'filter_country'); - $this->setState('filter.country', $country); - - // 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() + $this->setState('filter.country', $country); + + // 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 + // Check in items $this->checkInNow(); - - // load parent items + + // load parent items $items = parent::getItems(); // Set values to display correctly. @@ -162,10 +162,10 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList $item->year = $this->selectionTranslation($item->year, 'year'); } } - - - // return items - return $items; + + + // return items + return $items; } /** @@ -203,15 +203,15 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList } } return $value; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { + } + + /** + * 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. @@ -358,7 +358,7 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList $query->order($db->escape($orderCol . ' ' . $orderDirn)); } - return $query; + return $query; } /** @@ -499,16 +499,16 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList return $headers; } return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { + } + + /** + * 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'); @@ -519,9 +519,9 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList $id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.causerisk'); $id .= ':' . $this->getState('filter.year'); - $id .= ':' . $this->getState('filter.country'); - - return parent::getStoreId($id); + $id .= ':' . $this->getState('filter.country'); + + return parent::getStoreId($id); } /** @@ -540,17 +540,19 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__costbenefitprojection_health_data')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -565,7 +567,7 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__costbenefitprojection_health_data'))->set($fields)->where($conditions); $db->setQuery($query); @@ -575,5 +577,5 @@ class CostbenefitprojectionModelHealth_data_sets extends JModelList } return false; - } -} + } +} diff --git a/admin/models/help_document.php b/admin/models/help_document.php index 488412f1..45d8dd2f 100644 --- a/admin/models/help_document.php +++ b/admin/models/help_document.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage help_document.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Help_document Model - */ -class CostbenefitprojectionModelHelp_document extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Help_document Model + */ +class CostbenefitprojectionModelHelp_document extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -59,100 +59,94 @@ class CostbenefitprojectionModelHelp_document extends JModelAdmin 'not_required' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.help_document'; - - /** - * 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 = 'help_document', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.help_document'; + + /** + * 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 = 'help_document', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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->groups)) { // JSON Decode groups. $item->groups = json_decode($item->groups,true); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_costbenefitprojection.help_document'); - } - } - - 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 + } + } + + 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; @@ -245,29 +239,29 @@ class CostbenefitprojectionModelHelp_document extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/help_document.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) + 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_costbenefitprojection/js/help_document.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)) { @@ -280,19 +274,19 @@ class CostbenefitprojectionModelHelp_document extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('help_document.delete', 'com_costbenefitprojection.help_document.' . (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) + 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; @@ -307,104 +301,104 @@ class CostbenefitprojectionModelHelp_document extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('help_document.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('help_document.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('help_document.edit', 'com_costbenefitprojection.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_help_document')); - $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_costbenefitprojection.edit.help_document.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.help_document', $data); - } - - return $data; + return $user->authorise('help_document.edit', 'com_costbenefitprojection.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_help_document')); + $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_costbenefitprojection.edit.help_document.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.help_document', $data); + } + + return $data; } /** @@ -453,141 +447,141 @@ class CostbenefitprojectionModelHelp_document extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('help_document'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('help_document'); + $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; } /** @@ -834,44 +828,44 @@ class CostbenefitprojectionModelHelp_document extends JModelAdmin $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; + } + + /** + * 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 groups string to JSON string. if (isset($data['groups'])) { $data['groups'] = (string) json_encode($data['groups']); - } - - // 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; + } + + // 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 title for save as copy @@ -939,37 +933,37 @@ class CostbenefitprojectionModelHelp_document extends JModelAdmin $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; + } + + 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; } /** @@ -1017,5 +1011,5 @@ class CostbenefitprojectionModelHelp_document extends JModelAdmin } // We only had an alias return $alias; - } -} + } +} diff --git a/admin/models/help_documents.php b/admin/models/help_documents.php index 71a843f4..85adaad9 100644 --- a/admin/models/help_documents.php +++ b/admin/models/help_documents.php @@ -1,37 +1,37 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Help_documents Model - */ -class CostbenefitprojectionModelHelp_documents extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage help_documents.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Help_documents Model + */ +class CostbenefitprojectionModelHelp_documents extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( 'a.id','id', 'a.published','published', 'a.ordering','ordering', @@ -41,32 +41,32 @@ class CostbenefitprojectionModelHelp_documents extends JModelList 'a.location','location', 'a.admin_view','admin_view', 'a.site_view','site_view', - 'a.title','title' - ); - } - - 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; + 'a.title','title' + ); + } + + 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; } $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); @@ -100,23 +100,23 @@ class CostbenefitprojectionModelHelp_documents extends JModelList $this->setState('filter.site_view', $site_view); $title = $this->getUserStateFromRequest($this->context . '.filter.title', 'filter_title'); - $this->setState('filter.title', $title); - - // 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() + $this->setState('filter.title', $title); + + // 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 + // Check in items $this->checkInNow(); - - // load parent items + + // load parent items $items = parent::getItems(); // Set values to display correctly. @@ -162,10 +162,10 @@ class CostbenefitprojectionModelHelp_documents extends JModelList $item->location = $this->selectionTranslation($item->location, 'location'); } } - - - // return items - return $items; + + + // return items + return $items; } /** @@ -204,15 +204,15 @@ class CostbenefitprojectionModelHelp_documents extends JModelList } } return $value; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { + } + + /** + * 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. @@ -327,7 +327,7 @@ class CostbenefitprojectionModelHelp_documents extends JModelList $query->order($db->escape($orderCol . ' ' . $orderDirn)); } - return $query; + return $query; } /** @@ -444,16 +444,16 @@ class CostbenefitprojectionModelHelp_documents extends JModelList return $headers; } return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { + } + + /** + * 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'); @@ -465,9 +465,9 @@ class CostbenefitprojectionModelHelp_documents extends JModelList $id .= ':' . $this->getState('filter.location'); $id .= ':' . $this->getState('filter.admin_view'); $id .= ':' . $this->getState('filter.site_view'); - $id .= ':' . $this->getState('filter.title'); - - return parent::getStoreId($id); + $id .= ':' . $this->getState('filter.title'); + + return parent::getStoreId($id); } /** @@ -486,17 +486,19 @@ class CostbenefitprojectionModelHelp_documents extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__costbenefitprojection_help_document')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -511,7 +513,7 @@ class CostbenefitprojectionModelHelp_documents extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__costbenefitprojection_help_document'))->set($fields)->where($conditions); $db->setQuery($query); @@ -521,5 +523,5 @@ class CostbenefitprojectionModelHelp_documents extends JModelList } return false; - } -} + } +} diff --git a/admin/models/import.php b/admin/models/import.php index 8b3c56a6..cb3b9d6e 100644 --- a/admin/models/import.php +++ b/admin/models/import.php @@ -1,371 +1,373 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; -use PhpOffice\PhpSpreadsheet\IOFactory; - -/** - * Costbenefitprojection Import Model - */ -class CostbenefitprojectionModelImport 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_costbenefitprojection.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_costbenefitprojection.message')); - $app->setUserState('com_costbenefitprojection.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_costbenefitprojection.message', JText::_('COM_COSTBENEFITPROJECTION_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_costbenefitprojection.message', JText::_('COM_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_IMPORT_ERROR'); - $back = $session->get('backto_VDM_IMPORT', NULL); - if ($back) - { - $app->setUserState('com_costbenefitprojection.redirect_url', 'index.php?option=com_costbenefitprojection&view='.$back); - $session->clear('backto_VDM_IMPORT'); - } - $result = false; - } - else - { - // Package imported sucessfully - $msg = JText::sprintf('COM_COSTBENEFITPROJECTION_IMPORT_SUCCESS', $package['packagename']); - $back = $session->get('backto_VDM_IMPORT', NULL); - if ($back) - { - $app->setUserState('com_costbenefitprojection.redirect_url', 'index.php?option=com_costbenefitprojection&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_COSTBENEFITPROJECTION_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); - return false; - } - - // If there is no uploaded file, we have a problem... - if (!is_array($userfile)) - { - $app->enqueueMessage(JText::_('COM_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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 = JFile::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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage import.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; +use Joomla\Utilities\ArrayHelper; +use PhpOffice\PhpSpreadsheet\IOFactory; + +/** + * Costbenefitprojection Import Model + */ +class CostbenefitprojectionModelImport 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_costbenefitprojection.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_costbenefitprojection.message')); + $app->setUserState('com_costbenefitprojection.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_costbenefitprojection.message', JText::_('COM_COSTBENEFITPROJECTION_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_costbenefitprojection.message', JText::_('COM_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_IMPORT_ERROR'); + $back = $session->get('backto_VDM_IMPORT', NULL); + if ($back) + { + $app->setUserState('com_costbenefitprojection.redirect_url', 'index.php?option=com_costbenefitprojection&view='.$back); + $session->clear('backto_VDM_IMPORT'); + } + $result = false; + } + else + { + // Package imported sucessfully + $msg = JText::sprintf('COM_COSTBENEFITPROJECTION_IMPORT_SUCCESS', $package['packagename']); + $back = $session->get('backto_VDM_IMPORT', NULL); + if ($back) + { + $app->setUserState('com_costbenefitprojection.redirect_url', 'index.php?option=com_costbenefitprojection&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_COSTBENEFITPROJECTION_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + return false; + } + + // If there is no uploaded file, we have a problem... + if (!is_array($userfile)) + { + $app->enqueueMessage(JText::_('COM_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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; } /** @@ -388,33 +390,33 @@ class CostbenefitprojectionModelImport extends JModelLegacy 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)) - { - JFile::delete($package); - } - elseif (is_file(JPath::clean($package))) - { - // It might also be just a base filename - JFile::delete(JPath::clean($package)); - } + } + + /** + * 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)); + } } /** @@ -678,70 +680,70 @@ class CostbenefitprojectionModelImport extends JModelLegacy } } 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('#__costbenefitprojection_'.$table); - if(isset($columns['alias'])){ - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array('alias'))); - $query->from($db->quoteName('#__costbenefitprojection_'.$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; - } -} + } + + 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('#__costbenefitprojection_'.$table); + if(isset($columns['alias'])){ + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array('alias'))); + $query->from($db->quoteName('#__costbenefitprojection_'.$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/import_health_data_sets.php b/admin/models/import_health_data_sets.php index c65af1e2..6980d116 100644 --- a/admin/models/import_health_data_sets.php +++ b/admin/models/import_health_data_sets.php @@ -1,81 +1,83 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; -use PhpOffice\PhpSpreadsheet\IOFactory; - -/** - * Costbenefitprojection Import_health_data_sets Model - */ -class CostbenefitprojectionModelImport_health_data_sets 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_costbenefitprojection.import_health_data_sets'; - - /** - * 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_costbenefitprojection.message')); - $app->setUserState('com_costbenefitprojection.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(); - } +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage import_health_data_sets.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; +use Joomla\Utilities\ArrayHelper; +use PhpOffice\PhpSpreadsheet\IOFactory; + +/** + * Costbenefitprojection Import_health_data_sets Model + */ +class CostbenefitprojectionModelImport_health_data_sets 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_costbenefitprojection.import_health_data_sets'; + + /** + * 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_costbenefitprojection.message')); + $app->setUserState('com_costbenefitprojection.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. @@ -184,187 +186,186 @@ class CostbenefitprojectionModelImport_health_data_sets extends JModelLegacy $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_COSTBENEFITPROJECTION_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); - return false; - } - - // If there is no uploaded file, we have a problem... - if (!is_array($userfile)) - { - $app->enqueueMessage(JText::_('COM_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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 = JFile::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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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; - } + } + + /** + * 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_COSTBENEFITPROJECTION_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + return false; + } + + // If there is no uploaded file, we have a problem... + if (!is_array($userfile)) + { + $app->enqueueMessage(JText::_('COM_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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 + $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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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_COSTBENEFITPROJECTION_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 @@ -386,34 +387,34 @@ class CostbenefitprojectionModelImport_health_data_sets extends JModelLegacy 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)) - { - JFile::delete($package); - } - elseif (is_file(JPath::clean($package))) - { - // It might also be just a base filename - JFile::delete(JPath::clean($package)); - } - } + } + + /** + * 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 @@ -684,7 +685,7 @@ class CostbenefitprojectionModelImport_health_data_sets extends JModelLegacy } } return $found; - } + } /** * Save the data from the file to the database @@ -1043,70 +1044,70 @@ class CostbenefitprojectionModelImport_health_data_sets extends JModelLegacy } } 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('#__costbenefitprojection_'.$table); - if(isset($columns['alias'])){ - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array('alias'))); - $query->from($db->quoteName('#__costbenefitprojection_'.$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; - } -} + } + + 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('#__costbenefitprojection_'.$table); + if(isset($columns['alias'])){ + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array('alias'))); + $query->from($db->quoteName('#__costbenefitprojection_'.$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/intervention.php b/admin/models/intervention.php index 9bd469d4..c6f760bf 100644 --- a/admin/models/intervention.php +++ b/admin/models/intervention.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage intervention.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Intervention Model - */ -class CostbenefitprojectionModelIntervention extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Intervention Model + */ +class CostbenefitprojectionModelIntervention extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'fullwidth' => array( @@ -61,100 +61,94 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin 'intervention' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.intervention'; - - /** - * 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 = 'intervention', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.intervention'; + + /** + * 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 = 'intervention', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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->interventions)) { // JSON Decode interventions. $item->interventions = json_decode($item->interventions); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_costbenefitprojection.intervention'); - } - } - - 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 + } + } + + 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; @@ -247,29 +241,29 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/intervention.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) + 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_costbenefitprojection/js/intervention.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)) { @@ -282,19 +276,19 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('intervention.delete', 'com_costbenefitprojection.intervention.' . (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) + 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; @@ -309,104 +303,104 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('intervention.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('intervention.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('intervention.edit', 'com_costbenefitprojection.intervention.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('intervention.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_intervention')); - $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_costbenefitprojection.edit.intervention.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.intervention', $data); - } - - return $data; + return $user->authorise('intervention.edit', 'com_costbenefitprojection.intervention.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('intervention.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_intervention')); + $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_costbenefitprojection.edit.intervention.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.intervention', $data); + } + + return $data; } /** @@ -455,141 +449,141 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('intervention'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('intervention'); + $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; } /** @@ -929,44 +923,44 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin $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; + } + + /** + * 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 interventions string to JSON string. if (isset($data['interventions'])) { $data['interventions'] = (string) json_encode($data['interventions']); - } - - // 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; + } + + // 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 @@ -981,37 +975,37 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin $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; + } + + 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; } /** @@ -1034,5 +1028,5 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin } return $title; - } -} + } +} diff --git a/admin/models/interventions.php b/admin/models/interventions.php index 91fdf5d9..3f03f472 100644 --- a/admin/models/interventions.php +++ b/admin/models/interventions.php @@ -1,37 +1,37 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Interventions Model - */ -class CostbenefitprojectionModelInterventions extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage interventions.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Interventions Model + */ +class CostbenefitprojectionModelInterventions extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( 'a.id','id', 'a.published','published', 'a.ordering','ordering', @@ -42,32 +42,32 @@ class CostbenefitprojectionModelInterventions extends JModelList 'a.coverage','coverage', 'a.duration','duration', '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; + '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; } $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); @@ -104,23 +104,23 @@ class CostbenefitprojectionModelInterventions extends JModelList $this->setState('filter.name', $name); $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_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() + $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 + // Check in items $this->checkInNow(); - - // load parent items + + // load parent items $items = parent::getItems(); // Set values to display correctly. @@ -166,10 +166,10 @@ class CostbenefitprojectionModelInterventions extends JModelList $item->type = $this->selectionTranslation($item->type, 'type'); } } - - - // return items - return $items; + + + // return items + return $items; } /** @@ -193,15 +193,15 @@ class CostbenefitprojectionModelInterventions extends JModelList } } return $value; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { + } + + /** + * 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. @@ -337,7 +337,7 @@ class CostbenefitprojectionModelInterventions extends JModelList $query->order($db->escape($orderCol . ' ' . $orderDirn)); } - return $query; + return $query; } /** @@ -484,16 +484,16 @@ class CostbenefitprojectionModelInterventions extends JModelList return $headers; } return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { + } + + /** + * 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'); @@ -506,9 +506,9 @@ class CostbenefitprojectionModelInterventions extends JModelList $id .= ':' . $this->getState('filter.coverage'); $id .= ':' . $this->getState('filter.duration'); $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.description'); - - return parent::getStoreId($id); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); } /** @@ -527,17 +527,19 @@ class CostbenefitprojectionModelInterventions extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__costbenefitprojection_intervention')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -552,7 +554,7 @@ class CostbenefitprojectionModelInterventions extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__costbenefitprojection_intervention'))->set($fields)->where($conditions); $db->setQuery($query); @@ -562,5 +564,5 @@ class CostbenefitprojectionModelInterventions extends JModelList } return false; - } -} + } +} diff --git a/admin/models/scaling_factor.php b/admin/models/scaling_factor.php index 65065dd2..ad8a0005 100644 --- a/admin/models/scaling_factor.php +++ b/admin/models/scaling_factor.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factor.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Scaling_factor Model - */ -class CostbenefitprojectionModelScaling_factor extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Scaling_factor Model + */ +class CostbenefitprojectionModelScaling_factor extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -54,94 +54,88 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin 'country' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.scaling_factor'; - - /** - * 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 = 'scaling_factor', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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_costbenefitprojection.scaling_factor'); - } - } - - 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 + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.scaling_factor'; + + /** + * 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 = 'scaling_factor', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + } + } + + 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; @@ -234,29 +228,29 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/scaling_factor.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) + 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_costbenefitprojection/js/scaling_factor.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)) { @@ -269,19 +263,19 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('scaling_factor.delete', 'com_costbenefitprojection.scaling_factor.' . (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) + 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; @@ -296,104 +290,104 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('scaling_factor.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('scaling_factor.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('scaling_factor.edit', 'com_costbenefitprojection.scaling_factor.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('scaling_factor.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_scaling_factor')); - $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_costbenefitprojection.edit.scaling_factor.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.scaling_factor', $data); - } - - return $data; + return $user->authorise('scaling_factor.edit', 'com_costbenefitprojection.scaling_factor.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('scaling_factor.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_scaling_factor')); + $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_costbenefitprojection.edit.scaling_factor.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.scaling_factor', $data); + } + + return $data; } /** @@ -442,141 +436,141 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('scaling_factor'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('scaling_factor'); + $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; } /** @@ -888,38 +882,38 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin $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; + } + + /** + * 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 @@ -934,37 +928,37 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin $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; + } + + 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; } /** @@ -987,5 +981,5 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin } return $title; - } -} + } +} diff --git a/admin/models/scaling_factors.php b/admin/models/scaling_factors.php index 7444b7b9..c7a832a4 100644 --- a/admin/models/scaling_factors.php +++ b/admin/models/scaling_factors.php @@ -1,37 +1,37 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Scaling_factors Model - */ -class CostbenefitprojectionModelScaling_factors extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factors.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Scaling_factors Model + */ +class CostbenefitprojectionModelScaling_factors extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( 'a.id','id', 'a.published','published', 'a.ordering','ordering', @@ -44,32 +44,32 @@ class CostbenefitprojectionModelScaling_factors extends JModelList 'a.mortality_scaling_factor_males','mortality_scaling_factor_males', 'a.mortality_scaling_factor_females','mortality_scaling_factor_females', 'a.presenteeism_scaling_factor_males','presenteeism_scaling_factor_males', - 'a.presenteeism_scaling_factor_females','presenteeism_scaling_factor_females' - ); - } - - 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; + 'a.presenteeism_scaling_factor_females','presenteeism_scaling_factor_females' + ); + } + + 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; } $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); @@ -112,23 +112,23 @@ class CostbenefitprojectionModelScaling_factors extends JModelList $this->setState('filter.presenteeism_scaling_factor_males', $presenteeism_scaling_factor_males); $presenteeism_scaling_factor_females = $this->getUserStateFromRequest($this->context . '.filter.presenteeism_scaling_factor_females', 'filter_presenteeism_scaling_factor_females'); - $this->setState('filter.presenteeism_scaling_factor_females', $presenteeism_scaling_factor_females); - - // 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() + $this->setState('filter.presenteeism_scaling_factor_females', $presenteeism_scaling_factor_females); + + // 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 + // Check in items $this->checkInNow(); - - // load parent items + + // load parent items $items = parent::getItems(); // Set values to display correctly. @@ -150,19 +150,19 @@ class CostbenefitprojectionModelScaling_factors extends JModelList } } - } - - // return items - return $items; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { + } + + // 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. @@ -268,7 +268,7 @@ class CostbenefitprojectionModelScaling_factors extends JModelList $query->order($db->escape($orderCol . ' ' . $orderDirn)); } - return $query; + return $query; } /** @@ -402,16 +402,16 @@ class CostbenefitprojectionModelScaling_factors extends JModelList return $headers; } return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { + } + + /** + * 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'); @@ -426,9 +426,9 @@ class CostbenefitprojectionModelScaling_factors extends JModelList $id .= ':' . $this->getState('filter.mortality_scaling_factor_males'); $id .= ':' . $this->getState('filter.mortality_scaling_factor_females'); $id .= ':' . $this->getState('filter.presenteeism_scaling_factor_males'); - $id .= ':' . $this->getState('filter.presenteeism_scaling_factor_females'); - - return parent::getStoreId($id); + $id .= ':' . $this->getState('filter.presenteeism_scaling_factor_females'); + + return parent::getStoreId($id); } /** @@ -447,17 +447,19 @@ class CostbenefitprojectionModelScaling_factors extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__costbenefitprojection_scaling_factor')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -472,7 +474,7 @@ class CostbenefitprojectionModelScaling_factors extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__costbenefitprojection_scaling_factor'))->set($fields)->where($conditions); $db->setQuery($query); @@ -482,5 +484,5 @@ class CostbenefitprojectionModelScaling_factors extends JModelList } return false; - } -} + } +} diff --git a/admin/models/service_provider.php b/admin/models/service_provider.php index 86d3faa6..20d1d56b 100644 --- a/admin/models/service_provider.php +++ b/admin/models/service_provider.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage service_provider.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Service_provider Model - */ -class CostbenefitprojectionModelService_provider extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Service_provider Model + */ +class CostbenefitprojectionModelService_provider extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -51,85 +51,79 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin 'country' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.service_provider'; - - /** - * 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 = 'service_provider', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.service_provider'; + + /** + * 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 = 'service_provider', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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->testcompanies)) { // JSON Decode testcompanies. $item->testcompanies = json_decode($item->testcompanies); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_costbenefitprojection.service_provider'); - } + } } - $this->service_providervvvx = $item->id; - - return $item; + $this->service_providervvvx = $item->id; + + return $item; } /** @@ -301,22 +295,22 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin } } return $value; - } - - /** - * 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 + } + + /** + * 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; @@ -409,29 +403,29 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/service_provider.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) + 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_costbenefitprojection/js/service_provider.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)) { @@ -444,19 +438,19 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('service_provider.delete', 'com_costbenefitprojection.service_provider.' . (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) + 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; @@ -471,104 +465,104 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('service_provider.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('service_provider.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('service_provider.edit', 'com_costbenefitprojection.service_provider.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('service_provider.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_service_provider')); - $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_costbenefitprojection.edit.service_provider.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.service_provider', $data); - } - - return $data; + return $user->authorise('service_provider.edit', 'com_costbenefitprojection.service_provider.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('service_provider.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_service_provider')); + $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_costbenefitprojection.edit.service_provider.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.service_provider', $data); + } + + return $data; } /** @@ -581,141 +575,141 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('service_provider'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('service_provider'); + $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; } /** @@ -1020,30 +1014,30 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin $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; + } + + /** + * 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 testcompanies item to data @@ -1056,14 +1050,14 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin if (isset($data['testcompanies'])) { $data['testcompanies'] = (string) json_encode($data['testcompanies']); - } - - // 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; + } + + // 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 @@ -1078,37 +1072,37 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin $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; + } + + 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; } /** @@ -1131,5 +1125,5 @@ class CostbenefitprojectionModelService_provider extends JModelAdmin } return $title; - } -} + } +} diff --git a/admin/models/service_providers.php b/admin/models/service_providers.php index 58628114..ee239987 100644 --- a/admin/models/service_providers.php +++ b/admin/models/service_providers.php @@ -1,37 +1,37 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Service_providers Model - */ -class CostbenefitprojectionModelService_providers extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage service_providers.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Service_providers Model + */ +class CostbenefitprojectionModelService_providers extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( 'a.id','id', 'a.published','published', 'a.ordering','ordering', @@ -41,32 +41,32 @@ class CostbenefitprojectionModelService_providers extends JModelList 'g.name','user', 'a.publicname','publicname', 'a.publicemail','publicemail', - 'a.publicnumber','publicnumber' - ); - } - - 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; + 'a.publicnumber','publicnumber' + ); + } + + 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; } $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); @@ -100,23 +100,23 @@ class CostbenefitprojectionModelService_providers extends JModelList $this->setState('filter.publicemail', $publicemail); $publicnumber = $this->getUserStateFromRequest($this->context . '.filter.publicnumber', 'filter_publicnumber'); - $this->setState('filter.publicnumber', $publicnumber); - - // 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() + $this->setState('filter.publicnumber', $publicnumber); + + // 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 + // Check in items $this->checkInNow(); - - // load parent items + + // load parent items $items = parent::getItems(); // Set values to display correctly. @@ -138,19 +138,19 @@ class CostbenefitprojectionModelService_providers extends JModelList } } - } - - // return items - return $items; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { + } + + // 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. @@ -239,7 +239,7 @@ class CostbenefitprojectionModelService_providers extends JModelList $query->order($db->escape($orderCol . ' ' . $orderDirn)); } - return $query; + return $query; } /** @@ -373,16 +373,16 @@ class CostbenefitprojectionModelService_providers extends JModelList return $headers; } return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { + } + + /** + * 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'); @@ -394,9 +394,9 @@ class CostbenefitprojectionModelService_providers extends JModelList $id .= ':' . $this->getState('filter.user'); $id .= ':' . $this->getState('filter.publicname'); $id .= ':' . $this->getState('filter.publicemail'); - $id .= ':' . $this->getState('filter.publicnumber'); - - return parent::getStoreId($id); + $id .= ':' . $this->getState('filter.publicnumber'); + + return parent::getStoreId($id); } /** @@ -415,17 +415,19 @@ class CostbenefitprojectionModelService_providers extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__costbenefitprojection_service_provider')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -440,7 +442,7 @@ class CostbenefitprojectionModelService_providers extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__costbenefitprojection_service_provider'))->set($fields)->where($conditions); $db->setQuery($query); @@ -450,5 +452,5 @@ class CostbenefitprojectionModelService_providers extends JModelList } return false; - } -} + } +} diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 655637de..a3ad3516 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS `#__costbenefitprojection_company` ( `turnover_comment` TEXT NOT NULL, `user` INT(11) NOT NULL DEFAULT 0, `working_days` INT(11) NOT NULL DEFAULT 0, - `params` text NOT NULL, + `params` text 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, @@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS `#__costbenefitprojection_service_provider` ( `publicnumber` VARCHAR(64) NOT NULL DEFAULT '', `testcompanies` TEXT NOT NULL, `user` INT(11) NOT NULL DEFAULT 0, - `params` text NOT NULL, + `params` text 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, @@ -111,7 +111,7 @@ CREATE TABLE IF NOT EXISTS `#__costbenefitprojection_country` ( `user` INT(11) NOT NULL DEFAULT 0, `working_days` INT(11) NOT NULL DEFAULT 0, `worldzone` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NOT NULL, + `params` text 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, @@ -150,7 +150,7 @@ CREATE TABLE IF NOT EXISTS `#__costbenefitprojection_causerisk` ( `importname` VARCHAR(255) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', `ref` VARCHAR(64) NOT NULL DEFAULT '', - `params` text NOT NULL, + `params` text 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, @@ -185,7 +185,7 @@ CREATE TABLE IF NOT EXISTS `#__costbenefitprojection_health_data` ( `maledeath` TEXT NOT NULL, `maleyld` TEXT NOT NULL, `year` CHAR(7) NOT NULL DEFAULT '', - `params` text NOT NULL, + `params` text 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, @@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS `#__costbenefitprojection_scaling_factor` ( `reference` VARCHAR(255) NOT NULL DEFAULT '', `yld_scaling_factor_females` CHAR(7) NOT NULL DEFAULT 1, `yld_scaling_factor_males` CHAR(7) NOT NULL DEFAULT 1, - `params` text NOT NULL, + `params` text 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, @@ -258,7 +258,7 @@ CREATE TABLE IF NOT EXISTS `#__costbenefitprojection_intervention` ( `reference` VARCHAR(255) NOT NULL DEFAULT '', `share` TINYINT(1) NOT NULL DEFAULT 0, `type` TINYINT(1) NOT NULL DEFAULT 0, - `params` text NOT NULL, + `params` text 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, @@ -296,7 +296,7 @@ CREATE TABLE IF NOT EXISTS `#__costbenefitprojection_currency` ( `positivestyle` VARCHAR(255) NOT NULL DEFAULT '', `symbol` CHAR(11) NOT NULL DEFAULT '', `thousands` CHAR(7) NOT NULL DEFAULT '', - `params` text NOT NULL, + `params` text 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, @@ -334,7 +334,7 @@ CREATE TABLE IF NOT EXISTS `#__costbenefitprojection_help_document` ( `title` CHAR(64) NOT NULL DEFAULT '', `type` TINYINT(1) NOT NULL DEFAULT 0, `url` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NOT NULL, + `params` text 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, diff --git a/admin/sql/updates/mysql/1.0.0.sql b/admin/sql/updates/mysql/1.0.0.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/1.0.0.sql +++ b/admin/sql/updates/mysql/1.0.0.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.1.0.sql b/admin/sql/updates/mysql/3.1.0.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.1.0.sql +++ b/admin/sql/updates/mysql/3.1.0.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.2.0.sql b/admin/sql/updates/mysql/3.2.0.sql index 4525e70f..3d597f22 100644 --- a/admin/sql/updates/mysql/3.2.0.sql +++ b/admin/sql/updates/mysql/3.2.0.sql @@ -1,4 +1,4 @@ ALTER TABLE `#__costbenefitprojection_intervention` ADD `country` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `#__costbenefitprojection_scaling_factor` -ADD `country` INT(11) NOT NULL DEFAULT '0'; +ADD `country` INT(11) NOT NULL DEFAULT '0'; diff --git a/admin/sql/updates/mysql/3.3.0.sql b/admin/sql/updates/mysql/3.3.0.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.3.0.sql +++ b/admin/sql/updates/mysql/3.3.0.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.3.10.sql b/admin/sql/updates/mysql/3.3.10.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.3.10.sql +++ b/admin/sql/updates/mysql/3.3.10.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.3.11.sql b/admin/sql/updates/mysql/3.3.11.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.3.11.sql +++ b/admin/sql/updates/mysql/3.3.11.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.3.12.sql b/admin/sql/updates/mysql/3.3.12.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.3.12.sql +++ b/admin/sql/updates/mysql/3.3.12.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.3.2.sql b/admin/sql/updates/mysql/3.3.2.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.3.2.sql +++ b/admin/sql/updates/mysql/3.3.2.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.3.3.sql b/admin/sql/updates/mysql/3.3.3.sql index 98547d4c..a3039a9f 100644 --- a/admin/sql/updates/mysql/3.3.3.sql +++ b/admin/sql/updates/mysql/3.3.3.sql @@ -1 +1 @@ -ALTER TABLE `#__costbenefitprojection_company` CHANGE `serviceprovider` `service_provider` INT( 11 ) NOT NULL DEFAULT '0'; +ALTER TABLE `#__costbenefitprojection_company` CHANGE `serviceprovider` `service_provider` INT( 11 ) NOT NULL DEFAULT '0'; diff --git a/admin/sql/updates/mysql/3.3.4.sql b/admin/sql/updates/mysql/3.3.4.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.3.4.sql +++ b/admin/sql/updates/mysql/3.3.4.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.3.5.sql b/admin/sql/updates/mysql/3.3.5.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.3.5.sql +++ b/admin/sql/updates/mysql/3.3.5.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.3.6.sql b/admin/sql/updates/mysql/3.3.6.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.3.6.sql +++ b/admin/sql/updates/mysql/3.3.6.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.3.7.sql b/admin/sql/updates/mysql/3.3.7.sql index a85ef200..f1b3d45e 100644 --- a/admin/sql/updates/mysql/3.3.7.sql +++ b/admin/sql/updates/mysql/3.3.7.sql @@ -1,2 +1,2 @@ ALTER TABLE `#__costbenefitprojection_company` -ADD `turnover_comment` TEXT NOT NULL DEFAULT ''; +ADD `turnover_comment` TEXT NOT NULL DEFAULT ''; diff --git a/admin/sql/updates/mysql/3.3.8.sql b/admin/sql/updates/mysql/3.3.8.sql index 70f88768..fc373b5f 100644 --- a/admin/sql/updates/mysql/3.3.8.sql +++ b/admin/sql/updates/mysql/3.3.8.sql @@ -1,2 +1,2 @@ ALTER TABLE `#__costbenefitprojection_company` -ADD `mode` TINYINT(1) NOT NULL DEFAULT '1'; +ADD `mode` TINYINT(1) NOT NULL DEFAULT '1'; diff --git a/admin/sql/updates/mysql/3.3.9.sql b/admin/sql/updates/mysql/3.3.9.sql index 83152204..54ee2fb2 100644 --- a/admin/sql/updates/mysql/3.3.9.sql +++ b/admin/sql/updates/mysql/3.3.9.sql @@ -1 +1 @@ -ALTER TABLE `#__costbenefitprojection_service_provider` ADD `testcompanies` TEXT NOT NULL; +ALTER TABLE `#__costbenefitprojection_service_provider` ADD `testcompanies` TEXT NOT NULL; diff --git a/admin/sql/updates/mysql/3.4.0.sql b/admin/sql/updates/mysql/3.4.0.sql index b7e3dd02..dca8a146 100644 --- a/admin/sql/updates/mysql/3.4.0.sql +++ b/admin/sql/updates/mysql/3.4.0.sql @@ -1 +1 @@ -ALTER TABLE `#__costbenefitprojection_causerisk` ADD `import_id` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `#__costbenefitprojection_causerisk` ADD `import_id` INT(11) NOT NULL DEFAULT '0'; diff --git a/admin/sql/updates/mysql/3.4.1.sql b/admin/sql/updates/mysql/3.4.1.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.4.1.sql +++ b/admin/sql/updates/mysql/3.4.1.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.4.2.sql b/admin/sql/updates/mysql/3.4.2.sql index d3f5a12f..8b137891 100644 --- a/admin/sql/updates/mysql/3.4.2.sql +++ b/admin/sql/updates/mysql/3.4.2.sql @@ -1 +1 @@ - + diff --git a/admin/sql/updates/mysql/3.4.3.sql b/admin/sql/updates/mysql/3.4.3.sql index d1549762..a14df28f 100644 --- a/admin/sql/updates/mysql/3.4.3.sql +++ b/admin/sql/updates/mysql/3.4.3.sql @@ -1,3 +1,3 @@ ALTER TABLE `#__costbenefitprojection_currency` ENGINE = InnoDB; -ALTER TABLE `#__costbenefitprojection_currency` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `#__costbenefitprojection_currency` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; diff --git a/admin/sql/updates/mysql/3.4.4.sql b/admin/sql/updates/mysql/3.4.4.sql index 7e4d4c1d..0a20b82a 100644 --- a/admin/sql/updates/mysql/3.4.4.sql +++ b/admin/sql/updates/mysql/3.4.4.sql @@ -1,3 +1,3 @@ ALTER TABLE `#__costbenefitprojection_health_data` ENGINE = InnoDB; -ALTER TABLE `#__costbenefitprojection_health_data` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `#__costbenefitprojection_health_data` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; diff --git a/admin/sql/updates/mysql/3.4.6.sql b/admin/sql/updates/mysql/3.4.6.sql index 4efc7b70..7878b610 100644 --- a/admin/sql/updates/mysql/3.4.6.sql +++ b/admin/sql/updates/mysql/3.4.6.sql @@ -1,3 +1,3 @@ ALTER TABLE `#__costbenefitprojection_intervention` ENGINE = InnoDB; -ALTER TABLE `#__costbenefitprojection_intervention` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `#__costbenefitprojection_intervention` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; diff --git a/admin/tables/causerisk.php b/admin/tables/causerisk.php index da6f2585..ae4bfc2f 100644 --- a/admin/tables/causerisk.php +++ b/admin/tables/causerisk.php @@ -1,321 +1,321 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Causesrisks Table class - */ -class CostbenefitprojectionTableCauserisk 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage causerisk.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Causesrisks Table class + */ +class CostbenefitprojectionTableCauserisk 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('#__costbenefitprojection_causerisk', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.causerisk')); - } - - 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 Causerisk 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 causerisk. A causerisk 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('causerisk', 'CostbenefitprojectionTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_COSTBENEFITPROJECTION_CAUSERISK_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('causerisk', 'costbenefitprojectionTable'); - - 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_costbenefitprojection.causerisk.'.$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_costbenefitprojection.causerisk.'.(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_costbenefitprojection'); - - return $asset->id; + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.causerisk')); + } + + 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 Causerisk 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 causerisk. A causerisk 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('causerisk', 'CostbenefitprojectionTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COSTBENEFITPROJECTION_CAUSERISK_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('causerisk', 'costbenefitprojectionTable'); + + 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_costbenefitprojection.causerisk.'.$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_costbenefitprojection.causerisk.'.(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_costbenefitprojection'); + + return $asset->id; } /** @@ -331,7 +331,7 @@ class CostbenefitprojectionTableCauserisk extends JTable $this->alias = $this->name; } - $this->alias = JApplication::stringURLSafe($this->alias); + $this->alias = JApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { @@ -339,6 +339,6 @@ class CostbenefitprojectionTableCauserisk extends JTable } return $this->alias; - } - -} + } + +} diff --git a/admin/tables/company.php b/admin/tables/company.php index 63162401..b62647a3 100644 --- a/admin/tables/company.php +++ b/admin/tables/company.php @@ -1,321 +1,321 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Companies Table class - */ -class CostbenefitprojectionTableCompany 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage company.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Companies Table class + */ +class CostbenefitprojectionTableCompany 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('#__costbenefitprojection_company', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.company')); - } - - 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 Company 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 company. A company 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('company', 'CostbenefitprojectionTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_COSTBENEFITPROJECTION_COMPANY_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('company', 'costbenefitprojectionTable'); - - 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_costbenefitprojection.company.'.$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_costbenefitprojection.company.'.(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_costbenefitprojection'); - - return $asset->id; + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.company')); + } + + 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 Company 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 company. A company 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('company', 'CostbenefitprojectionTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COSTBENEFITPROJECTION_COMPANY_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('company', 'costbenefitprojectionTable'); + + 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_costbenefitprojection.company.'.$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_costbenefitprojection.company.'.(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_costbenefitprojection'); + + return $asset->id; } /** @@ -326,6 +326,6 @@ class CostbenefitprojectionTableCompany extends JTable public function generateAlias() { return false; - } - -} + } + +} diff --git a/admin/tables/country.php b/admin/tables/country.php index a9874a9a..85f2955a 100644 --- a/admin/tables/country.php +++ b/admin/tables/country.php @@ -1,321 +1,321 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Countries Table class - */ -class CostbenefitprojectionTableCountry 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage country.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Countries Table class + */ +class CostbenefitprojectionTableCountry 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('#__costbenefitprojection_country', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.country')); - } - - 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 Country 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 country. A country 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('country', 'CostbenefitprojectionTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_COSTBENEFITPROJECTION_COUNTRY_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('country', 'costbenefitprojectionTable'); - - 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_costbenefitprojection.country.'.$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_costbenefitprojection.country.'.(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_costbenefitprojection'); - - return $asset->id; + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.country')); + } + + 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 Country 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 country. A country 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('country', 'CostbenefitprojectionTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COSTBENEFITPROJECTION_COUNTRY_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('country', 'costbenefitprojectionTable'); + + 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_costbenefitprojection.country.'.$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_costbenefitprojection.country.'.(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_costbenefitprojection'); + + return $asset->id; } /** @@ -331,7 +331,7 @@ class CostbenefitprojectionTableCountry extends JTable $this->alias = $this->name; } - $this->alias = JApplication::stringURLSafe($this->alias); + $this->alias = JApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { @@ -339,6 +339,6 @@ class CostbenefitprojectionTableCountry extends JTable } return $this->alias; - } - -} + } + +} diff --git a/admin/tables/currency.php b/admin/tables/currency.php index 035e905d..430c3f58 100644 --- a/admin/tables/currency.php +++ b/admin/tables/currency.php @@ -1,321 +1,321 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Currencies Table class - */ -class CostbenefitprojectionTableCurrency 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage currency.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Currencies Table class + */ +class CostbenefitprojectionTableCurrency 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('#__costbenefitprojection_currency', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.currency')); - } - - 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 Currency 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 currency. A currency 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('currency', 'CostbenefitprojectionTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_COSTBENEFITPROJECTION_CURRENCY_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('currency', 'costbenefitprojectionTable'); - - 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_costbenefitprojection.currency.'.$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_costbenefitprojection.currency.'.(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_costbenefitprojection'); - - return $asset->id; + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.currency')); + } + + 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 Currency 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 currency. A currency 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('currency', 'CostbenefitprojectionTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COSTBENEFITPROJECTION_CURRENCY_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('currency', 'costbenefitprojectionTable'); + + 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_costbenefitprojection.currency.'.$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_costbenefitprojection.currency.'.(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_costbenefitprojection'); + + return $asset->id; } /** @@ -331,7 +331,7 @@ class CostbenefitprojectionTableCurrency extends JTable $this->alias = $this->name; } - $this->alias = JApplication::stringURLSafe($this->alias); + $this->alias = JApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { @@ -339,6 +339,6 @@ class CostbenefitprojectionTableCurrency extends JTable } return $this->alias; - } - -} + } + +} diff --git a/admin/tables/health_data.php b/admin/tables/health_data.php index 267b947d..a2839d16 100644 --- a/admin/tables/health_data.php +++ b/admin/tables/health_data.php @@ -1,321 +1,321 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Health_data_sets Table class - */ -class CostbenefitprojectionTableHealth_data 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage health_data.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Health_data_sets Table class + */ +class CostbenefitprojectionTableHealth_data 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('#__costbenefitprojection_health_data', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.health_data')); - } - - 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_data 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_data. A health_data 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_data', 'CostbenefitprojectionTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_COSTBENEFITPROJECTION_HEALTH_DATA_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_data', 'costbenefitprojectionTable'); - - 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_costbenefitprojection.health_data.'.$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_costbenefitprojection.health_data.'.(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_costbenefitprojection'); - - return $asset->id; + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.health_data')); + } + + 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_data 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_data. A health_data 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_data', 'CostbenefitprojectionTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COSTBENEFITPROJECTION_HEALTH_DATA_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_data', 'costbenefitprojectionTable'); + + 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_costbenefitprojection.health_data.'.$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_costbenefitprojection.health_data.'.(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_costbenefitprojection'); + + return $asset->id; } /** @@ -326,6 +326,6 @@ class CostbenefitprojectionTableHealth_data extends JTable public function generateAlias() { return false; - } - -} + } + +} diff --git a/admin/tables/help_document.php b/admin/tables/help_document.php index e7dde8d6..6699a41b 100644 --- a/admin/tables/help_document.php +++ b/admin/tables/help_document.php @@ -1,321 +1,321 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Help_documents Table class - */ -class CostbenefitprojectionTableHelp_document 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage help_document.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Help_documents Table class + */ +class CostbenefitprojectionTableHelp_document 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('#__costbenefitprojection_help_document', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.help_document')); - } - - 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 Help_document 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 help_document. A help_document 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('help_document', 'CostbenefitprojectionTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_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('help_document', 'costbenefitprojectionTable'); - - 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_costbenefitprojection.help_document.'.$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_costbenefitprojection.help_document.'.(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_costbenefitprojection'); - - return $asset->id; + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.help_document')); + } + + 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 Help_document 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 help_document. A help_document 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('help_document', 'CostbenefitprojectionTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_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('help_document', 'costbenefitprojectionTable'); + + 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_costbenefitprojection.help_document.'.$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_costbenefitprojection.help_document.'.(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_costbenefitprojection'); + + return $asset->id; } /** @@ -331,7 +331,7 @@ class CostbenefitprojectionTableHelp_document extends JTable $this->alias = $this->title; } - $this->alias = JApplication::stringURLSafe($this->alias); + $this->alias = JApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { @@ -339,6 +339,6 @@ class CostbenefitprojectionTableHelp_document extends JTable } return $this->alias; - } - -} + } + +} diff --git a/admin/tables/intervention.php b/admin/tables/intervention.php index 2a70db20..8374506e 100644 --- a/admin/tables/intervention.php +++ b/admin/tables/intervention.php @@ -1,321 +1,321 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Interventions Table class - */ -class CostbenefitprojectionTableIntervention 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage intervention.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Interventions Table class + */ +class CostbenefitprojectionTableIntervention 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('#__costbenefitprojection_intervention', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.intervention')); - } - - 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 Intervention 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 intervention. A intervention 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('intervention', 'CostbenefitprojectionTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_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('intervention', 'costbenefitprojectionTable'); - - 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_costbenefitprojection.intervention.'.$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_costbenefitprojection.intervention.'.(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_costbenefitprojection'); - - return $asset->id; + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.intervention')); + } + + 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 Intervention 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 intervention. A intervention 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('intervention', 'CostbenefitprojectionTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_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('intervention', 'costbenefitprojectionTable'); + + 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_costbenefitprojection.intervention.'.$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_costbenefitprojection.intervention.'.(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_costbenefitprojection'); + + return $asset->id; } /** @@ -326,6 +326,6 @@ class CostbenefitprojectionTableIntervention extends JTable public function generateAlias() { return false; - } - -} + } + +} diff --git a/admin/tables/scaling_factor.php b/admin/tables/scaling_factor.php index 6926ab6d..22160638 100644 --- a/admin/tables/scaling_factor.php +++ b/admin/tables/scaling_factor.php @@ -1,321 +1,321 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Scaling_factors Table class - */ -class CostbenefitprojectionTableScaling_factor 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factor.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Scaling_factors Table class + */ +class CostbenefitprojectionTableScaling_factor 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('#__costbenefitprojection_scaling_factor', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.scaling_factor')); - } - - 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 Scaling_factor 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 scaling_factor. A scaling_factor 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('scaling_factor', 'CostbenefitprojectionTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_COSTBENEFITPROJECTION_SCALING_FACTOR_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('scaling_factor', 'costbenefitprojectionTable'); - - 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_costbenefitprojection.scaling_factor.'.$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_costbenefitprojection.scaling_factor.'.(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_costbenefitprojection'); - - return $asset->id; + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.scaling_factor')); + } + + 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 Scaling_factor 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 scaling_factor. A scaling_factor 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('scaling_factor', 'CostbenefitprojectionTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COSTBENEFITPROJECTION_SCALING_FACTOR_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('scaling_factor', 'costbenefitprojectionTable'); + + 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_costbenefitprojection.scaling_factor.'.$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_costbenefitprojection.scaling_factor.'.(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_costbenefitprojection'); + + return $asset->id; } /** @@ -326,6 +326,6 @@ class CostbenefitprojectionTableScaling_factor extends JTable public function generateAlias() { return false; - } - -} + } + +} diff --git a/admin/tables/service_provider.php b/admin/tables/service_provider.php index 0bd8ab44..4de03455 100644 --- a/admin/tables/service_provider.php +++ b/admin/tables/service_provider.php @@ -1,321 +1,321 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Service_providers Table class - */ -class CostbenefitprojectionTableService_provider 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage service_provider.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Service_providers Table class + */ +class CostbenefitprojectionTableService_provider 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('#__costbenefitprojection_service_provider', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.service_provider')); - } - - 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 Service_provider 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 service_provider. A service_provider 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('service_provider', 'CostbenefitprojectionTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_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('service_provider', 'costbenefitprojectionTable'); - - 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_costbenefitprojection.service_provider.'.$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_costbenefitprojection.service_provider.'.(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_costbenefitprojection'); - - return $asset->id; + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_costbenefitprojection.service_provider')); + } + + 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 Service_provider 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 service_provider. A service_provider 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('service_provider', 'CostbenefitprojectionTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_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('service_provider', 'costbenefitprojectionTable'); + + 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_costbenefitprojection.service_provider.'.$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_costbenefitprojection.service_provider.'.(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_costbenefitprojection'); + + return $asset->id; } /** @@ -326,6 +326,6 @@ class CostbenefitprojectionTableService_provider extends JTable public function generateAlias() { return false; - } - -} + } + +} diff --git a/admin/views/causerisk/submitbutton.js b/admin/views/causerisk/submitbutton.js index a48d27cd..ca1f04ab 100644 --- a/admin/views/causerisk/submitbutton.js +++ b/admin/views/causerisk/submitbutton.js @@ -1,33 +1,33 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage submitbutton.js - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -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._('causerisk, some values are not acceptable.','Some values are unacceptable')); - return false; - } - } +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +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._('causerisk, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } } \ No newline at end of file diff --git a/admin/views/causerisk/tmpl/edit.php b/admin/views/causerisk/tmpl/edit.php index badb4fcf..ddac60dc 100644 --- a/admin/views/causerisk/tmpl/edit.php +++ b/admin/views/causerisk/tmpl/edit.php @@ -1,34 +1,33 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage edit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -$componentParams = $this->params; // will be removed just use $this->params instead -?> -
-
+JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> +
+
@@ -93,6 +92,6 @@ $componentParams = $this->params; // will be removed just use $this->params inst
-
- -
+ + + diff --git a/admin/views/causerisk/view.html.php b/admin/views/causerisk/view.html.php index 2e5b3970..8b2c658c 100644 --- a/admin/views/causerisk/view.html.php +++ b/admin/views/causerisk/view.html.php @@ -1,91 +1,91 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Causerisk View class - */ -class CostbenefitprojectionViewCauserisk extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // set params - $this->params = JComponentHelper::getParams('com_costbenefitprojection'); - // 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 = CostbenefitprojectionHelper::getActions('causerisk', $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() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Causerisk View class + */ +class CostbenefitprojectionViewCauserisk extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_costbenefitprojection'); + // 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 = CostbenefitprojectionHelper::getActions('causerisk', $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; @@ -157,47 +157,47 @@ class CostbenefitprojectionViewCauserisk extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('causerisk'); - if (CostbenefitprojectionHelper::checkString($help_url)) + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('causerisk'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_CAUSERISK_NEW' : 'COM_COSTBENEFITPROJECTION_CAUSERISK_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_costbenefitprojection/assets/css/causerisk.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_costbenefitprojection/views/causerisk/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_CAUSERISK_NEW' : 'COM_COSTBENEFITPROJECTION_CAUSERISK_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_costbenefitprojection/assets/css/causerisk.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_costbenefitprojection/views/causerisk/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/causesrisks/tmpl/default.php b/admin/views/causesrisks/tmpl/default.php index cdff8f82..c86d723b 100644 --- a/admin/views/causesrisks/tmpl/default.php +++ b/admin/views/causesrisks/tmpl/default.php @@ -1,35 +1,34 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::_('behavior.tooltip'); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::_('behavior.multiselect'); JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); -if ($this->saveOrder) -{ - $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=causesrisks.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'causeriskList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); -} -?> +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=causesrisks.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'causeriskList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
@@ -218,7 +217,7 @@ function controlSwitch(){ - - -

- + + +

+ diff --git a/admin/views/combinedresults/tmpl/default_chart_cost.php b/admin/views/combinedresults/tmpl/default_chart_cost.php index d6a946a5..3aa54a29 100644 --- a/admin/views/combinedresults/tmpl/default_chart_cost.php +++ b/admin/views/combinedresults/tmpl/default_chart_cost.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_cost.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -61,8 +61,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi $options = array( 'backgroundColor' => $this->Chart['backgroundColor'], 'width' => $this->Chart['width'], 'height' => $height, 'chartArea' => $this->Chart['chartArea'], 'legend' => $this->Chart['legend'], 'vAxis' => $this->Chart['vAxis'], 'hAxis' => array('textStyle' => $this->Chart['hAxis']['textStyle'], 'title' => $title, 'titleTextStyle' => $this->Chart['hAxis']['titleTextStyle'])); echo $chart->draw('c_'.$scale, $options); } -} - +} + ?>
@@ -76,4 +76,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+
diff --git a/admin/views/combinedresults/tmpl/default_chart_cost_percent.php b/admin/views/combinedresults/tmpl/default_chart_cost_percent.php index 3b0ea359..fa2dde6a 100644 --- a/admin/views/combinedresults/tmpl/default_chart_cost_percent.php +++ b/admin/views/combinedresults/tmpl/default_chart_cost_percent.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_cost_percent.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -55,8 +55,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('cp_'.$scale, $options); } -} - +} + ?>
@@ -69,4 +69,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/admin/views/combinedresults/tmpl/default_chart_intervention_cost_benefit.php b/admin/views/combinedresults/tmpl/default_chart_intervention_cost_benefit.php index e51bd3fc..0e240752 100644 --- a/admin/views/combinedresults/tmpl/default_chart_intervention_cost_benefit.php +++ b/admin/views/combinedresults/tmpl/default_chart_intervention_cost_benefit.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_intervention_cost_benefit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -79,8 +79,8 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr } } } -} - +} + ?>
@@ -99,4 +99,4 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr
-
+ diff --git a/admin/views/combinedresults/tmpl/default_chart_work_days_lost.php b/admin/views/combinedresults/tmpl/default_chart_work_days_lost.php index 05aa0db7..0f0e31f4 100644 --- a/admin/views/combinedresults/tmpl/default_chart_work_days_lost.php +++ b/admin/views/combinedresults/tmpl/default_chart_work_days_lost.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_work_days_lost.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -61,8 +61,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('wdl_'.$scale, $options); } -} - +} + ?>
@@ -75,4 +75,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/admin/views/combinedresults/tmpl/default_chart_work_days_lost_percent.php b/admin/views/combinedresults/tmpl/default_chart_work_days_lost_percent.php index b00deabe..6725bfbb 100644 --- a/admin/views/combinedresults/tmpl/default_chart_work_days_lost_percent.php +++ b/admin/views/combinedresults/tmpl/default_chart_work_days_lost_percent.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_work_days_lost_percent.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -55,8 +55,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('wdlp_'.$scale, $options); } -} - +} + ?>
@@ -69,4 +69,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/admin/views/combinedresults/tmpl/default_main.php b/admin/views/combinedresults/tmpl/default_main.php index c519f933..da134fd2 100644 --- a/admin/views/combinedresults/tmpl/default_main.php +++ b/admin/views/combinedresults/tmpl/default_main.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_main.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + ?> - + diff --git a/admin/views/combinedresults/tmpl/default_table_calculated_cost_in_detail.php b/admin/views/combinedresults/tmpl/default_table_calculated_cost_in_detail.php index b7d536ef..b5e10139 100644 --- a/admin/views/combinedresults/tmpl/default_table_calculated_cost_in_detail.php +++ b/admin/views/combinedresults/tmpl/default_table_calculated_cost_in_detail.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_calculated_cost_in_detail.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -64,4 +64,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/admin/views/combinedresults/tmpl/default_table_cost_summary.php b/admin/views/combinedresults/tmpl/default_table_cost_summary.php index 67f18adf..e39882d2 100644 --- a/admin/views/combinedresults/tmpl/default_table_cost_summary.php +++ b/admin/views/combinedresults/tmpl/default_table_cost_summary.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_cost_summary.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -67,4 +67,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/admin/views/combinedresults/tmpl/default_table_intervention_net_benefit.php b/admin/views/combinedresults/tmpl/default_table_intervention_net_benefit.php index 50d0f0ce..8494bbea 100644 --- a/admin/views/combinedresults/tmpl/default_table_intervention_net_benefit.php +++ b/admin/views/combinedresults/tmpl/default_table_intervention_net_benefit.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_intervention_net_benefit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -96,4 +96,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/admin/views/combinedresults/tmpl/default_table_work_days_lost_summary.php b/admin/views/combinedresults/tmpl/default_table_work_days_lost_summary.php index 058ae0ae..01c3df21 100644 --- a/admin/views/combinedresults/tmpl/default_table_work_days_lost_summary.php +++ b/admin/views/combinedresults/tmpl/default_table_work_days_lost_summary.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_work_days_lost_summary.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -76,4 +76,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/admin/views/combinedresults/view.html.php b/admin/views/combinedresults/view.html.php index df4ac54c..607d73aa 100644 --- a/admin/views/combinedresults/view.html.php +++ b/admin/views/combinedresults/view.html.php @@ -1,40 +1,40 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Costbenefitprojection View class for the Combinedresults - */ -class CostbenefitprojectionViewCombinedresults extends JViewLegacy -{ - // Overwriting JView display method - function display($tpl = null) - { - // get component params - $this->params = JComponentHelper::getParams('com_costbenefitprojection'); - // get the application - $this->app = JFactory::getApplication(); - // get the user object - $this->user = JFactory::getUser(); - // get global action permissions +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Costbenefitprojection View class for the Combinedresults + */ +class CostbenefitprojectionViewCombinedresults extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get component params + $this->params = JComponentHelper::getParams('com_costbenefitprojection'); + // get the application + $this->app = JFactory::getApplication(); + // get the user object + $this->user = JFactory::getUser(); + // get global action permissions $this->canDo = CostbenefitprojectionHelper::getActions('combinedresults'); // Initialise variables. $this->items = $this->get('Items'); @@ -80,7 +80,7 @@ class CostbenefitprojectionViewCombinedresults extends JViewLegacy throw new Exception(implode(PHP_EOL, $errors), 500); } - parent::display($tpl); + parent::display($tpl); } protected function getChartTabs() @@ -118,12 +118,12 @@ class CostbenefitprojectionViewCombinedresults extends JViewLegacy $items[3] = array('name' => JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_NET_BENEFIT'), 'view' => 'inb', 'img' => 'media/com_costbenefitprojection/images/tables.png'); return $items; - } - - /** - * Prepares the document - */ - protected function setDocument() + } + + /** + * Prepares the document + */ + protected function setDocument() { // always make sure jquery is loaded. @@ -155,21 +155,19 @@ class CostbenefitprojectionViewCombinedresults extends JViewLegacy $uikitComp = $this->get('UikitComp'); if ($uikit != 2 && isset($uikitComp) && CostbenefitprojectionHelper::checkArray($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { foreach (CostbenefitprojectionHelper::$uk_components[$class] as $name) { // check if the CSS file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. $this->document->addStyleSheet(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); } // check if the JavaScript file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. $this->document->addScript(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); @@ -230,19 +228,19 @@ class CostbenefitprojectionViewCombinedresults extends JViewLegacy { $this->menuNotice++; $session->set( 'CT_SubMenuNotice', $this->menuNotice); - } - // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_costbenefitprojection/assets/css/combinedresults.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() + } + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_costbenefitprojection/assets/css/combinedresults.css', (CostbenefitprojectionHelper::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); - // add title to the page + $this->app->input->set('hidemainmenu', true); + // add title to the page JToolbarHelper::title(JText::_('COM_COSTBENEFITPROJECTION_COMBINEDRESULTS'),'cogs'); // add cpanel button JToolBarHelper::custom('combinedresults.dashboard', 'grid-2', '', 'COM_COSTBENEFITPROJECTION_DASH', false); @@ -250,32 +248,32 @@ class CostbenefitprojectionViewCombinedresults extends JViewLegacy { // add Companies button. JToolBarHelper::custom('combinedresults.gotoCompanies', 'vcard custom-button-gotocompanies', '', 'COM_COSTBENEFITPROJECTION_COMPANIES', false); - } - - // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('combinedresults'); - if (CostbenefitprojectionHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - - // add the options comp button - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) - { - JToolBarHelper::preferences('com_costbenefitprojection'); - } - } - - /** - * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset); - } -} + } + + // set help url for this view if found + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('combinedresults'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) + { + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_costbenefitprojection'); + } + } + + /** + * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset); + } +} diff --git a/admin/views/companies/tmpl/default.php b/admin/views/companies/tmpl/default.php index 472e5e82..92164ff1 100644 --- a/admin/views/companies/tmpl/default.php +++ b/admin/views/companies/tmpl/default.php @@ -1,35 +1,34 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::_('behavior.tooltip'); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::_('behavior.multiselect'); JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); -if ($this->saveOrder) -{ - $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=companies.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'companyList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); -} -?> +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=companies.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'companyList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> - diff --git a/admin/views/companyresults/tmpl/default_chart_intervention_cost_benefit.php b/admin/views/companyresults/tmpl/default_chart_intervention_cost_benefit.php index e51bd3fc..0e240752 100644 --- a/admin/views/companyresults/tmpl/default_chart_intervention_cost_benefit.php +++ b/admin/views/companyresults/tmpl/default_chart_intervention_cost_benefit.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_intervention_cost_benefit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -79,8 +79,8 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr } } } -} - +} + ?>
@@ -99,4 +99,4 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr
-
+ diff --git a/admin/views/companyresults/tmpl/default_chart_work_days_lost.php b/admin/views/companyresults/tmpl/default_chart_work_days_lost.php index 05aa0db7..0f0e31f4 100644 --- a/admin/views/companyresults/tmpl/default_chart_work_days_lost.php +++ b/admin/views/companyresults/tmpl/default_chart_work_days_lost.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_work_days_lost.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -61,8 +61,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('wdl_'.$scale, $options); } -} - +} + ?>
@@ -75,4 +75,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/admin/views/companyresults/tmpl/default_chart_work_days_lost_percent.php b/admin/views/companyresults/tmpl/default_chart_work_days_lost_percent.php index b00deabe..6725bfbb 100644 --- a/admin/views/companyresults/tmpl/default_chart_work_days_lost_percent.php +++ b/admin/views/companyresults/tmpl/default_chart_work_days_lost_percent.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_work_days_lost_percent.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -55,8 +55,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('wdlp_'.$scale, $options); } -} - +} + ?>
@@ -69,4 +69,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/admin/views/companyresults/tmpl/default_main.php b/admin/views/companyresults/tmpl/default_main.php index c519f933..da134fd2 100644 --- a/admin/views/companyresults/tmpl/default_main.php +++ b/admin/views/companyresults/tmpl/default_main.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_main.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + ?> - + diff --git a/admin/views/companyresults/tmpl/default_table_calculated_cost_in_detail.php b/admin/views/companyresults/tmpl/default_table_calculated_cost_in_detail.php index b7d536ef..b5e10139 100644 --- a/admin/views/companyresults/tmpl/default_table_calculated_cost_in_detail.php +++ b/admin/views/companyresults/tmpl/default_table_calculated_cost_in_detail.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_calculated_cost_in_detail.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -64,4 +64,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/admin/views/companyresults/tmpl/default_table_cost_summary.php b/admin/views/companyresults/tmpl/default_table_cost_summary.php index 67f18adf..e39882d2 100644 --- a/admin/views/companyresults/tmpl/default_table_cost_summary.php +++ b/admin/views/companyresults/tmpl/default_table_cost_summary.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_cost_summary.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -67,4 +67,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/admin/views/companyresults/tmpl/default_table_intervention_net_benefit.php b/admin/views/companyresults/tmpl/default_table_intervention_net_benefit.php index 50d0f0ce..8494bbea 100644 --- a/admin/views/companyresults/tmpl/default_table_intervention_net_benefit.php +++ b/admin/views/companyresults/tmpl/default_table_intervention_net_benefit.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_intervention_net_benefit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -96,4 +96,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/admin/views/companyresults/tmpl/default_table_work_days_lost_summary.php b/admin/views/companyresults/tmpl/default_table_work_days_lost_summary.php index 058ae0ae..01c3df21 100644 --- a/admin/views/companyresults/tmpl/default_table_work_days_lost_summary.php +++ b/admin/views/companyresults/tmpl/default_table_work_days_lost_summary.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_work_days_lost_summary.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -76,4 +76,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/admin/views/companyresults/tmpl/default_variables.php b/admin/views/companyresults/tmpl/default_variables.php index d95c66b6..80a2a1f8 100644 --- a/admin/views/companyresults/tmpl/default_variables.php +++ b/admin/views/companyresults/tmpl/default_variables.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_variables.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + ?>

Variables

@@ -27,4 +27,4 @@ defined('_JEXEC') or die('Restricted access'); echo '
'; print_r($this->results); echo '
'; -?> +?> diff --git a/admin/views/companyresults/view.html.php b/admin/views/companyresults/view.html.php index 6a015b0c..1d547920 100644 --- a/admin/views/companyresults/view.html.php +++ b/admin/views/companyresults/view.html.php @@ -1,40 +1,40 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Costbenefitprojection View class for the Companyresults - */ -class CostbenefitprojectionViewCompanyresults extends JViewLegacy -{ - // Overwriting JView display method - function display($tpl = null) - { - // get component params - $this->params = JComponentHelper::getParams('com_costbenefitprojection'); - // get the application - $this->app = JFactory::getApplication(); - // get the user object - $this->user = JFactory::getUser(); - // get global action permissions +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Costbenefitprojection View class for the Companyresults + */ +class CostbenefitprojectionViewCompanyresults extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get component params + $this->params = JComponentHelper::getParams('com_costbenefitprojection'); + // get the application + $this->app = JFactory::getApplication(); + // get the user object + $this->user = JFactory::getUser(); + // get global action permissions $this->canDo = CostbenefitprojectionHelper::getActions('companyresults'); // Initialise variables. $this->item = $this->get('Item'); @@ -73,7 +73,7 @@ class CostbenefitprojectionViewCompanyresults extends JViewLegacy throw new Exception(implode(PHP_EOL, $errors), 500); } - parent::display($tpl); + parent::display($tpl); } protected function getChartTabs() @@ -111,12 +111,12 @@ class CostbenefitprojectionViewCompanyresults extends JViewLegacy $items[3] = array('name' => JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION_NET_BENEFIT'), 'view' => 'inb', 'img' => 'media/com_costbenefitprojection/images/tables.png'); return $items; - } - - /** - * Prepares the document - */ - protected function setDocument() + } + + /** + * Prepares the document + */ + protected function setDocument() { // always make sure jquery is loaded. @@ -192,21 +192,19 @@ class CostbenefitprojectionViewCompanyresults extends JViewLegacy $uikitComp = $this->get('UikitComp'); if ($uikit != 2 && isset($uikitComp) && CostbenefitprojectionHelper::checkArray($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { foreach (CostbenefitprojectionHelper::$uk_components[$class] as $name) { // check if the CSS file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. $this->document->addStyleSheet(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); } // check if the JavaScript file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. $this->document->addScript(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); @@ -265,29 +263,29 @@ class CostbenefitprojectionViewCompanyresults extends JViewLegacy { $this->menuNotice++; $session->set( 'CT_SubMenuNotice', $this->menuNotice); - } - // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_costbenefitprojection/assets/css/companyresults.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() + } + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_costbenefitprojection/assets/css/companyresults.css', (CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_COMPANYRESULTS'); - } - // add title to the page + $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_COSTBENEFITPROJECTION_COMPANYRESULTS'); + } + // add title to the page JToolbarHelper::title($title,'chart'); // add cpanel button JToolBarHelper::custom('companyresults.dashboard', 'grid-2', '', 'COM_COSTBENEFITPROJECTION_DASH', false); @@ -300,33 +298,33 @@ class CostbenefitprojectionViewCompanyresults extends JViewLegacy { // add Edit button. JToolBarHelper::custom('companyresults.editCompany', 'pencil custom-button-editcompany', '', 'COM_COSTBENEFITPROJECTION_EDIT', false); - } - - // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('companyresults'); - if (CostbenefitprojectionHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - - // add the options comp button - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) - { - JToolBarHelper::preferences('com_costbenefitprojection'); - } - } - - /** - * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset); - } -} -?> + } + + // set help url for this view if found + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('companyresults'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) + { + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_costbenefitprojection'); + } + } + + /** + * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset); + } +} +?> diff --git a/admin/views/costbenefitprojection/tmpl/default.php b/admin/views/costbenefitprojection/tmpl/default.php index 68f7a774..d8912a0f 100644 --- a/admin/views/costbenefitprojection/tmpl/default.php +++ b/admin/views/costbenefitprojection/tmpl/default.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::_('behavior.tooltip'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + + + ?>
diff --git a/admin/views/costbenefitprojection/tmpl/default_closed_issues_the_closed_issues_on_github.php b/admin/views/costbenefitprojection/tmpl/default_closed_issues_the_closed_issues_on_github.php index d1c9c416..92ea2828 100644 --- a/admin/views/costbenefitprojection/tmpl/default_closed_issues_the_closed_issues_on_github.php +++ b/admin/views/costbenefitprojection/tmpl/default_closed_issues_the_closed_issues_on_github.php @@ -1,24 +1,24 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_closed_issues_the_closed_issues_on_github.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + ?> -github->closedissues; ?> +github->closedissues; ?> diff --git a/admin/views/costbenefitprojection/tmpl/default_main.php b/admin/views/costbenefitprojection/tmpl/default_main.php index 43aedc94..4a124b9b 100644 --- a/admin/views/costbenefitprojection/tmpl/default_main.php +++ b/admin/views/costbenefitprojection/tmpl/default_main.php @@ -1,38 +1,38 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> -icons['main']) && is_array($this->icons['main'])) :?> - icons['main'] as $icon): ?> - - -
- -

+/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_main.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +icons['main']) && is_array($this->icons['main'])) :?> + icons['main'] as $icon): ?> + + +
+ +

\ No newline at end of file diff --git a/admin/views/costbenefitprojection/tmpl/default_open_issues_the_open_issues_on_github.php b/admin/views/costbenefitprojection/tmpl/default_open_issues_the_open_issues_on_github.php index 7461f07f..f656c6cd 100644 --- a/admin/views/costbenefitprojection/tmpl/default_open_issues_the_open_issues_on_github.php +++ b/admin/views/costbenefitprojection/tmpl/default_open_issues_the_open_issues_on_github.php @@ -1,24 +1,24 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_open_issues_the_open_issues_on_github.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + ?> -github->openissues; ?> +github->openissues; ?> diff --git a/admin/views/costbenefitprojection/tmpl/default_readme_information.php b/admin/views/costbenefitprojection/tmpl/default_readme_information.php index 551b5560..3aa159f5 100644 --- a/admin/views/costbenefitprojection/tmpl/default_readme_information.php +++ b/admin/views/costbenefitprojection/tmpl/default_readme_information.php @@ -1,24 +1,24 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_readme_information.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + ?> -readme; ?> +readme; ?> diff --git a/admin/views/costbenefitprojection/tmpl/default_usage_statistics_table.php b/admin/views/costbenefitprojection/tmpl/default_usage_statistics_table.php index 996d6b46..c19f8ba2 100644 --- a/admin/views/costbenefitprojection/tmpl/default_usage_statistics_table.php +++ b/admin/views/costbenefitprojection/tmpl/default_usage_statistics_table.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_usage_statistics_table.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + ?> usagedata->items)): ?>
@@ -67,4 +67,4 @@ defined('_JEXEC') or die('Restricted access');

- + diff --git a/admin/views/costbenefitprojection/tmpl/default_vast_development_method_notice_board.php b/admin/views/costbenefitprojection/tmpl/default_vast_development_method_notice_board.php index 67873c45..b5b94ba9 100644 --- a/admin/views/costbenefitprojection/tmpl/default_vast_development_method_notice_board.php +++ b/admin/views/costbenefitprojection/tmpl/default_vast_development_method_notice_board.php @@ -1,24 +1,24 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_vast_development_method_notice_board.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + ?> -noticeboard; ?> +noticeboard; ?> diff --git a/admin/views/costbenefitprojection/tmpl/default_vdm.php b/admin/views/costbenefitprojection/tmpl/default_vdm.php index ed2adae6..b94286e8 100644 --- a/admin/views/costbenefitprojection/tmpl/default_vdm.php +++ b/admin/views/costbenefitprojection/tmpl/default_vdm.php @@ -1,46 +1,46 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> -<?php echo JText::_('COM_COSTBENEFITPROJECTION'); ?> - -
-contributors)): ?> - contributors) > 1): ?> -

- -

- -
    - contributors as $contributor): ?> -
  • :
  • - -
-
+/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_vdm.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +<?php echo JText::_('COM_COSTBENEFITPROJECTION'); ?> + +
+contributors)): ?> + contributors) > 1): ?> +

+ +

+ +
    + contributors as $contributor): ?> +
  • :
  • + +
+
\ No newline at end of file diff --git a/admin/views/costbenefitprojection/view.html.php b/admin/views/costbenefitprojection/view.html.php index 5a42008e..469728fd 100644 --- a/admin/views/costbenefitprojection/view.html.php +++ b/admin/views/costbenefitprojection/view.html.php @@ -1,100 +1,102 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Costbenefitprojection View class - */ -class CostbenefitprojectionViewCostbenefitprojection extends JViewLegacy -{ - /** - * View display method - * @return void - */ - function display($tpl = null) - { - // Assign data to the view - $this->icons = $this->get('Icons'); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + + + +/** + * Costbenefitprojection View class + */ +class CostbenefitprojectionViewCostbenefitprojection extends JViewLegacy +{ + /** + * View display method + * @return void + */ + function display($tpl = null) + { + // Assign data to the view + $this->icons = $this->get('Icons'); $this->contributors = CostbenefitprojectionHelper::getContributors(); $this->usagedata = $this->get('UsageData'); $this->github = $this->get('Github'); $this->noticeboard = $this->get('Noticeboard'); - $this->readme = $this->get('Readme'); - - // get the manifest details of the component - $this->manifest = CostbenefitprojectionHelper::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 = CostbenefitprojectionHelper::getActions('costbenefitprojection'); - JToolBarHelper::title(JText::_('COM_COSTBENEFITPROJECTION_DASHBOARD'), 'grid-2'); - - // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('costbenefitprojection'); - if (CostbenefitprojectionHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - - if ($canDo->get('core.admin') || $canDo->get('core.options')) - { - JToolBarHelper::preferences('com_costbenefitprojection'); - } - } - - /** - * 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_costbenefitprojection/assets/css/dashboard.css"); - - // set page title - $document->setTitle(JText::_('COM_COSTBENEFITPROJECTION_DASHBOARD')); - - // add manifest to page JavaScript - $document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript"); - } -} + $this->readme = $this->get('Readme'); + + // get the manifest details of the component + $this->manifest = CostbenefitprojectionHelper::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 = CostbenefitprojectionHelper::getActions('costbenefitprojection'); + JToolBarHelper::title(JText::_('COM_COSTBENEFITPROJECTION_DASHBOARD'), 'grid-2'); + + // set help url for this view if found + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('costbenefitprojection'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) + { + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + + if ($canDo->get('core.admin') || $canDo->get('core.options')) + { + JToolBarHelper::preferences('com_costbenefitprojection'); + } + } + + /** + * 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_costbenefitprojection/assets/css/dashboard.css"); + + // set page title + $document->setTitle(JText::_('COM_COSTBENEFITPROJECTION_DASHBOARD')); + + // add manifest to page JavaScript + $document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript"); + } +} diff --git a/admin/views/countries/tmpl/default.php b/admin/views/countries/tmpl/default.php index 5133d4a4..bb010b8d 100644 --- a/admin/views/countries/tmpl/default.php +++ b/admin/views/countries/tmpl/default.php @@ -1,35 +1,34 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::_('behavior.tooltip'); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::_('behavior.multiselect'); JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); -if ($this->saveOrder) -{ - $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=countries.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'countryList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); -} -?> +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=countries.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'countryList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> - + + diff --git a/admin/views/country/view.html.php b/admin/views/country/view.html.php index 2f9421b8..221c61cd 100644 --- a/admin/views/country/view.html.php +++ b/admin/views/country/view.html.php @@ -1,67 +1,67 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Country View class - */ -class CostbenefitprojectionViewCountry extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // set params - $this->params = JComponentHelper::getParams('com_costbenefitprojection'); - // 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 = CostbenefitprojectionHelper::getActions('country', $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; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Country View class + */ +class CostbenefitprojectionViewCountry extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_costbenefitprojection'); + // 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 = CostbenefitprojectionHelper::getActions('country', $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 @@ -71,30 +71,30 @@ class CostbenefitprojectionViewCountry extends JViewLegacy $this->vwgservice_providers = $this->get('Vwgservice_providers'); // Get Linked view data - $this->vwhcompanies = $this->get('Vwhcompanies'); - - // 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() - { + $this->vwhcompanies = $this->get('Vwhcompanies'); + + // 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; @@ -166,44 +166,44 @@ class CostbenefitprojectionViewCountry extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('country'); - if (CostbenefitprojectionHelper::checkString($help_url)) + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('country'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_COUNTRY_NEW' : 'COM_COSTBENEFITPROJECTION_COUNTRY_EDIT')); + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_COUNTRY_NEW' : 'COM_COSTBENEFITPROJECTION_COUNTRY_EDIT')); $this->document->addStyleSheet(JURI::root() . "administrator/components/com_costbenefitprojection/assets/css/country.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); // Add the CSS for Footable. @@ -228,9 +228,9 @@ class CostbenefitprojectionViewCountry extends JViewLegacy $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, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_costbenefitprojection/views/country/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} + + $this->document->addScript(JURI::root() . $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_costbenefitprojection/views/country/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/currencies/tmpl/default.php b/admin/views/currencies/tmpl/default.php index e920cce4..6e4152a8 100644 --- a/admin/views/currencies/tmpl/default.php +++ b/admin/views/currencies/tmpl/default.php @@ -1,35 +1,34 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::_('behavior.tooltip'); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::_('behavior.multiselect'); JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); -if ($this->saveOrder) -{ - $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=currencies.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'currencyList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); -} -?> +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=currencies.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'currencyList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> - + + + diff --git a/admin/views/currency/view.html.php b/admin/views/currency/view.html.php index 5440010a..5a7da3a6 100644 --- a/admin/views/currency/view.html.php +++ b/admin/views/currency/view.html.php @@ -1,91 +1,91 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Currency View class - */ -class CostbenefitprojectionViewCurrency extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // set params - $this->params = JComponentHelper::getParams('com_costbenefitprojection'); - // 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 = CostbenefitprojectionHelper::getActions('currency', $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() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Currency View class + */ +class CostbenefitprojectionViewCurrency extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_costbenefitprojection'); + // 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 = CostbenefitprojectionHelper::getActions('currency', $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; @@ -157,47 +157,47 @@ class CostbenefitprojectionViewCurrency extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('currency'); - if (CostbenefitprojectionHelper::checkString($help_url)) + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('currency'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_CURRENCY_NEW' : 'COM_COSTBENEFITPROJECTION_CURRENCY_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_costbenefitprojection/assets/css/currency.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_costbenefitprojection/views/currency/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_CURRENCY_NEW' : 'COM_COSTBENEFITPROJECTION_CURRENCY_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_costbenefitprojection/assets/css/currency.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_costbenefitprojection/views/currency/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/health_data/submitbutton.js b/admin/views/health_data/submitbutton.js index 9bc98e5d..7a93053c 100644 --- a/admin/views/health_data/submitbutton.js +++ b/admin/views/health_data/submitbutton.js @@ -1,33 +1,33 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage submitbutton.js - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -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_data, some values are not acceptable.','Some values are unacceptable')); - return false; - } - } +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +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_data, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } } \ No newline at end of file diff --git a/admin/views/health_data/tmpl/edit.php b/admin/views/health_data/tmpl/edit.php index 2f2d9133..4239635b 100644 --- a/admin/views/health_data/tmpl/edit.php +++ b/admin/views/health_data/tmpl/edit.php @@ -1,34 +1,33 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage edit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -$componentParams = $this->params; // will be removed just use $this->params instead -?> -
-
+JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> +
+
@@ -92,8 +91,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
-
- +
+ + diff --git a/admin/views/health_data/view.html.php b/admin/views/health_data/view.html.php index 0dfc50ca..00ad8fc2 100644 --- a/admin/views/health_data/view.html.php +++ b/admin/views/health_data/view.html.php @@ -1,91 +1,91 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Health_data View class - */ -class CostbenefitprojectionViewHealth_data extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // set params - $this->params = JComponentHelper::getParams('com_costbenefitprojection'); - // 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 = CostbenefitprojectionHelper::getActions('health_data', $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() - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Health_data View class + */ +class CostbenefitprojectionViewHealth_data extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_costbenefitprojection'); + // 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 = CostbenefitprojectionHelper::getActions('health_data', $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; @@ -157,47 +157,47 @@ class CostbenefitprojectionViewHealth_data extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('health_data'); - if (CostbenefitprojectionHelper::checkString($help_url)) + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('health_data'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_HEALTH_DATA_NEW' : 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_costbenefitprojection/assets/css/health_data.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_costbenefitprojection/views/health_data/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_HEALTH_DATA_NEW' : 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_costbenefitprojection/assets/css/health_data.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_costbenefitprojection/views/health_data/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/health_data_sets/tmpl/default.php b/admin/views/health_data_sets/tmpl/default.php index 0b800cce..06bdedbd 100644 --- a/admin/views/health_data_sets/tmpl/default.php +++ b/admin/views/health_data_sets/tmpl/default.php @@ -1,35 +1,34 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::_('behavior.tooltip'); +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::_('behavior.multiselect'); JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); -if ($this->saveOrder) -{ - $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=health_data_sets.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'health_dataList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); -} -?> +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_costbenefitprojection&task=health_data_sets.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'health_dataList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> -
@@ -165,5 +165,5 @@ else
- - + + diff --git a/site/layouts/companydetails.php b/site/layouts/companydetails.php index a536e2cc..a5ceff1f 100644 --- a/site/layouts/companydetails.php +++ b/site/layouts/companydetails.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companydetails.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('JPATH_BASE') or die('Restricted access'); // set som user permissions @@ -317,8 +317,8 @@ if (isset($displayData->idCompanyInterventionE) && CostbenefitprojectionHelper:: $head .= '>'. $header.''; } $interventions = '
'.$head.''.$body.'
'; -} - +} + ?> get('company.edit')): ?> checked_out): ?> @@ -448,4 +448,4 @@ if (isset($displayData->idCompanyInterventionE) && CostbenefitprojectionHelper::
-
+ diff --git a/site/layouts/databreakdownmalefemale.php b/site/layouts/databreakdownmalefemale.php index ede62762..01815f22 100644 --- a/site/layouts/databreakdownmalefemale.php +++ b/site/layouts/databreakdownmalefemale.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage databreakdownmalefemale.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('JPATH_BASE') or die('Restricted access'); $builder = array( @@ -27,8 +27,8 @@ $builder = array( $rounder = array( 'cost' => array('yld','death'), 'day' => array('yld','death','morbidity_'.$displayData->_tmpScale, 'presenteeism_'.$displayData->_tmpScale, 'days_lost_mortality_'.$displayData->_tmpScale) - ); - + ); + ?> male) && isset($displayData->female) ): ?>
@@ -65,4 +65,4 @@ $rounder = array(
- + diff --git a/site/layouts/intervention/details_above.php b/site/layouts/intervention/details_above.php index 824120c6..4fd4982b 100644 --- a/site/layouts/intervention/details_above.php +++ b/site/layouts/intervention/details_above.php @@ -1,55 +1,55 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'company', 'country', - 'type' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'type' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/site/layouts/intervention/details_fullwidth.php b/site/layouts/intervention/details_fullwidth.php index a684b291..1da69d74 100644 --- a/site/layouts/intervention/details_fullwidth.php +++ b/site/layouts/intervention/details_fullwidth.php @@ -1,56 +1,56 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'coverage', 'duration', 'share', 'description', - 'reference' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'reference' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/site/layouts/intervention/details_under.php b/site/layouts/intervention/details_under.php index 0b043c60..d83e7a0a 100644 --- a/site/layouts/intervention/details_under.php +++ b/site/layouts/intervention/details_under.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'not_required' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_under.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'not_required' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/site/layouts/intervention/publishing.php b/site/layouts/intervention/publishing.php index 1c812463..60f93718 100644 --- a/site/layouts/intervention/publishing.php +++ b/site/layouts/intervention/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/site/layouts/intervention/publlshing.php b/site/layouts/intervention/publlshing.php index 7767bba7..70767966 100644 --- a/site/layouts/intervention/publlshing.php +++ b/site/layouts/intervention/publlshing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'version', 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/site/layouts/intervention/settings_fullwidth.php b/site/layouts/intervention/settings_fullwidth.php index ae887369..00abf78b 100644 --- a/site/layouts/intervention/settings_fullwidth.php +++ b/site/layouts/intervention/settings_fullwidth.php @@ -1,52 +1,52 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'intervention' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage settings_fullwidth.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'intervention' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/site/layouts/intervention/settings_left.php b/site/layouts/intervention/settings_left.php index f41c46a9..e0c44f35 100644 --- a/site/layouts/intervention/settings_left.php +++ b/site/layouts/intervention/settings_left.php @@ -1,50 +1,50 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( - 'interventions' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage settings_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( + 'interventions' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/site/layouts/scaling_factor/details_above.php b/site/layouts/scaling_factor/details_above.php index 88d019c5..182fcc27 100644 --- a/site/layouts/scaling_factor/details_above.php +++ b/site/layouts/scaling_factor/details_above.php @@ -1,53 +1,53 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_above.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'company', - 'country' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'country' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/site/layouts/scaling_factor/details_left.php b/site/layouts/scaling_factor/details_left.php index 26c411f9..9d2b2280 100644 --- a/site/layouts/scaling_factor/details_left.php +++ b/site/layouts/scaling_factor/details_left.php @@ -1,51 +1,51 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_left.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'causerisk', - 'reference' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'reference' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/site/layouts/scaling_factor/details_right.php b/site/layouts/scaling_factor/details_right.php index 6a1160e2..0a3d8695 100644 --- a/site/layouts/scaling_factor/details_right.php +++ b/site/layouts/scaling_factor/details_right.php @@ -1,56 +1,56 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage details_right.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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( 'yld_scaling_factor_males', 'yld_scaling_factor_females', 'mortality_scaling_factor_males', 'mortality_scaling_factor_females', 'presenteeism_scaling_factor_males', 'presenteeism_scaling_factor_females', - 'health_scaling_factor' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'health_scaling_factor' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/site/layouts/scaling_factor/publishing.php b/site/layouts/scaling_factor/publishing.php index 1c812463..60f93718 100644 --- a/site/layouts/scaling_factor/publishing.php +++ b/site/layouts/scaling_factor/publishing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publishing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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)); ?> - - + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/site/layouts/scaling_factor/publlshing.php b/site/layouts/scaling_factor/publlshing.php index 7767bba7..70767966 100644 --- a/site/layouts/scaling_factor/publlshing.php +++ b/site/layouts/scaling_factor/publlshing.php @@ -1,54 +1,54 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// 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( +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publlshing.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// 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', 'version', 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/site/models/ajax.php b/site/models/ajax.php index e560a73f..366168c7 100644 --- a/site/models/ajax.php +++ b/site/models/ajax.php @@ -1,40 +1,40 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Ajax Model - */ -class CostbenefitprojectionModelAjax extends JModelList -{ - protected $app_params; - - public function __construct() - { - parent::__construct(); - // get params - $this->app_params = JComponentHelper::getParams('com_costbenefitprojection'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage ajax.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Ajax Model + */ +class CostbenefitprojectionModelAjax extends JModelList +{ + protected $app_params; + + public function __construct() + { + parent::__construct(); + // get params + $this->app_params = JComponentHelper::getParams('com_costbenefitprojection'); + } // Used in company @@ -282,5 +282,5 @@ public function getInterventionBuildTable($idName,$oject,$cluster) return true; } return false; - } -} + } +} diff --git a/site/models/combinedresults.php b/site/models/combinedresults.php index e2c753e9..d2f76781 100644 --- a/site/models/combinedresults.php +++ b/site/models/combinedresults.php @@ -1,62 +1,62 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Model for Combinedresults - */ -class CostbenefitprojectionModelCombinedresults extends JModelList -{ - /** - * Model user data. - * - * @var strings - */ - protected $user; - protected $userId; - protected $guest; - protected $groups; - protected $levels; - protected $app; - protected $input; - protected $uikitComp; - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { - // Get the current user for authorisation checks - $this->user = JFactory::getUser(); - $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->app = JFactory::getApplication(); - $this->input = $this->app->input; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage combinedresults.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Model for Combinedresults + */ +class CostbenefitprojectionModelCombinedresults extends JModelList +{ + /** + * Model user data. + * + * @var strings + */ + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; + protected $app; + protected $input; + protected $uikitComp; + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the current user for authorisation checks + $this->user = JFactory::getUser(); + $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->app = JFactory::getApplication(); + $this->input = $this->app->input; $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); @@ -127,16 +127,16 @@ class CostbenefitprojectionModelCombinedresults extends JModelList } // return the query object - return $query; - } - - /** - * Method to get an array of data items. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getItems() - { + return $query; + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { $user = JFactory::getUser(); // check if this user has permission to access item if (!$user->authorise('site.combinedresults.access', 'com_costbenefitprojection')) @@ -146,11 +146,11 @@ class CostbenefitprojectionModelCombinedresults extends JModelList // redirect away to the default view if no access allowed. $app->redirect(JRoute::_('index.php?option=com_costbenefitprojection&view=cpanel')); return false; - } - // load parent items - $items = parent::getItems(); - - // Get the global params + } + // load parent items + $items = parent::getItems(); + + // Get the global params $globalParams = JComponentHelper::getParams('com_costbenefitprojection', true); // Insure all item fields are adapted where needed. @@ -183,10 +183,10 @@ class CostbenefitprojectionModelCombinedresults extends JModelList // set countryCountryInterventionDD to the $item object. $item->countryCountryInterventionDD = $this->getCountryCountryInterventionBcbb_DD($item->country); } - } - - // return items - return $items; + } + + // return items + return $items; } /** @@ -331,7 +331,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'g')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('g.id IN (' . implode(',', $array) . ')'); @@ -422,7 +422,7 @@ class CostbenefitprojectionModelCombinedresults extends JModelList $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'gg')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('gg.id IN (' . implode(',', $array) . ')'); @@ -494,5 +494,5 @@ class CostbenefitprojectionModelCombinedresults extends JModelList return $this->uikitComp; } return false; - } -} + } +} diff --git a/site/models/company.php b/site/models/company.php index b7fd1932..d701e184 100644 --- a/site/models/company.php +++ b/site/models/company.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage company.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Company Model - */ -class CostbenefitprojectionModelCompany extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Company Model + */ +class CostbenefitprojectionModelCompany extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -82,68 +82,68 @@ class CostbenefitprojectionModelCompany extends JModelAdmin 'age_groups_note' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.company'; - - /** - * 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 = 'company', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.company'; + + /** + * 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 = 'company', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); } // Get the whmcs encryption. @@ -203,18 +203,12 @@ class CostbenefitprojectionModelCompany extends JModelAdmin { // JSON Decode causesrisks. $item->causesrisks = json_decode($item->causesrisks); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_costbenefitprojection.company'); - } + } } $this->companyvvvv = $item->id; - $this->companyvvvw = $item->id; - - return $item; + $this->companyvvvw = $item->id; + + return $item; } /** @@ -448,22 +442,22 @@ class CostbenefitprojectionModelCompany extends JModelAdmin } } return $value; - } - - /** - * 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 + } + + /** + * 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; @@ -740,29 +734,29 @@ class CostbenefitprojectionModelCompany extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/company.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) + 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_costbenefitprojection/js/company.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)) { @@ -775,19 +769,19 @@ class CostbenefitprojectionModelCompany extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('company.delete', 'com_costbenefitprojection.company.' . (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) + 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; @@ -802,104 +796,104 @@ class CostbenefitprojectionModelCompany extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('company.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('company.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('company.edit', 'com_costbenefitprojection.company.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('company.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_company')); - $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_costbenefitprojection.edit.company.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.company', $data); - } - - return $data; + return $user->authorise('company.edit', 'com_costbenefitprojection.company.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('company.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_company')); + $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_costbenefitprojection.edit.company.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.company', $data); + } + + return $data; } /** @@ -948,141 +942,141 @@ class CostbenefitprojectionModelCompany extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('company'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('company'); + $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; } /** @@ -1388,30 +1382,30 @@ class CostbenefitprojectionModelCompany extends JModelAdmin $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; + } + + /** + * 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 causesrisks item to data @@ -1484,14 +1478,14 @@ class CostbenefitprojectionModelCompany extends JModelAdmin if ($data['id'] == 0 && !$user->authorise('company.edit.per', 'com_costbenefitprojection')) { $data['per'] = 1; - } - - // 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; + } + + // 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 @@ -1506,37 +1500,37 @@ class CostbenefitprojectionModelCompany extends JModelAdmin $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; + } + + 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; } /** @@ -1559,5 +1553,5 @@ class CostbenefitprojectionModelCompany extends JModelAdmin } return $title; - } -} + } +} diff --git a/site/models/companyresults.php b/site/models/companyresults.php index 84d0e565..61289b6e 100644 --- a/site/models/companyresults.php +++ b/site/models/companyresults.php @@ -1,90 +1,90 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Companyresults Model - */ -class CostbenefitprojectionModelCompanyresults extends JModelItem -{ - /** - * Model context string. - * - * @var string - */ - protected $_context = 'com_costbenefitprojection.companyresults'; - - /** - * 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 itme main id - $id = $this->input->getInt('id', null); - $this->setState('companyresults.id', $id); - - // Load the parameters. - $params = $this->app->getParams(); - $this->setState('params', $params); - 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) - { +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage companyresults.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Companyresults Model + */ +class CostbenefitprojectionModelCompanyresults extends JModelItem +{ + /** + * Model context string. + * + * @var string + */ + protected $_context = 'com_costbenefitprojection.companyresults'; + + /** + * 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 itme main id + $id = $this->input->getInt('id', null); + $this->setState('companyresults.id', $id); + + // Load the parameters. + $params = $this->app->getParams(); + $this->setState('params', $params); + 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('site.companyresults.access', 'com_costbenefitprojection')) @@ -94,14 +94,14 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem // redirect away to the default view if no access allowed. $app->redirect(JRoute::_('index.php?option=com_costbenefitprojection&view=cpanel')); 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; - + } + $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('companyresults.id'); if (!$this->user->authorise('core.options', 'com_costbenefitprojection')) @@ -123,16 +123,16 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem } return false; } - } - - if ($this->_item === null) - { - $this->_item = array(); - } - - if (!isset($this->_item[$pk])) - { - try + } + + if ($this->_item === null) + { + $this->_item = array(); + } + + if (!isset($this->_item[$pk])) + { + try { // Get a db connection. $db = JFactory::getDbo(); @@ -196,24 +196,24 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem $data->countryCountryInterventionDD = $this->getCountryCountryInterventionEbbe_DD($data->country); // 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]; + $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]; } /** @@ -357,7 +357,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'g')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('g.id IN (' . implode(',', $array) . ')'); @@ -448,7 +448,7 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'gg')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('gg.id IN (' . implode(',', $array) . ')'); @@ -519,5 +519,5 @@ class CostbenefitprojectionModelCompanyresults extends JModelItem return $this->uikitComp; } return false; - } -} + } +} diff --git a/site/models/cpanel.php b/site/models/cpanel.php index 0f235099..722fbfb5 100644 --- a/site/models/cpanel.php +++ b/site/models/cpanel.php @@ -1,62 +1,62 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Model for Cpanel - */ -class CostbenefitprojectionModelCpanel extends JModelList -{ - /** - * Model user data. - * - * @var strings - */ - protected $user; - protected $userId; - protected $guest; - protected $groups; - protected $levels; - protected $app; - protected $input; - protected $uikitComp; - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { - // Get the current user for authorisation checks - $this->user = JFactory::getUser(); - $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->app = JFactory::getApplication(); - $this->input = $this->app->input; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage cpanel.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Model for Cpanel + */ +class CostbenefitprojectionModelCpanel extends JModelList +{ + /** + * Model user data. + * + * @var strings + */ + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; + protected $app; + protected $input; + protected $uikitComp; + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the current user for authorisation checks + $this->user = JFactory::getUser(); + $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->app = JFactory::getApplication(); + $this->input = $this->app->input; $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); @@ -99,16 +99,16 @@ class CostbenefitprojectionModelCpanel extends JModelList $query->order('a.ordering ASC'); // return the query object - return $query; - } - - /** - * Method to get an array of data items. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getItems() - { + return $query; + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { $user = JFactory::getUser(); // check if this user has permission to access item if (!$user->authorise('site.cpanel.access', 'com_costbenefitprojection')) @@ -118,11 +118,11 @@ class CostbenefitprojectionModelCpanel extends JModelList // redirect away to the home page if no access allowed. $app->redirect(JURI::root()); return false; - } - // load parent items - $items = parent::getItems(); - - // Get the global params + } + // load parent items + $items = parent::getItems(); + + // Get the global params $globalParams = JComponentHelper::getParams('com_costbenefitprojection', true); // Get the whmcs encryption. @@ -135,7 +135,7 @@ class CostbenefitprojectionModelCpanel extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's @@ -200,7 +200,7 @@ class CostbenefitprojectionModelCpanel extends JModelList $_country_publicaddress = new stdClass(); $_country_publicaddress->text =& $item->country_publicaddress; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (country_publicaddress) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.cpanel.country_publicaddress', &$_country_publicaddress, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.cpanel.country_publicaddress', &$_country_publicaddress, &$params, 0)); // Checking if country_publicaddress has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->country_publicaddress,$this->uikitComp); // Check if item has params, or pass whole item. @@ -209,7 +209,7 @@ class CostbenefitprojectionModelCpanel extends JModelList $_service_provider_publicaddress = new stdClass(); $_service_provider_publicaddress->text =& $item->service_provider_publicaddress; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (service_provider_publicaddress) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.cpanel.service_provider_publicaddress', &$_service_provider_publicaddress, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.cpanel.service_provider_publicaddress', &$_service_provider_publicaddress, &$params, 0)); // Checking if service_provider_publicaddress has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->service_provider_publicaddress,$this->uikitComp); // set idCompanyScaling_factorD to the $item object. @@ -217,10 +217,10 @@ class CostbenefitprojectionModelCpanel extends JModelList // set idCompanyInterventionE to the $item object. $item->idCompanyInterventionE = $this->getIdCompanyInterventionBdef_E($item->id); } - } - - // return items - return $items; + } + + // return items + return $items; } /** @@ -261,7 +261,7 @@ class CostbenefitprojectionModelCpanel extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. @@ -273,7 +273,7 @@ class CostbenefitprojectionModelCpanel extends JModelList $_reference = new stdClass(); $_reference->text =& $item->reference; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (reference) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.cpanel.reference', &$_reference, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.cpanel.reference', &$_reference, &$params, 0)); // Checking if reference has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->reference,$this->uikitComp); } @@ -314,7 +314,7 @@ class CostbenefitprojectionModelCpanel extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. @@ -332,7 +332,7 @@ class CostbenefitprojectionModelCpanel extends JModelList $_description = new stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.cpanel.description', &$_description, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.cpanel.description', &$_description, &$params, 0)); // Checking if description has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->description,$this->uikitComp); } @@ -355,5 +355,5 @@ class CostbenefitprojectionModelCpanel extends JModelList return $this->uikitComp; } return false; - } -} + } +} diff --git a/site/models/createaccount.php b/site/models/createaccount.php index f9e8b32d..5a37dfcb 100644 --- a/site/models/createaccount.php +++ b/site/models/createaccount.php @@ -1,62 +1,62 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Model for Createaccount - */ -class CostbenefitprojectionModelCreateaccount extends JModelList -{ - /** - * Model user data. - * - * @var strings - */ - protected $user; - protected $userId; - protected $guest; - protected $groups; - protected $levels; - protected $app; - protected $input; - protected $uikitComp; - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { - // Get the current user for authorisation checks - $this->user = JFactory::getUser(); - $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->app = JFactory::getApplication(); - $this->input = $this->app->input; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage createaccount.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Model for Createaccount + */ +class CostbenefitprojectionModelCreateaccount extends JModelList +{ + /** + * Model user data. + * + * @var strings + */ + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; + protected $app; + protected $input; + protected $uikitComp; + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the current user for authorisation checks + $this->user = JFactory::getUser(); + $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->app = JFactory::getApplication(); + $this->input = $this->app->input; $this->initSet = true; // Make sure all records load, since no pagination allowed. $this->setState('list.limit', 0); @@ -83,16 +83,16 @@ class CostbenefitprojectionModelCreateaccount extends JModelList $query->order('a.name ASC'); // return the query object - return $query; - } - - /** - * Method to get an array of data items. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getItems() - { + return $query; + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { $user = JFactory::getUser(); // check if this user has permission to access item if (!$user->authorise('site.createaccount.access', 'com_costbenefitprojection')) @@ -102,11 +102,11 @@ class CostbenefitprojectionModelCreateaccount extends JModelList // redirect away to the default view if no access allowed. $app->redirect(JRoute::_('index.php?option=com_costbenefitprojection&view=cpanel')); return false; - } - // load parent items - $items = parent::getItems(); - - // Get the global params + } + // load parent items + $items = parent::getItems(); + + // Get the global params $globalParams = JComponentHelper::getParams('com_costbenefitprojection', true); // Insure all item fields are adapted where needed. @@ -114,7 +114,7 @@ class CostbenefitprojectionModelCreateaccount extends JModelList { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's @@ -125,16 +125,16 @@ class CostbenefitprojectionModelCreateaccount extends JModelList $_publicaddress = new stdClass(); $_publicaddress->text =& $item->publicaddress; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (publicaddress) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.createaccount.publicaddress', &$_publicaddress, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.createaccount.publicaddress', &$_publicaddress, &$params, 0)); // Checking if publicaddress has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->publicaddress,$this->uikitComp); // set idCountryService_providerB to the $item object. $item->idCountryService_providerB = $this->getIdCountryService_providerCace_B($item->id); } - } - - // return items - return $items; + } + + // return items + return $items; } /** @@ -187,5 +187,5 @@ class CostbenefitprojectionModelCreateaccount extends JModelList return $this->uikitComp; } return false; - } -} + } +} diff --git a/site/models/forms/company.js b/site/models/forms/company.js index 77361c2c..b32b8603 100644 --- a/site/models/forms/company.js +++ b/site/models/forms/company.js @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage company.js - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage company.js + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + // Some Global Values jform_vvvvvvvvvv_required = false; jform_vvvvvvvvvw_required = false; @@ -358,4 +358,4 @@ function updateSelection(row) jQuery(row).find(".chzn-single:first span").text(text); } } -} +} diff --git a/site/models/forms/company.xml b/site/models/forms/company.xml index 6d27626e..d779e054 100644 --- a/site/models/forms/company.xml +++ b/site/models/forms/company.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -519,8 +519,8 @@ message="COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_FEMALES_MESSAGE" hint="COM_COSTBENEFITPROJECTION_COMPANY_MEDICAL_TURNOVERS_FEMALES_HINT" /> -
- + +
@@ -541,5 +541,5 @@ component="com_costbenefitprojection" section="company" /> -
+
\ No newline at end of file diff --git a/site/models/forms/intervention.js b/site/models/forms/intervention.js index 61512f9b..7f86d178 100644 --- a/site/models/forms/intervention.js +++ b/site/models/forms/intervention.js @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage intervention.js - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage intervention.js + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + // Some Global Values jform_vvvvvvyvwj_required = false; jform_vvvvvwavwk_required = false; @@ -341,4 +341,4 @@ function changeFieldValue(id,value) { } } - + diff --git a/site/models/forms/intervention.xml b/site/models/forms/intervention.xml index e3121ba6..e15d367a 100644 --- a/site/models/forms/intervention.xml +++ b/site/models/forms/intervention.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -285,8 +285,8 @@ default="0" required="true" /> -
- + +
@@ -307,5 +307,5 @@ component="com_costbenefitprojection" section="intervention" /> -
+
\ No newline at end of file diff --git a/site/models/forms/scaling_factor.js b/site/models/forms/scaling_factor.js index 59440fcf..03e4d7bb 100644 --- a/site/models/forms/scaling_factor.js +++ b/site/models/forms/scaling_factor.js @@ -1,21 +1,21 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage scaling_factor.js - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factor.js + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + // Some Global Values jform_vvvvvvxvwi_required = false; @@ -131,4 +131,4 @@ function isSet(val) return true; } return false; -} +} diff --git a/site/models/forms/scaling_factor.xml b/site/models/forms/scaling_factor.xml index a25aae0e..f1db2024 100644 --- a/site/models/forms/scaling_factor.xml +++ b/site/models/forms/scaling_factor.xml @@ -1,8 +1,8 @@ - -
+ +
@@ -247,8 +247,8 @@ default="0" required="true" /> -
- + +
@@ -269,5 +269,5 @@ component="com_costbenefitprojection" section="scaling_factor" /> -
+
\ No newline at end of file diff --git a/site/models/intervention.php b/site/models/intervention.php index 9bd469d4..c6f760bf 100644 --- a/site/models/intervention.php +++ b/site/models/intervention.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage intervention.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Intervention Model - */ -class CostbenefitprojectionModelIntervention extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Intervention Model + */ +class CostbenefitprojectionModelIntervention extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'fullwidth' => array( @@ -61,100 +61,94 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin 'intervention' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.intervention'; - - /** - * 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 = 'intervention', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.intervention'; + + /** + * 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 = 'intervention', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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->interventions)) { // JSON Decode interventions. $item->interventions = json_decode($item->interventions); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_costbenefitprojection.intervention'); - } - } - - 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 + } + } + + 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; @@ -247,29 +241,29 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/intervention.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) + 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_costbenefitprojection/js/intervention.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)) { @@ -282,19 +276,19 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('intervention.delete', 'com_costbenefitprojection.intervention.' . (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) + 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; @@ -309,104 +303,104 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('intervention.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('intervention.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('intervention.edit', 'com_costbenefitprojection.intervention.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('intervention.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_intervention')); - $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_costbenefitprojection.edit.intervention.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.intervention', $data); - } - - return $data; + return $user->authorise('intervention.edit', 'com_costbenefitprojection.intervention.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('intervention.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_intervention')); + $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_costbenefitprojection.edit.intervention.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.intervention', $data); + } + + return $data; } /** @@ -455,141 +449,141 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('intervention'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('intervention'); + $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; } /** @@ -929,44 +923,44 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin $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; + } + + /** + * 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 interventions string to JSON string. if (isset($data['interventions'])) { $data['interventions'] = (string) json_encode($data['interventions']); - } - - // 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; + } + + // 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 @@ -981,37 +975,37 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin $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; + } + + 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; } /** @@ -1034,5 +1028,5 @@ class CostbenefitprojectionModelIntervention extends JModelAdmin } return $title; - } -} + } +} diff --git a/site/models/publicresults.php b/site/models/publicresults.php index 131c3361..e5ec4d44 100644 --- a/site/models/publicresults.php +++ b/site/models/publicresults.php @@ -1,98 +1,98 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Publicresults Model - */ -class CostbenefitprojectionModelPublicresults extends JModelItem -{ - /** - * Model context string. - * - * @var string - */ - protected $_context = 'com_costbenefitprojection.publicresults'; - - /** - * 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 itme main id - $id = $this->input->getInt('id', null); - $this->setState('publicresults.id', $id); - - // Load the parameters. - $params = $this->app->getParams(); - $this->setState('params', $params); - 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(); - $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; - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage publicresults.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Publicresults Model + */ +class CostbenefitprojectionModelPublicresults extends JModelItem +{ + /** + * Model context string. + * + * @var string + */ + protected $_context = 'com_costbenefitprojection.publicresults'; + + /** + * 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 itme main id + $id = $this->input->getInt('id', null); + $this->setState('publicresults.id', $id); + + // Load the parameters. + $params = $this->app->getParams(); + $this->setState('params', $params); + 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(); + $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('publicresults.id'); if (!$pk) @@ -101,16 +101,16 @@ class CostbenefitprojectionModelPublicresults extends JModelItem // redirect away if not a correct (TODO for now we go to default view) JFactory::getApplication()->redirect('index.php?option=com_costbenefitprojection&view=cpanel'); return false; - } - - if ($this->_item === null) - { - $this->_item = array(); - } - - if (!isset($this->_item[$pk])) - { - try + } + + if ($this->_item === null) + { + $this->_item = array(); + } + + if (!isset($this->_item[$pk])) + { + try { // Get a db connection. $db = JFactory::getDbo(); @@ -152,7 +152,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem } // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); // Check if we can decode causesrisks if (CostbenefitprojectionHelper::checkJson($data->causesrisks)) { @@ -171,7 +171,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem $_country_publicaddress = new stdClass(); $_country_publicaddress->text =& $data->country_publicaddress; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (country_publicaddress) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.publicresults.country_publicaddress', &$_country_publicaddress, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.publicresults.country_publicaddress', &$_country_publicaddress, &$params, 0)); // Checking if country_publicaddress has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($data->country_publicaddress,$this->uikitComp); // set the global causesrisks value. @@ -194,21 +194,21 @@ class CostbenefitprojectionModelPublicresults extends JModelItem $data->idCountryInterventionDD = $this->getIdCountryInterventionDadd_DD($data->country); // 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; - } - } + $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; + } + } } // make sure the sum class knows this is a public request @@ -222,9 +222,9 @@ class CostbenefitprojectionModelPublicresults extends JModelItem $this->_item[$pk]->females = round($employees / 2); } // set total salary - $this->_item[$pk]->total_salary = $this->input->get('salary', 0, 'INT'); - - return $this->_item[$pk]; + $this->_item[$pk]->total_salary = $this->input->get('salary', 0, 'INT'); + + return $this->_item[$pk]; } /** @@ -272,7 +272,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -299,7 +299,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'g')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('g.id IN (' . implode(',', $array) . ')'); @@ -318,7 +318,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. @@ -330,7 +330,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem $_description = new stdClass(); $_description->text =& $item->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.publicresults.description', &$_description, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.publicresults.description', &$_description, &$params, 0)); // Checking if description has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->description,$this->uikitComp); } @@ -384,7 +384,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -411,7 +411,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'gg')); // Check if $causesrisks is an array with values. - $array = $causesrisks; + $array = (CostbenefitprojectionHelper::checkJson($causesrisks, true)) ? json_decode($causesrisks,true) : $causesrisks; if (isset($array) && CostbenefitprojectionHelper::checkArray($array, true)) { $query->where('gg.id IN (' . implode(',', $array) . ')'); @@ -430,7 +430,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); return $db->loadObjectList(); } return false; @@ -466,7 +466,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); $items = $db->loadObjectList(); // Convert the parameter fields into objects. @@ -484,7 +484,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem $_reference = new stdClass(); $_reference->text =& $item->reference; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (reference) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_costbenefitprojection.publicresults.reference', &$_reference, &$params, 0)); + $this->_dispatcher->triggerEvent("onContentPrepare", array('com_costbenefitprojection.publicresults.reference', &$_reference, &$params, 0)); // Checking if reference has uikit components that must be loaded. $this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->reference,$this->uikitComp); } @@ -546,7 +546,7 @@ class CostbenefitprojectionModelPublicresults extends JModelItem { // Load the JEvent Dispatcher JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); + $this->_dispatcher = JFactory::getApplication(); foreach ($items as $nr => &$item) { // Always create a slug for sef URL's @@ -570,5 +570,5 @@ class CostbenefitprojectionModelPublicresults extends JModelItem return $this->uikitComp; } return false; - } -} + } +} diff --git a/site/models/scaling_factor.php b/site/models/scaling_factor.php index 65065dd2..ad8a0005 100644 --- a/site/models/scaling_factor.php +++ b/site/models/scaling_factor.php @@ -1,39 +1,39 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage scaling_factor.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + use Joomla\Registry\Registry; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Costbenefitprojection Scaling_factor Model - */ -class CostbenefitprojectionModelScaling_factor extends JModelAdmin -{ - /** - * The tab layout fields array. - * - * @var array - */ +use Joomla\Utilities\ArrayHelper; + +/** + * Costbenefitprojection Scaling_factor Model + */ +class CostbenefitprojectionModelScaling_factor extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ protected $tabLayoutFields = array( 'details' => array( 'left' => array( @@ -54,94 +54,88 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin 'country' ) ) - ); - - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_costbenefitprojection.scaling_factor'; - - /** - * 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 = 'scaling_factor', $prefix = 'CostbenefitprojectionTable', $config = array()) - { - // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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_costbenefitprojection.scaling_factor'); - } - } - - 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 + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_COSTBENEFITPROJECTION'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_costbenefitprojection.scaling_factor'; + + /** + * 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 = 'scaling_factor', $prefix = 'CostbenefitprojectionTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_costbenefitprojection/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(); + } + } + + 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; @@ -234,29 +228,29 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin $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 'administrator/components/com_costbenefitprojection/models/forms/scaling_factor.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) + 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_costbenefitprojection/js/scaling_factor.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)) { @@ -269,19 +263,19 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin // The record has been set. Check the record permissions. return $user->authorise('scaling_factor.delete', 'com_costbenefitprojection.scaling_factor.' . (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) + 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; @@ -296,104 +290,104 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin } } // In the absense of better information, revert to the component permissions. - return $user->authorise('scaling_factor.edit.state', 'com_costbenefitprojection'); - } - - /** - * 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') + return $user->authorise('scaling_factor.edit.state', 'com_costbenefitprojection'); + } + + /** + * 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. $user = JFactory::getUser(); - return $user->authorise('scaling_factor.edit', 'com_costbenefitprojection.scaling_factor.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('scaling_factor.edit', 'com_costbenefitprojection'); - } - - /** - * 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('#__costbenefitprojection_scaling_factor')); - $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_costbenefitprojection.edit.scaling_factor.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - // run the perprocess of the data - $this->preprocessData('com_costbenefitprojection.scaling_factor', $data); - } - - return $data; + return $user->authorise('scaling_factor.edit', 'com_costbenefitprojection.scaling_factor.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('scaling_factor.edit', 'com_costbenefitprojection'); + } + + /** + * 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('#__costbenefitprojection_scaling_factor')); + $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_costbenefitprojection.edit.scaling_factor.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_costbenefitprojection.scaling_factor', $data); + } + + return $data; } /** @@ -442,141 +436,141 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin 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 = CostbenefitprojectionHelper::getActions('scaling_factor'); - $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; + } + + /** + * 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 = CostbenefitprojectionHelper::getActions('scaling_factor'); + $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; } /** @@ -888,38 +882,38 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin $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; + } + + /** + * 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 @@ -934,37 +928,37 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin $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; + } + + 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; } /** @@ -987,5 +981,5 @@ class CostbenefitprojectionModelScaling_factor extends JModelAdmin } return $title; - } -} + } +} diff --git a/site/router.php b/site/router.php index f828c3a2..e2b72933 100644 --- a/site/router.php +++ b/site/router.php @@ -1,129 +1,129 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Routing class from com_costbenefitprojection - * - * @since 3.3 - */ -class CostbenefitprojectionRouter extends JComponentRouterBase -{ - /** - * Build the route for the com_costbenefitprojection component - * - * @param array &$query An array of URL arguments - * - * @return array The URL arguments to use to assemble the subsequent URL. - * - * @since 3.3 - */ - public function build(&$query) - { - $segments = array(); - - // Get a menu item based on Itemid or currently active - $params = JComponentHelper::getParams('com_costbenefitprojection'); - - if (empty($query['Itemid'])) - { - $menuItem = $this->menu->getActive(); - } - else - { - $menuItem = $this->menu->getItem($query['Itemid']); - } - - $mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view']; - $mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id']; - - if (isset($query['view'])) - { - $view = $query['view']; - - if (empty($query['Itemid'])) - { - $segments[] = $query['view']; - } - - unset($query['view']); - } - - // Are we dealing with a item that is attached to a menu item? - if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id'])) - { - unset($query['view']); - unset($query['catid']); - unset($query['id']); - return $segments; - } - - if (isset($view) && isset($query['id']) && ($view === 'company' || $view === 'scaling_factor' || $view === 'intervention' || $view === 'cpanel' || $view === 'publicresults' || $view === 'createaccount' || $view === 'companyresults' || $view === 'combinedresults')) - { - if ($mId != (int) $query['id'] || $mView != $view) - { - if (($view === 'company' || $view === 'scaling_factor' || $view === 'intervention' || $view === 'cpanel' || $view === 'publicresults' || $view === 'createaccount' || $view === 'companyresults' || $view === 'combinedresults')) - { - $segments[] = $view; - $id = explode(':', $query['id']); - if (count($id) == 2) - { - $segments[] = $id[1]; - } - else - { - $segments[] = $id[0]; - } - } - } - unset($query['id']); - } - - $total = count($segments); - - for ($i = 0; $i < $total; $i++) - { - $segments[$i] = str_replace(':', '-', $segments[$i]); - } - - return $segments; - - } - - /** - * Parse the segments of a URL. - * - * @param array &$segments The segments of the URL to parse. - * - * @return array The URL attributes to be used by the application. - * - * @since 3.3 - */ - public function parse(&$segments) - { - $count = count($segments); - $vars = array(); - - //Handle View and Identifier - switch($segments[0]) +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage router.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Routing class from com_costbenefitprojection + * + * @since 3.3 + */ +class CostbenefitprojectionRouter extends JComponentRouterBase +{ + /** + * Build the route for the com_costbenefitprojection component + * + * @param array &$query An array of URL arguments + * + * @return array The URL arguments to use to assemble the subsequent URL. + * + * @since 3.3 + */ + public function build(&$query) + { + $segments = array(); + + // Get a menu item based on Itemid or currently active + $params = JComponentHelper::getParams('com_costbenefitprojection'); + + if (empty($query['Itemid'])) + { + $menuItem = $this->menu->getActive(); + } + else + { + $menuItem = $this->menu->getItem($query['Itemid']); + } + + $mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view']; + $mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id']; + + if (isset($query['view'])) + { + $view = $query['view']; + + if (empty($query['Itemid']) && !(isset($view) && isset($query['id']) && ($view === 'company' || $view === 'scaling_factor' || $view === 'intervention' || $view === 'cpanel' || $view === 'publicresults' || $view === 'createaccount' || $view === 'companyresults' || $view === 'combinedresults'))) + { + $segments[] = $query['view']; + } + + unset($query['view']); + } + + // Are we dealing with a item that is attached to a menu item? + if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id'])) + { + unset($query['view']); + unset($query['catid']); + unset($query['id']); + return $segments; + } + + if (isset($view) && isset($query['id']) && ($view === 'company' || $view === 'scaling_factor' || $view === 'intervention' || $view === 'cpanel' || $view === 'publicresults' || $view === 'createaccount' || $view === 'companyresults' || $view === 'combinedresults')) + { + if ($mId != (int) $query['id'] || $mView != $view) + { + if (($view === 'company' || $view === 'scaling_factor' || $view === 'intervention' || $view === 'cpanel' || $view === 'publicresults' || $view === 'createaccount' || $view === 'companyresults' || $view === 'combinedresults')) + { + $segments[] = $view; + $id = explode(':', $query['id']); + if (count($id) == 2) + { + $segments[] = $id[1]; + } + else + { + $segments[] = $id[0]; + } + } + } + unset($query['id']); + } + + $total = count($segments); + + for ($i = 0; $i < $total; $i++) + { + $segments[$i] = str_replace(':', '-', $segments[$i]); + } + + return $segments; + + } + + /** + * Parse the segments of a URL. + * + * @param array &$segments The segments of the URL to parse. + * + * @return array The URL attributes to be used by the application. + * + * @since 3.3 + */ + public function parse(&$segments) + { + $count = count($segments); + $vars = array(); + + // Handle View and Identifier + switch($segments[0]) { case 'company': $vars['view'] = 'company'; @@ -220,98 +220,98 @@ class CostbenefitprojectionRouter extends JComponentRouterBase $vars['id'] = $id; } } - break; - } - - return $vars; - } - - protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = 'costbenefitprojection') - { - if(!$where || !$what || !$whereString) - { - return false; - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName(array($what))); - if ('categories' == $table || 'category' == $table || $category) - { - $getTable = '#__categories'; - $query->from($db->quoteName($getTable)); - // we need this to target the components categories (TODO will keep an eye on this) - $query->where($db->quoteName('extension') . ' LIKE '. $db->quote((string)'com_' . $main . '%')); - } - else - { - // we must check if the table exist (TODO not ideal) - $tables = $db->getTableList(); - $app = JFactory::getApplication(); - $prefix = $app->get('dbprefix'); - $check = $prefix.$main.'_'.$table; - if (in_array($check, $tables)) - { - $getTable = '#__'.$main.'_'.$table; - $query->from($db->quoteName($getTable)); - } - else - { - return false; - } - } - if (is_numeric($where)) - { - return false; - } - elseif ($this->checkString($where)) - { - // we must first check if this table has the column - $columns = $db->getTableColumns($getTable); - if (isset($columns[$whereString])) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); - } - else - { - return false; - } - } - else - { - return false; - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadResult(); - } - return false; - } - - protected function checkString($string) - { - if (isset($string) && is_string($string) && strlen($string) > 0) - { - return true; - } - return false; - } -} - -function CostbenefitprojectionBuildRoute(&$query) -{ - $router = new CostbenefitprojectionRouter; - - return $router->build($query); -} - -function CostbenefitprojectionParseRoute($segments) -{ - $router = new CostbenefitprojectionRouter; - - return $router->parse($segments); + break; + } + + return $vars; + } + + protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = 'costbenefitprojection') + { + if(!$where || !$what || !$whereString) + { + return false; + } + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + + $query->select($db->quoteName(array($what))); + if ('categories' == $table || 'category' == $table || $category) + { + $getTable = '#__categories'; + $query->from($db->quoteName($getTable)); + // we need this to target the components categories (TODO will keep an eye on this) + $query->where($db->quoteName('extension') . ' LIKE '. $db->quote((string)'com_' . $main . '%')); + } + else + { + // we must check if the table exist (TODO not ideal) + $tables = $db->getTableList(); + $app = JFactory::getApplication(); + $prefix = $app->get('dbprefix'); + $check = $prefix.$main.'_'.$table; + if (in_array($check, $tables)) + { + $getTable = '#__'.$main.'_'.$table; + $query->from($db->quoteName($getTable)); + } + else + { + return false; + } + } + if (is_numeric($where)) + { + return false; + } + elseif ($this->checkString($where)) + { + // we must first check if this table has the column + $columns = $db->getTableColumns($getTable); + if (isset($columns[$whereString])) + { + $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); + } + else + { + return false; + } + } + else + { + return false; + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + return $db->loadResult(); + } + return false; + } + + protected function checkString($string) + { + if (isset($string) && is_string($string) && strlen($string) > 0) + { + return true; + } + return false; + } +} + +function CostbenefitprojectionBuildRoute(&$query) +{ + $router = new CostbenefitprojectionRouter; + + return $router->build($query); +} + +function CostbenefitprojectionParseRoute($segments) +{ + $router = new CostbenefitprojectionRouter; + + return $router->parse($segments); } \ No newline at end of file diff --git a/site/views/combinedresults/tmpl/default.php b/site/views/combinedresults/tmpl/default.php index 12c4e202..dbd2a423 100644 --- a/site/views/combinedresults/tmpl/default.php +++ b/site/views/combinedresults/tmpl/default.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + // set the active tabs based on interventions @@ -32,8 +32,8 @@ else { $savings = ''; $details = 'uk-active '; -} -?> +} +?>

@@ -249,4 +249,4 @@ function controlSwitch(){ jQuery(".unscaled").css( "display", "none" ); }; } - + diff --git a/site/views/combinedresults/tmpl/default_chart_cost.php b/site/views/combinedresults/tmpl/default_chart_cost.php index d6a946a5..3aa54a29 100644 --- a/site/views/combinedresults/tmpl/default_chart_cost.php +++ b/site/views/combinedresults/tmpl/default_chart_cost.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_cost.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -61,8 +61,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi $options = array( 'backgroundColor' => $this->Chart['backgroundColor'], 'width' => $this->Chart['width'], 'height' => $height, 'chartArea' => $this->Chart['chartArea'], 'legend' => $this->Chart['legend'], 'vAxis' => $this->Chart['vAxis'], 'hAxis' => array('textStyle' => $this->Chart['hAxis']['textStyle'], 'title' => $title, 'titleTextStyle' => $this->Chart['hAxis']['titleTextStyle'])); echo $chart->draw('c_'.$scale, $options); } -} - +} + ?>
@@ -76,4 +76,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+
diff --git a/site/views/combinedresults/tmpl/default_chart_cost_percent.php b/site/views/combinedresults/tmpl/default_chart_cost_percent.php index 3b0ea359..fa2dde6a 100644 --- a/site/views/combinedresults/tmpl/default_chart_cost_percent.php +++ b/site/views/combinedresults/tmpl/default_chart_cost_percent.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_cost_percent.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -55,8 +55,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('cp_'.$scale, $options); } -} - +} + ?>
@@ -69,4 +69,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/site/views/combinedresults/tmpl/default_chart_intervention_cost_benefit.php b/site/views/combinedresults/tmpl/default_chart_intervention_cost_benefit.php index e51bd3fc..0e240752 100644 --- a/site/views/combinedresults/tmpl/default_chart_intervention_cost_benefit.php +++ b/site/views/combinedresults/tmpl/default_chart_intervention_cost_benefit.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_intervention_cost_benefit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -79,8 +79,8 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr } } } -} - +} + ?>
@@ -99,4 +99,4 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr
-
+ diff --git a/site/views/combinedresults/tmpl/default_chart_intervention_cost_benefit_save.php b/site/views/combinedresults/tmpl/default_chart_intervention_cost_benefit_save.php index c7e665bb..bc585676 100644 --- a/site/views/combinedresults/tmpl/default_chart_intervention_cost_benefit_save.php +++ b/site/views/combinedresults/tmpl/default_chart_intervention_cost_benefit_save.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_intervention_cost_benefit_save.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -83,8 +83,8 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr $no_intervention[] = $intervention->name; } } -} - +} + ?> results->interventions) && CostbenefitprojectionHelper::checkArray($this->results->interventions)): ?> @@ -122,4 +122,4 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr
- + diff --git a/site/views/combinedresults/tmpl/default_chart_work_days_lost.php b/site/views/combinedresults/tmpl/default_chart_work_days_lost.php index 05aa0db7..0f0e31f4 100644 --- a/site/views/combinedresults/tmpl/default_chart_work_days_lost.php +++ b/site/views/combinedresults/tmpl/default_chart_work_days_lost.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_work_days_lost.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -61,8 +61,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('wdl_'.$scale, $options); } -} - +} + ?>
@@ -75,4 +75,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/site/views/combinedresults/tmpl/default_chart_work_days_lost_percent.php b/site/views/combinedresults/tmpl/default_chart_work_days_lost_percent.php index b00deabe..6725bfbb 100644 --- a/site/views/combinedresults/tmpl/default_chart_work_days_lost_percent.php +++ b/site/views/combinedresults/tmpl/default_chart_work_days_lost_percent.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_work_days_lost_percent.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -55,8 +55,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('wdlp_'.$scale, $options); } -} - +} + ?>
@@ -69,4 +69,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/site/views/combinedresults/tmpl/default_table_calculated_cost_in_detail.php b/site/views/combinedresults/tmpl/default_table_calculated_cost_in_detail.php index b7d536ef..b5e10139 100644 --- a/site/views/combinedresults/tmpl/default_table_calculated_cost_in_detail.php +++ b/site/views/combinedresults/tmpl/default_table_calculated_cost_in_detail.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_calculated_cost_in_detail.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -64,4 +64,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/site/views/combinedresults/tmpl/default_table_cost_summary.php b/site/views/combinedresults/tmpl/default_table_cost_summary.php index 67f18adf..e39882d2 100644 --- a/site/views/combinedresults/tmpl/default_table_cost_summary.php +++ b/site/views/combinedresults/tmpl/default_table_cost_summary.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_cost_summary.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -67,4 +67,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/site/views/combinedresults/tmpl/default_table_intervention_net_benefit.php b/site/views/combinedresults/tmpl/default_table_intervention_net_benefit.php index 50d0f0ce..8494bbea 100644 --- a/site/views/combinedresults/tmpl/default_table_intervention_net_benefit.php +++ b/site/views/combinedresults/tmpl/default_table_intervention_net_benefit.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_intervention_net_benefit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -96,4 +96,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/site/views/combinedresults/tmpl/default_table_work_days_lost_summary.php b/site/views/combinedresults/tmpl/default_table_work_days_lost_summary.php index 058ae0ae..01c3df21 100644 --- a/site/views/combinedresults/tmpl/default_table_work_days_lost_summary.php +++ b/site/views/combinedresults/tmpl/default_table_work_days_lost_summary.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_work_days_lost_summary.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -76,4 +76,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/site/views/combinedresults/view.html.php b/site/views/combinedresults/view.html.php index 0a70f014..6ad1b765 100644 --- a/site/views/combinedresults/view.html.php +++ b/site/views/combinedresults/view.html.php @@ -1,38 +1,38 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Costbenefitprojection View class for the Combinedresults - */ -class CostbenefitprojectionViewCombinedresults extends JViewLegacy -{ - // Overwriting JView display method - function display($tpl = null) - { - // get combined params of both component and menu - $this->app = JFactory::getApplication(); - $this->params = $this->app->getParams(); - $this->menu = $this->app->getMenu()->getActive(); - // get the user object +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Costbenefitprojection View class for the Combinedresults + */ +class CostbenefitprojectionViewCombinedresults extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get combined params of both component and menu + $this->app = JFactory::getApplication(); + $this->params = $this->app->getParams(); + $this->menu = $this->app->getMenu()->getActive(); + // get the user object $this->user = JFactory::getUser(); // Initialise variables. $this->items = $this->get('Items'); @@ -68,13 +68,13 @@ class CostbenefitprojectionViewCombinedresults extends JViewLegacy throw new Exception(implode(PHP_EOL, $errors), 500); } - parent::display($tpl); - } - - /** - * Prepares the document - */ - protected function _prepareDocument() + parent::display($tpl); + } + + /** + * Prepares the document + */ + protected function _prepareDocument() { // always make sure jquery is loaded. @@ -106,21 +106,19 @@ class CostbenefitprojectionViewCombinedresults extends JViewLegacy $uikitComp = $this->get('UikitComp'); if ($uikit != 2 && isset($uikitComp) && CostbenefitprojectionHelper::checkArray($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { foreach (CostbenefitprojectionHelper::$uk_components[$class] as $name) { // check if the CSS file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. $this->document->addStyleSheet(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); } // check if the JavaScript file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. $this->document->addScript(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); @@ -167,37 +165,37 @@ class CostbenefitprojectionViewCombinedresults extends JViewLegacy $this->Chart['legend'] = array( 'textStyle' => array('fontSize' => $this->params->get('site_legendtextstylefontsize'), 'color' => $this->params->get('site_legendtextstylefontcolor'))); $this->Chart['vAxis'] = array('textStyle' => array('color' => $this->params->get('site_vaxistextstylefontcolor'))); $this->Chart['hAxis']['textStyle'] = array('color' => $this->params->get('site_haxistextstylefontcolor')); - $this->Chart['hAxis']['titleTextStyle'] = array('color' => $this->params->get('site_haxistitletextstylefontcolor')); - // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/combinedresults.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - - // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('combinedresults'); - if (CostbenefitprojectionHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); - } - - /** - * 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, $sorten = false, $length = 40) - { - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); - } -} + $this->Chart['hAxis']['titleTextStyle'] = array('color' => $this->params->get('site_haxistitletextstylefontcolor')); + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/combinedresults.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + + // set help url for this view if found + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('combinedresults'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) + { + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = JToolbar::getInstance(); + } + + /** + * 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, $sorten = false, $length = 40) + { + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); + } +} diff --git a/site/views/company/submitbutton.js b/site/views/company/submitbutton.js index 53fafe2f..589f1f7f 100644 --- a/site/views/company/submitbutton.js +++ b/site/views/company/submitbutton.js @@ -1,33 +1,33 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage submitbutton.js - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -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._('company, some values are not acceptable.','Some values are unacceptable')); - return false; - } - } +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +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._('company, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } } \ No newline at end of file diff --git a/site/views/company/tmpl/edit.php b/site/views/company/tmpl/edit.php index 694c9608..4ed21180 100644 --- a/site/views/company/tmpl/edit.php +++ b/site/views/company/tmpl/edit.php @@ -1,36 +1,33 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage edit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); -JHtml::_('behavior.tabstate'); -JHtml::_('behavior.calendar'); -?> -
-toolbar->render(); ?> -
+?> +
+toolbar->render(); ?> +
@@ -143,8 +140,8 @@ JHtml::_('behavior.calendar');
- - + +
+ diff --git a/site/views/company/view.html.php b/site/views/company/view.html.php index ec664e3f..8bb7e66d 100644 --- a/site/views/company/view.html.php +++ b/site/views/company/view.html.php @@ -1,96 +1,96 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Company View class - */ -class CostbenefitprojectionViewCompany extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // set params - $this->params = JComponentHelper::getParams('com_costbenefitprojection'); - // 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 = CostbenefitprojectionHelper::getActions('company', $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; +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Company View class + */ +class CostbenefitprojectionViewCompany extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_costbenefitprojection'); + // 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 = CostbenefitprojectionHelper::getActions('company', $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->vwcscaling_factors = $this->get('Vwcscaling_factors'); // Get Linked view data - $this->vwdinterventions = $this->get('Vwdinterventions'); - - // 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() + $this->vwdinterventions = $this->get('Vwdinterventions'); + + // 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; @@ -162,57 +162,57 @@ class CostbenefitprojectionViewCompany extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('company'); - if (CostbenefitprojectionHelper::checkString($help_url)) + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('company'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); - } - - /** - * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_COMPANY_NEW' : 'COM_COSTBENEFITPROJECTION_COMPANY_EDIT')); - // only add the ISIS template css & js if needed (default is 1 = true) - // you can override this in the global component options - // just add a (radio yes/no field) with a name called add_isis_template - // to your components config area - if ($this->params->get('add_isis_template', 1)) - { - // we need this to fix the form display (TODO) - $this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - } - // the default style of this view + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = JToolbar::getInstance(); + } + + /** + * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_COMPANY_NEW' : 'COM_COSTBENEFITPROJECTION_COMPANY_EDIT')); + // only add the ISIS template css & js if needed (default is 1 = true) + // you can override this in the global component options + // just add a (radio yes/no field) with a name called add_isis_template + // to your components config area + if ($this->params->get('add_isis_template', 1)) + { + // we need this to fix the form display (TODO) + $this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + } + // the default style of this view $this->document->addStyleSheet(JURI::root()."components/com_costbenefitprojection/assets/css/company.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); // Add Ajax Token $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); @@ -239,10 +239,10 @@ class CostbenefitprojectionViewCompany extends JViewLegacy $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); - - // default javascript of this view - $this->document->addScript(JURI::root(). $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root(). "components/com_costbenefitprojection/views/company/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} + + // default javascript of this view + $this->document->addScript(JURI::root(). $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root(). "components/com_costbenefitprojection/views/company/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/site/views/companyresults/tmpl/default.php b/site/views/companyresults/tmpl/default.php index 884b13d0..93e546d4 100644 --- a/site/views/companyresults/tmpl/default.php +++ b/site/views/companyresults/tmpl/default.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + // set the active tabs based on interventions @@ -32,8 +32,8 @@ else { $savings = ''; $details = 'uk-active '; -} -?> +} +?>
toolbar->render(); ?>

@@ -248,4 +248,4 @@ function controlSwitch(){ jQuery(".unscaled").css( "display", "none" ); }; } - + diff --git a/site/views/companyresults/tmpl/default_chart_cost.php b/site/views/companyresults/tmpl/default_chart_cost.php index d6a946a5..3aa54a29 100644 --- a/site/views/companyresults/tmpl/default_chart_cost.php +++ b/site/views/companyresults/tmpl/default_chart_cost.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_cost.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -61,8 +61,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi $options = array( 'backgroundColor' => $this->Chart['backgroundColor'], 'width' => $this->Chart['width'], 'height' => $height, 'chartArea' => $this->Chart['chartArea'], 'legend' => $this->Chart['legend'], 'vAxis' => $this->Chart['vAxis'], 'hAxis' => array('textStyle' => $this->Chart['hAxis']['textStyle'], 'title' => $title, 'titleTextStyle' => $this->Chart['hAxis']['titleTextStyle'])); echo $chart->draw('c_'.$scale, $options); } -} - +} + ?>
@@ -76,4 +76,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+
diff --git a/site/views/companyresults/tmpl/default_chart_cost_percent.php b/site/views/companyresults/tmpl/default_chart_cost_percent.php index 3b0ea359..fa2dde6a 100644 --- a/site/views/companyresults/tmpl/default_chart_cost_percent.php +++ b/site/views/companyresults/tmpl/default_chart_cost_percent.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_cost_percent.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -55,8 +55,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('cp_'.$scale, $options); } -} - +} + ?>
@@ -69,4 +69,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+
diff --git a/site/views/companyresults/tmpl/default_chart_intervention_cost_benefit.php b/site/views/companyresults/tmpl/default_chart_intervention_cost_benefit.php index e51bd3fc..0e240752 100644 --- a/site/views/companyresults/tmpl/default_chart_intervention_cost_benefit.php +++ b/site/views/companyresults/tmpl/default_chart_intervention_cost_benefit.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_intervention_cost_benefit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -79,8 +79,8 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr } } } -} - +} + ?>
@@ -99,4 +99,4 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr
-
+ diff --git a/site/views/companyresults/tmpl/default_chart_intervention_cost_benefit_save.php b/site/views/companyresults/tmpl/default_chart_intervention_cost_benefit_save.php index c7e665bb..bc585676 100644 --- a/site/views/companyresults/tmpl/default_chart_intervention_cost_benefit_save.php +++ b/site/views/companyresults/tmpl/default_chart_intervention_cost_benefit_save.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_intervention_cost_benefit_save.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -83,8 +83,8 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr $no_intervention[] = $intervention->name; } } -} - +} + ?> results->interventions) && CostbenefitprojectionHelper::checkArray($this->results->interventions)): ?> @@ -122,4 +122,4 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr
- + diff --git a/site/views/companyresults/tmpl/default_chart_work_days_lost.php b/site/views/companyresults/tmpl/default_chart_work_days_lost.php index 05aa0db7..0f0e31f4 100644 --- a/site/views/companyresults/tmpl/default_chart_work_days_lost.php +++ b/site/views/companyresults/tmpl/default_chart_work_days_lost.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_work_days_lost.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -61,8 +61,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('wdl_'.$scale, $options); } -} - +} + ?>
@@ -75,4 +75,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/site/views/companyresults/tmpl/default_chart_work_days_lost_percent.php b/site/views/companyresults/tmpl/default_chart_work_days_lost_percent.php index b00deabe..6725bfbb 100644 --- a/site/views/companyresults/tmpl/default_chart_work_days_lost_percent.php +++ b/site/views/companyresults/tmpl/default_chart_work_days_lost_percent.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_work_days_lost_percent.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -55,8 +55,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi echo $chart->draw('wdlp_'.$scale, $options); } -} - +} + ?>
@@ -69,4 +69,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+ diff --git a/site/views/companyresults/tmpl/default_table_calculated_cost_in_detail.php b/site/views/companyresults/tmpl/default_table_calculated_cost_in_detail.php index b7d536ef..b5e10139 100644 --- a/site/views/companyresults/tmpl/default_table_calculated_cost_in_detail.php +++ b/site/views/companyresults/tmpl/default_table_calculated_cost_in_detail.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_calculated_cost_in_detail.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -64,4 +64,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/site/views/companyresults/tmpl/default_table_cost_summary.php b/site/views/companyresults/tmpl/default_table_cost_summary.php index 67f18adf..e39882d2 100644 --- a/site/views/companyresults/tmpl/default_table_cost_summary.php +++ b/site/views/companyresults/tmpl/default_table_cost_summary.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_cost_summary.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -67,4 +67,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/site/views/companyresults/tmpl/default_table_intervention_net_benefit.php b/site/views/companyresults/tmpl/default_table_intervention_net_benefit.php index 50d0f0ce..8494bbea 100644 --- a/site/views/companyresults/tmpl/default_table_intervention_net_benefit.php +++ b/site/views/companyresults/tmpl/default_table_intervention_net_benefit.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_intervention_net_benefit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -96,4 +96,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/site/views/companyresults/tmpl/default_table_work_days_lost_summary.php b/site/views/companyresults/tmpl/default_table_work_days_lost_summary.php index 058ae0ae..01c3df21 100644 --- a/site/views/companyresults/tmpl/default_table_work_days_lost_summary.php +++ b/site/views/companyresults/tmpl/default_table_work_days_lost_summary.php @@ -1,27 +1,27 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_table_work_days_lost_summary.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -$scaled = array('unscaled','scaled'); - +$scaled = array('unscaled','scaled'); + ?>

@@ -76,4 +76,4 @@ $scaled = array('unscaled','scaled');
-
+ diff --git a/site/views/companyresults/view.html.php b/site/views/companyresults/view.html.php index c5b05555..5815885b 100644 --- a/site/views/companyresults/view.html.php +++ b/site/views/companyresults/view.html.php @@ -1,38 +1,38 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Costbenefitprojection View class for the Companyresults - */ -class CostbenefitprojectionViewCompanyresults extends JViewLegacy -{ - // Overwriting JView display method - function display($tpl = null) - { - // get combined params of both component and menu - $this->app = JFactory::getApplication(); - $this->params = $this->app->getParams(); - $this->menu = $this->app->getMenu()->getActive(); - // get the user object +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Costbenefitprojection View class for the Companyresults + */ +class CostbenefitprojectionViewCompanyresults extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get combined params of both component and menu + $this->app = JFactory::getApplication(); + $this->params = $this->app->getParams(); + $this->menu = $this->app->getMenu()->getActive(); + // get the user object $this->user = JFactory::getUser(); // Initialise variables. $this->item = $this->get('Item'); @@ -61,13 +61,13 @@ class CostbenefitprojectionViewCompanyresults extends JViewLegacy throw new Exception(implode(PHP_EOL, $errors), 500); } - parent::display($tpl); - } - - /** - * Prepares the document - */ - protected function _prepareDocument() + parent::display($tpl); + } + + /** + * Prepares the document + */ + protected function _prepareDocument() { // always make sure jquery is loaded. @@ -99,21 +99,19 @@ class CostbenefitprojectionViewCompanyresults extends JViewLegacy $uikitComp = $this->get('UikitComp'); if ($uikit != 2 && isset($uikitComp) && CostbenefitprojectionHelper::checkArray($uikitComp)) { - // load just in case. - jimport('joomla.filesystem.file'); // loading... foreach ($uikitComp as $class) { foreach (CostbenefitprojectionHelper::$uk_components[$class] as $name) { // check if the CSS file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. $this->document->addStyleSheet(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); } // check if the JavaScript file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. $this->document->addScript(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); @@ -172,37 +170,37 @@ class CostbenefitprojectionViewCompanyresults extends JViewLegacy { $this->menuNotice++; $session->set( 'CT_SubMenuNotice', $this->menuNotice); - } - // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/companyresults.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - - // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('companyresults'); - if (CostbenefitprojectionHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); - } - - /** - * 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, $sorten = false, $length = 40) - { - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); - } -} + } + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/companyresults.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + + // set help url for this view if found + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('companyresults'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) + { + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = JToolbar::getInstance(); + } + + /** + * 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, $sorten = false, $length = 40) + { + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); + } +} diff --git a/site/views/cpanel/tmpl/default.php b/site/views/cpanel/tmpl/default.php index 2c4b11ea..822da3a6 100644 --- a/site/views/cpanel/tmpl/default.php +++ b/site/views/cpanel/tmpl/default.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + // get user type @@ -211,8 +211,8 @@ function setIntervention($item) return ''.implode('',$bucket).'
'.JText::_('COM_COSTBENEFITPROJECTION_CAUSERISK').''.JText::_('COM_COSTBENEFITPROJECTION_COST_PER_EMPLOYEE').''.JText::_('COM_COSTBENEFITPROJECTION_MORBIDITY_REDUCTION').''.JText::_('COM_COSTBENEFITPROJECTION_MORTALITY_REDUCTION').'
'.implode('
',$bucketsmall).'
'; } // get information url -$information_url = $this->params->get('information_url', null); -?> +$information_url = $this->params->get('information_url', null); +?>
toolbar->render(); ?>

@@ -432,4 +432,4 @@ function combine() return false; } - + diff --git a/site/views/cpanel/view.html.php b/site/views/cpanel/view.html.php index faa1887f..66819bf1 100644 --- a/site/views/cpanel/view.html.php +++ b/site/views/cpanel/view.html.php @@ -1,39 +1,41 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -jimport('joomla.application.module.helper'); - -/** - * Costbenefitprojection View class for the Cpanel - */ -class CostbenefitprojectionViewCpanel extends JViewLegacy -{ - // Overwriting JView display method - function display($tpl = null) - { - // get combined params of both component and menu - $this->app = JFactory::getApplication(); - $this->params = $this->app->getParams(); - $this->menu = $this->app->getMenu()->getActive(); - // get the user object +jimport('joomla.application.module.helper'); + +use Joomla\CMS\Filesystem\File; + +/** + * Costbenefitprojection View class for the Cpanel + */ +class CostbenefitprojectionViewCpanel extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get combined params of both component and menu + $this->app = JFactory::getApplication(); + $this->params = $this->app->getParams(); + $this->menu = $this->app->getMenu()->getActive(); + // get the user object $this->user = JFactory::getUser(); // Initialise variables. $this->items = $this->get('Items'); @@ -50,13 +52,13 @@ class CostbenefitprojectionViewCpanel extends JViewLegacy throw new Exception(implode(PHP_EOL, $errors), 500); } - parent::display($tpl); - } - - /** - * Prepares the document - */ - protected function _prepareDocument() + parent::display($tpl); + } + + /** + * Prepares the document + */ + protected function _prepareDocument() { // always make sure jquery is loaded. @@ -121,13 +123,13 @@ class CostbenefitprojectionViewCpanel extends JViewLegacy foreach (CostbenefitprojectionHelper::$uk_components[$class] as $name) { // check if the CSS file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. $this->document->addStyleSheet(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); } // check if the JavaScript file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. $this->document->addScript(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); @@ -176,25 +178,25 @@ class CostbenefitprojectionViewCpanel extends JViewLegacy if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); - } - // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/cpanel.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - - // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('cpanel'); - if (CostbenefitprojectionHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + } + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/cpanel.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + + // set help url for this view if found + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('cpanel'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) + { + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = JToolbar::getInstance(); } /** @@ -255,18 +257,18 @@ class CostbenefitprojectionViewCpanel extends JViewLegacy } } return false; - } - - /** - * 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, $sorten = false, $length = 40) - { - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); - } -} + } + + /** + * 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, $sorten = false, $length = 40) + { + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); + } +} diff --git a/site/views/createaccount/tmpl/default.php b/site/views/createaccount/tmpl/default.php index cdb1c408..5b127680 100644 --- a/site/views/createaccount/tmpl/default.php +++ b/site/views/createaccount/tmpl/default.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + // reset all default arrays @@ -65,8 +65,8 @@ if ($this->items) $serviceList[] = ''; } } -} -?> +} +?> toolbar->render(); ?> loadTemplate('cbpmenumodule'); ?> items): ?> @@ -101,4 +101,4 @@ if ($this->items)
- + diff --git a/site/views/createaccount/tmpl/default_cbpmenumodule.php b/site/views/createaccount/tmpl/default_cbpmenumodule.php index aec57b96..fb19acc2 100644 --- a/site/views/createaccount/tmpl/default_cbpmenumodule.php +++ b/site/views/createaccount/tmpl/default_cbpmenumodule.php @@ -1,29 +1,29 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_cbpmenumodule.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // get the login module -$modules = $this->getModules('CBP-MENU', 'array'); - +$modules = $this->getModules('CBP-MENU', 'array'); + ?>

', $modules); ?>
- + diff --git a/site/views/createaccount/view.html.php b/site/views/createaccount/view.html.php index e974e1ff..082fce98 100644 --- a/site/views/createaccount/view.html.php +++ b/site/views/createaccount/view.html.php @@ -1,39 +1,41 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -jimport('joomla.application.module.helper'); - -/** - * Costbenefitprojection View class for the Createaccount - */ -class CostbenefitprojectionViewCreateaccount extends JViewLegacy -{ - // Overwriting JView display method - function display($tpl = null) - { - // get combined params of both component and menu - $this->app = JFactory::getApplication(); - $this->params = $this->app->getParams(); - $this->menu = $this->app->getMenu()->getActive(); - // get the user object +jimport('joomla.application.module.helper'); + +use Joomla\CMS\Filesystem\File; + +/** + * Costbenefitprojection View class for the Createaccount + */ +class CostbenefitprojectionViewCreateaccount extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get combined params of both component and menu + $this->app = JFactory::getApplication(); + $this->params = $this->app->getParams(); + $this->menu = $this->app->getMenu()->getActive(); + // get the user object $this->user = JFactory::getUser(); // Initialise variables. $this->items = $this->get('Items'); @@ -50,7 +52,7 @@ class CostbenefitprojectionViewCreateaccount extends JViewLegacy throw new Exception(implode(PHP_EOL, $errors), 500); } - parent::display($tpl); + parent::display($tpl); } public function buildDetails($item) @@ -90,12 +92,12 @@ class CostbenefitprojectionViewCreateaccount extends JViewLegacy $details = '
  • '.implode('
  • ', $bucket).'
'; return array('list' => $list, 'details' => $details); - } - - /** - * Prepares the document - */ - protected function _prepareDocument() + } + + /** + * Prepares the document + */ + protected function _prepareDocument() { // always make sure jquery is loaded. @@ -158,38 +160,38 @@ class CostbenefitprojectionViewCreateaccount extends JViewLegacy foreach (CostbenefitprojectionHelper::$uk_components[$class] as $name) { // check if the CSS file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. $this->document->addStyleSheet(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); } // check if the JavaScript file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. $this->document->addScript(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); } } } - } - // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/createaccount.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - - // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('createaccount'); - if (CostbenefitprojectionHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + } + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/createaccount.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + + // set help url for this view if found + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('createaccount'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) + { + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = JToolbar::getInstance(); } /** @@ -250,18 +252,18 @@ class CostbenefitprojectionViewCreateaccount extends JViewLegacy } } return false; - } - - /** - * 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, $sorten = false, $length = 40) - { - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); - } -} + } + + /** + * 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, $sorten = false, $length = 40) + { + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); + } +} diff --git a/site/views/intervention/submitbutton.js b/site/views/intervention/submitbutton.js index 8b8efa10..6e582a19 100644 --- a/site/views/intervention/submitbutton.js +++ b/site/views/intervention/submitbutton.js @@ -1,33 +1,33 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage submitbutton.js - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -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._('intervention, some values are not acceptable.','Some values are unacceptable')); - return false; - } - } +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +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._('intervention, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } } \ No newline at end of file diff --git a/site/views/intervention/tmpl/edit.php b/site/views/intervention/tmpl/edit.php index 31f0748f..738276c7 100644 --- a/site/views/intervention/tmpl/edit.php +++ b/site/views/intervention/tmpl/edit.php @@ -1,36 +1,33 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage edit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); -JHtml::_('behavior.tabstate'); -JHtml::_('behavior.calendar'); -?> -
-toolbar->render(); ?> -
+?> +
+toolbar->render(); ?> +
@@ -105,8 +102,8 @@ JHtml::_('behavior.calendar');
- - + +
+ diff --git a/site/views/intervention/view.html.php b/site/views/intervention/view.html.php index d3ad90fc..69a31f53 100644 --- a/site/views/intervention/view.html.php +++ b/site/views/intervention/view.html.php @@ -1,90 +1,90 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Intervention View class - */ -class CostbenefitprojectionViewIntervention extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // set params - $this->params = JComponentHelper::getParams('com_costbenefitprojection'); - // 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 = CostbenefitprojectionHelper::getActions('intervention', $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() +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Intervention View class + */ +class CostbenefitprojectionViewIntervention extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_costbenefitprojection'); + // 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 = CostbenefitprojectionHelper::getActions('intervention', $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; @@ -156,63 +156,63 @@ class CostbenefitprojectionViewIntervention extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('intervention'); - if (CostbenefitprojectionHelper::checkString($help_url)) + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('intervention'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); - } - - /** - * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_INTERVENTION_NEW' : 'COM_COSTBENEFITPROJECTION_INTERVENTION_EDIT')); - // only add the ISIS template css & js if needed (default is 1 = true) - // you can override this in the global component options - // just add a (radio yes/no field) with a name called add_isis_template - // to your components config area - if ($this->params->get('add_isis_template', 1)) - { - // we need this to fix the form display (TODO) - $this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - } - // the default style of this view + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = JToolbar::getInstance(); + } + + /** + * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_INTERVENTION_NEW' : 'COM_COSTBENEFITPROJECTION_INTERVENTION_EDIT')); + // only add the ISIS template css & js if needed (default is 1 = true) + // you can override this in the global component options + // just add a (radio yes/no field) with a name called add_isis_template + // to your components config area + if ($this->params->get('add_isis_template', 1)) + { + // we need this to fix the form display (TODO) + $this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + } + // the default style of this view $this->document->addStyleSheet(JURI::root()."components/com_costbenefitprojection/assets/css/intervention.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); // Add Ajax Token - $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); - // default javascript of this view - $this->document->addScript(JURI::root(). $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root(). "components/com_costbenefitprojection/views/intervention/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} + $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + // default javascript of this view + $this->document->addScript(JURI::root(). $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root(). "components/com_costbenefitprojection/views/intervention/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/site/views/publicresults/tmpl/default.php b/site/views/publicresults/tmpl/default.php index 50fa975d..804aa21c 100644 --- a/site/views/publicresults/tmpl/default.php +++ b/site/views/publicresults/tmpl/default.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + // set the active tabs based on interventions @@ -32,8 +32,8 @@ else { $savings = ''; $details = 'uk-active '; -} -?> +} +?>
toolbar->render(); ?>

@@ -74,4 +74,4 @@ jQuery(window).load(function() { jQuery('#main_costbenefitprojection').fadeIn('fast'); }); }); - + diff --git a/site/views/publicresults/tmpl/default_cbpmenumodule.php b/site/views/publicresults/tmpl/default_cbpmenumodule.php index aec57b96..fb19acc2 100644 --- a/site/views/publicresults/tmpl/default_cbpmenumodule.php +++ b/site/views/publicresults/tmpl/default_cbpmenumodule.php @@ -1,29 +1,29 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_cbpmenumodule.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // get the login module -$modules = $this->getModules('CBP-MENU', 'array'); - +$modules = $this->getModules('CBP-MENU', 'array'); + ?>

', $modules); ?>
- + diff --git a/site/views/publicresults/tmpl/default_chart_cost_public.php b/site/views/publicresults/tmpl/default_chart_cost_public.php index 50ce68b8..b5dc5123 100644 --- a/site/views/publicresults/tmpl/default_chart_cost_public.php +++ b/site/views/publicresults/tmpl/default_chart_cost_public.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_cost_public.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -51,8 +51,8 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi $chart->load(json_encode($data)); $options = array( 'backgroundColor' => $this->Chart['backgroundColor'], 'width' => $this->Chart['width'], 'height' => $height, 'chartArea' => $this->Chart['chartArea'], 'legend' => $this->Chart['legend'], 'vAxis' => $this->Chart['vAxis'], 'hAxis' => array('textStyle' => $this->Chart['hAxis']['textStyle'], 'title' => $title, 'titleTextStyle' => $this->Chart['hAxis']['titleTextStyle'])); echo $chart->draw('c_public', $options); -} - +} + ?>
@@ -90,4 +90,4 @@ if(isset($this->results->items) && CostbenefitprojectionHelper::checkObject($thi
-
+
diff --git a/site/views/publicresults/tmpl/default_chart_intervention_cost_benefit_public.php b/site/views/publicresults/tmpl/default_chart_intervention_cost_benefit_public.php index 089be92b..c203ec23 100644 --- a/site/views/publicresults/tmpl/default_chart_intervention_cost_benefit_public.php +++ b/site/views/publicresults/tmpl/default_chart_intervention_cost_benefit_public.php @@ -1,23 +1,23 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_chart_intervention_cost_benefit_public.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); // load chart builder @@ -79,8 +79,8 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr $no_intervention[] = $intervention->name; } } -} - +} + ?>
@@ -144,4 +144,4 @@ if(isset($this->results->interventions) && CostbenefitprojectionHelper::checkArr
-

+

diff --git a/site/views/publicresults/tmpl/default_contact_form_public.php b/site/views/publicresults/tmpl/default_contact_form_public.php index 0ce398c6..615a4cb8 100644 --- a/site/views/publicresults/tmpl/default_contact_form_public.php +++ b/site/views/publicresults/tmpl/default_contact_form_public.php @@ -1,25 +1,25 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage default_contact_form_public.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + ?>
@@ -107,4 +107,4 @@ jQuery( document ).ready(function() { }); - + diff --git a/site/views/publicresults/view.html.php b/site/views/publicresults/view.html.php index 7a7b91c0..686df375 100644 --- a/site/views/publicresults/view.html.php +++ b/site/views/publicresults/view.html.php @@ -1,39 +1,41 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file defined('_JEXEC') or die('Restricted access'); -jimport('joomla.application.module.helper'); - -/** - * Costbenefitprojection View class for the Publicresults - */ -class CostbenefitprojectionViewPublicresults extends JViewLegacy -{ - // Overwriting JView display method - function display($tpl = null) - { - // get combined params of both component and menu - $this->app = JFactory::getApplication(); - $this->params = $this->app->getParams(); - $this->menu = $this->app->getMenu()->getActive(); - // get the user object +jimport('joomla.application.module.helper'); + +use Joomla\CMS\Filesystem\File; + +/** + * Costbenefitprojection View class for the Publicresults + */ +class CostbenefitprojectionViewPublicresults extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get combined params of both component and menu + $this->app = JFactory::getApplication(); + $this->params = $this->app->getParams(); + $this->menu = $this->app->getMenu()->getActive(); + // get the user object $this->user = JFactory::getUser(); // Initialise variables. $this->item = $this->get('Item'); @@ -63,13 +65,13 @@ class CostbenefitprojectionViewPublicresults extends JViewLegacy throw new Exception(implode(PHP_EOL, $errors), 500); } - parent::display($tpl); - } - - /** - * Prepares the document - */ - protected function _prepareDocument() + parent::display($tpl); + } + + /** + * Prepares the document + */ + protected function _prepareDocument() { // always make sure jquery is loaded. @@ -131,13 +133,13 @@ class CostbenefitprojectionViewPublicresults extends JViewLegacy foreach (CostbenefitprojectionHelper::$uk_components[$class] as $name) { // check if the CSS file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css')) { // load the css. $this->document->addStyleSheet(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/css/components/'.$name.$style.$size.'.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); } // check if the JavaScript file exists. - if (JFile::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) + if (File::exists(JPATH_ROOT.'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js')) { // load the js. $this->document->addScript(JURI::root(true) .'/media/com_costbenefitprojection/uikit-v2/js/components/'.$name.$size.'.js', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); @@ -175,25 +177,25 @@ class CostbenefitprojectionViewPublicresults extends JViewLegacy { $this->menuNotice++; $session->set( 'CT_SubMenuNotice', $this->menuNotice); - } - // add the document default css file - $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/publicresults.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - - // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('publicresults'); - if (CostbenefitprojectionHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); + } + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/components/com_costbenefitprojection/assets/css/publicresults.css', (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + + // set help url for this view if found + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('publicresults'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) + { + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = JToolbar::getInstance(); } /** @@ -254,18 +256,18 @@ class CostbenefitprojectionViewPublicresults extends JViewLegacy } } return false; - } - - /** - * 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, $sorten = false, $length = 40) - { - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); - } -} + } + + /** + * 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, $sorten = false, $length = 40) + { + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length); + } +} diff --git a/site/views/scaling_factor/submitbutton.js b/site/views/scaling_factor/submitbutton.js index 8315aefd..6dd98c8e 100644 --- a/site/views/scaling_factor/submitbutton.js +++ b/site/views/scaling_factor/submitbutton.js @@ -1,33 +1,33 @@ -/*----------------------------------------------------------------------------------| www.giz.de |----/ - Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb -/-------------------------------------------------------------------------------------------------------/ - - @version 3.4.x - @build 6th January, 2021 - @created 15th June, 2012 - @package Cost Benefit Projection - @subpackage submitbutton.js - @author Llewellyn van der Merwe - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -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._('scaling_factor, some values are not acceptable.','Some values are unacceptable')); - return false; - } - } +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +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._('scaling_factor, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } } \ No newline at end of file diff --git a/site/views/scaling_factor/tmpl/edit.php b/site/views/scaling_factor/tmpl/edit.php index 5009e1fe..0ae641a8 100644 --- a/site/views/scaling_factor/tmpl/edit.php +++ b/site/views/scaling_factor/tmpl/edit.php @@ -1,36 +1,33 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage edit.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); +JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); -JHtml::_('behavior.tabstate'); -JHtml::_('behavior.calendar'); -?> -
-toolbar->render(); ?> -
+?> +
+toolbar->render(); ?> +
@@ -90,8 +87,8 @@ JHtml::_('behavior.calendar');
-
-
+
+
+ diff --git a/site/views/scaling_factor/view.html.php b/site/views/scaling_factor/view.html.php index 1197505a..dd3fb062 100644 --- a/site/views/scaling_factor/view.html.php +++ b/site/views/scaling_factor/view.html.php @@ -1,90 +1,90 @@ - @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - -/-------------------------------------------------------------------------------------------------------/ - Cost Benefit Projection Tool. -/------------------------------------------------------------------------------------------------------*/ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -/** - * Scaling_factor View class - */ -class CostbenefitprojectionViewScaling_factor extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // set params - $this->params = JComponentHelper::getParams('com_costbenefitprojection'); - // 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 = CostbenefitprojectionHelper::getActions('scaling_factor', $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() +/*----------------------------------------------------------------------------------| www.giz.de |----/ + Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb +/-------------------------------------------------------------------------------------------------------/ + + @version 3.4.x + @build 2nd March, 2022 + @created 15th June, 2012 + @package Cost Benefit Projection + @subpackage view.html.php + @author Llewellyn van der Merwe + @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/-------------------------------------------------------------------------------------------------------/ + Cost Benefit Projection Tool. +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Scaling_factor View class + */ +class CostbenefitprojectionViewScaling_factor extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_costbenefitprojection'); + // 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 = CostbenefitprojectionHelper::getActions('scaling_factor', $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; @@ -156,61 +156,61 @@ class CostbenefitprojectionViewScaling_factor extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = CostbenefitprojectionHelper::getHelpUrl('scaling_factor'); - if (CostbenefitprojectionHelper::checkString($help_url)) + $this->help_url = CostbenefitprojectionHelper::getHelpUrl('scaling_factor'); + if (CostbenefitprojectionHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); - } - // now initiate the toolbar - $this->toolbar = JToolbar::getInstance(); - } - - /** - * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_SCALING_FACTOR_NEW' : 'COM_COSTBENEFITPROJECTION_SCALING_FACTOR_EDIT')); - // only add the ISIS template css & js if needed (default is 1 = true) - // you can override this in the global component options - // just add a (radio yes/no field) with a name called add_isis_template - // to your components config area - if ($this->params->get('add_isis_template', 1)) - { - // we need this to fix the form display (TODO) - $this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - } - // the default style of this view - $this->document->addStyleSheet(JURI::root()."components/com_costbenefitprojection/assets/css/scaling_factor.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - // default javascript of this view - $this->document->addScript(JURI::root(). $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root(). "components/com_costbenefitprojection/views/scaling_factor/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} + JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $this->help_url); + } + // now initiate the toolbar + $this->toolbar = JToolbar::getInstance(); + } + + /** + * 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 CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return CostbenefitprojectionHelper::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_COSTBENEFITPROJECTION_SCALING_FACTOR_NEW' : 'COM_COSTBENEFITPROJECTION_SCALING_FACTOR_EDIT')); + // only add the ISIS template css & js if needed (default is 1 = true) + // you can override this in the global component options + // just add a (radio yes/no field) with a name called add_isis_template + // to your components config area + if ($this->params->get('add_isis_template', 1)) + { + // we need this to fix the form display (TODO) + $this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + } + // the default style of this view + $this->document->addStyleSheet(JURI::root()."components/com_costbenefitprojection/assets/css/scaling_factor.css", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + // default javascript of this view + $this->document->addScript(JURI::root(). $this->script, (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root(). "components/com_costbenefitprojection/views/scaling_factor/submitbutton.js", (CostbenefitprojectionHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +}