update - v1.0.1

This commit is contained in:
Llewellyn van der Merwe 2022-03-03 05:59:15 +02:00
parent d89afa702e
commit 6be463453e
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
81 changed files with 9326 additions and 9328 deletions

View File

@ -8,7 +8,7 @@
+ *Author*: [Llewellyn](mailto:joomla@vdm.io) + *Author*: [Llewellyn](mailto:joomla@vdm.io)
+ *Name*: [Hello World](https://www.vdm.io) + *Name*: [Hello World](https://www.vdm.io)
+ *First Build*: 20th September, 2017 + *First Build*: 20th September, 2017
+ *Last Build*: 4th January, 2021 + *Last Build*: 3rd March, 2022
+ *Version*: 1.0.1 + *Version*: 1.0.1
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -21,7 +21,7 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.) > never making one mistake or taking any coffee break.)
+ *Line count*: **14632** + *Line count*: **14630**
+ *File count*: **139** + *File count*: **139**
+ *Folder count*: **55** + *Folder count*: **55**

View File

@ -8,7 +8,7 @@
+ *Author*: [Llewellyn](mailto:joomla@vdm.io) + *Author*: [Llewellyn](mailto:joomla@vdm.io)
+ *Name*: [Hello World](https://www.vdm.io) + *Name*: [Hello World](https://www.vdm.io)
+ *First Build*: 20th September, 2017 + *First Build*: 20th September, 2017
+ *Last Build*: 4th January, 2021 + *Last Build*: 3rd March, 2022
+ *Version*: 1.0.1 + *Version*: 1.0.1
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -21,7 +21,7 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.) > never making one mistake or taking any coffee break.)
+ *Line count*: **14632** + *Line count*: **14630**
+ *File count*: **139** + *File count*: **139**
+ *Folder count*: **55** + *Folder count*: **55**

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<access component="com_hello_world"> <access component="com_hello_world">
<section name="component"> <section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" /> <action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.options" title="JACTION_OPTIONS" description="JACTION_OPTIONS_COMPONENT_DESC" /> <action name="core.options" title="JACTION_OPTIONS" description="JACTION_OPTIONS_COMPONENT_DESC" />
@ -43,5 +43,5 @@
<action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_FIELD_PERMISSION_EDIT_DESC" /> <action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_FIELD_PERMISSION_EDIT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_FIELD_PERMISSION_EDITSTATE_DESC" /> <action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_FIELD_PERMISSION_EDITSTATE_DESC" />
<action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_FIELD_PERMISSION_EDITVALUE_DESC" /> <action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_FIELD_PERMISSION_EDITVALUE_DESC" />
</section> </section>
</access> </access>

View File

@ -1,24 +1,24 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage admin.css @subpackage admin.css
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* CSS Document */ /* CSS Document */
.no-click { .no-click {
pointer-events: none; pointer-events: none;
} }

View File

@ -1,172 +1,172 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage dashboard.css @subpackage dashboard.css
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* CSS Document */ /* CSS Document */
.dashboard-container { .dashboard-container {
margin-left: 10px; margin-left: 10px;
margin-top: 10px; margin-top: 10px;
width: 100%; width: 100%;
} }
.dashboard-container [class*="span"] { .dashboard-container [class*="span"] {
display: block; display: block;
float: none; float: none;
margin-left: 0; margin-left: 0;
width: auto; width: auto;
} }
.dashboard-container:before, .dashboard-container:after { .dashboard-container:before, .dashboard-container:after {
content: ""; content: "";
display: table; display: table;
} }
.dashboard-container:after { .dashboard-container:after {
clear: both; clear: both;
} }
.dashboard-container [class*="span"] { .dashboard-container [class*="span"] {
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
float: left; float: left;
min-height: 145px; min-height: 145px;
min-width: 96px; min-width: 96px;
width: 100%; width: 100%;
} }
.dashboard-container [class*="span"]:first-child { .dashboard-container [class*="span"]:first-child {
margin-left: 0; margin-left: 0;
} }
.dashboard-wraper { .dashboard-wraper {
background: none repeat scroll 0 0 hsl(0, 0%, 93%); background: none repeat scroll 0 0 hsl(0, 0%, 93%);
border-radius: 5px; border-radius: 5px;
float: left; float: left;
margin: 1%; margin: 1%;
padding: 3px; padding: 3px;
width: 17%; width: 17%;
min-height: 194px; min-height: 194px;
min-width: 96px; min-width: 96px;
} }
.dashboard-content a { .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); 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: 1px solid hsl(0, 0%, 85%);
border-radius: 4px; border-radius: 4px;
box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset;
color: hsl(0, 0%, 20%); color: hsl(0, 0%, 20%);
display: block; display: block;
min-height: 89px; min-height: 89px;
padding: 10px; padding: 10px;
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
} }
.dashboard-content a:hover { .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); 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%); color: hsl(200, 100%, 30%);
text-decoration: none; text-decoration: none;
} }
.dashboard-title { .dashboard-title {
display: block; display: block;
padding-top: 5px; padding-top: 5px;
} }
.dashboard-info { .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); 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: 1px solid hsl(0, 0%, 85%);
border-radius: 4px; border-radius: 4px;
box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset;
color: hsl(0, 0%, 20%); color: hsl(0, 0%, 20%);
display: block; display: block;
font-size: 12px; font-size: 12px;
padding: 10px; padding: 10px;
text-align: center; text-align: center;
} }
.dashboard-info span { .dashboard-info span {
display: block; display: block;
text-align: center; text-align: center;
} }
.dashboard-info img { .dashboard-info img {
margin: 0 auto; margin: 0 auto;
} }
.dashboard-table { .dashboard-table {
border-top: 1px solid hsl(0, 0%, 87%); border-top: 1px solid hsl(0, 0%, 87%);
margin-top: 5px; margin-top: 5px;
width: 100%; width: 100%;
} }
.dashboard-info h5 { .dashboard-info h5 {
font-size: 11px; font-size: 11px;
font-weight: bold; font-weight: bold;
} }
.dashboard-block { .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); 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: 1px solid hsl(0, 0%, 76%);
border-radius: 3px; border-radius: 3px;
box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset;
margin-bottom: 20px; margin-bottom: 20px;
} }
.dashboard-block .dashboard-block-head { .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); 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-bottom: 1px solid hsl(0, 0%, 76%);
border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0;
box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%);
height: 40px; height: 40px;
position: relative; position: relative;
} }
.dashboard-block .dashboard-block-head h5 { .dashboard-block .dashboard-block-head h5 {
font-size: 12px; font-size: 12px;
margin: 0; margin: 0;
padding-left: 10px; padding-left: 10px;
padding-top: 11px; padding-top: 11px;
text-transform: uppercase; text-transform: uppercase;
} }
.dashboard-block .dashboard-block-content { .dashboard-block .dashboard-block-content {
background: none repeat scroll 0 0 hsl(0, 0%, 93%); background: none repeat scroll 0 0 hsl(0, 0%, 93%);
border-radius: 0 0 3px 3px; border-radius: 0 0 3px 3px;
} }
.dashboard-block .dashboard-block-box { .dashboard-block .dashboard-block-box {
background: none repeat scroll 0 0 hsl(0, 0%, 100%); background: none repeat scroll 0 0 hsl(0, 0%, 100%);
border-top: 1px solid hsl(0, 0%, 82%); border-top: 1px solid hsl(0, 0%, 82%);
box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; box-shadow: 0 0 5px hsl(0, 0%, 87%) inset;
} }
.dashboard-block .dashboard-block-content .dashboard-block-box { .dashboard-block .dashboard-block-content .dashboard-block-box {
margin-top: 0 !important; margin-top: 0 !important;
} }
.dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { .dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
.dashboard-block-table { .dashboard-block-table {
background-color: hsla(0, 0%, 0%, 0); background-color: hsla(0, 0%, 0%, 0);
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
margin-bottom: 20px; margin-bottom: 20px;
max-width: 100%; max-width: 100%;
width: 100%; width: 100%;
} }
.dashboard-block-table th, .dashboard-block-table td { .dashboard-block-table th, .dashboard-block-table td {
border-top: 1px solid hsl(0, 0%, 87%); border-top: 1px solid hsl(0, 0%, 87%);
line-height: 20px; line-height: 20px;
padding: 5px; padding: 5px;
text-align: left; text-align: left;
vertical-align: middle; vertical-align: middle;
} }
.dashboard-badge { .dashboard-badge {
background-color: hsl(0, 0%, 60%); background-color: hsl(0, 0%, 60%);
border-radius: 9px; border-radius: 9px;
color: hsl(0, 0%, 100%); color: hsl(0, 0%, 100%);
font-size: 11.844px; font-size: 11.844px;
font-weight: bold; font-weight: bold;
line-height: 14px; line-height: 14px;
padding: 1px 9px 2px; padding: 1px 9px 2px;
text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25);
vertical-align: baseline; vertical-align: baseline;
white-space: nowrap; white-space: nowrap;
} }

View File

@ -1,22 +1,22 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greeting.css @subpackage greeting.css
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* CSS Document */ /* CSS Document */

View File

@ -1,22 +1,22 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greetings.css @subpackage greetings.css
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* CSS Document */ /* CSS Document */

View File

@ -1,20 +1,20 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage admin.js @subpackage admin.js
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* JS Document */ /* JS Document */

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<config> <config>
<fieldset <fieldset
addrulepath="/administrator/components/com_hello_world/models/rules" addrulepath="/administrator/components/com_hello_world/models/rules"
addfieldpath="/administrator/components/com_hello_world/models/fields" addfieldpath="/administrator/components/com_hello_world/models/fields"
@ -115,20 +115,20 @@
<option value=".gradient"> <option value=".gradient">
COM_HELLO_WORLD_CONFIG_GRADIANT_LOAD</option>" COM_HELLO_WORLD_CONFIG_GRADIANT_LOAD</option>"
</field> </field>
</fieldset> </fieldset>
<fieldset <fieldset
name="permissions" name="permissions"
label="JCONFIG_PERMISSIONS_LABEL" label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"> description="JCONFIG_PERMISSIONS_DESC">
<field <field
name="rules" name="rules"
type="rules" type="rules"
label="JCONFIG_PERMISSIONS_LABEL" label="JCONFIG_PERMISSIONS_LABEL"
class="inputbox" class="inputbox"
validate="rules" validate="rules"
filter="rules" filter="rules"
component="com_hello_world" component="com_hello_world"
section="component" section="component"
/> />
</fieldset> </fieldset>
</config> </config>

View File

@ -1,121 +1,121 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage controller.php @subpackage controller.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* General Controller of Hello_world component * General Controller of Hello_world component
*/ */
class Hello_worldController extends JControllerLegacy class Hello_worldController extends JControllerLegacy
{ {
/** /**
* Constructor. * Constructor.
* *
* @param array $config An optional associative array of configuration settings. * @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and * Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive). * 'view_path' (this list is not meant to be comprehensive).
* *
* @since 3.0 * @since 3.0
*/ */
public function __construct($config = array()) public function __construct($config = array())
{ {
// set the default view // set the default view
$config['default_view'] = 'hello_world'; $config['default_view'] = 'hello_world';
parent::__construct($config); parent::__construct($config);
} }
/** /**
* display task * display task
* *
* @return void * @return void
*/ */
function display($cachable = false, $urlparams = false) function display($cachable = false, $urlparams = false)
{ {
// set default view if not set // set default view if not set
$view = $this->input->getCmd('view', 'hello_world'); $view = $this->input->getCmd('view', 'hello_world');
$data = $this->getViewRelation($view); $data = $this->getViewRelation($view);
$layout = $this->input->get('layout', null, 'WORD'); $layout = $this->input->get('layout', null, 'WORD');
$id = $this->input->getInt('id'); $id = $this->input->getInt('id');
// Check for edit form. // Check for edit form.
if(Hello_worldHelper::checkArray($data)) if(Hello_worldHelper::checkArray($data))
{ {
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_hello_world.edit.'.$data['view'], $id)) if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_hello_world.edit.'.$data['view'], $id))
{ {
// Somehow the person just went to the form - we don't allow that. // Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error'); $this->setMessage($this->getError(), 'error');
// check if item was opend from other then its own list view // check if item was opend from other then its own list view
$ref = $this->input->getCmd('ref', 0); $ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0); $refid = $this->input->getInt('refid', 0);
// set redirect // set redirect
if ($refid > 0 && Hello_worldHelper::checkString($ref)) if ($refid > 0 && Hello_worldHelper::checkString($ref))
{ {
// redirect to item of ref // redirect to item of ref
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); $this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
} }
elseif (Hello_worldHelper::checkString($ref)) elseif (Hello_worldHelper::checkString($ref))
{ {
// redirect to ref // redirect to ref
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.(string)$ref, false)); $this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.(string)$ref, false));
} }
else else
{ {
// normal redirect back to the list view // normal redirect back to the list view
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.$data['views'], false)); $this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.$data['views'], false));
} }
return false; return false;
} }
} }
return parent::display($cachable, $urlparams); return parent::display($cachable, $urlparams);
} }
protected function getViewRelation($view) protected function getViewRelation($view)
{ {
// check the we have a value // check the we have a value
if (Hello_worldHelper::checkString($view)) if (Hello_worldHelper::checkString($view))
{ {
// the view relationships // the view relationships
$views = array( $views = array(
'greeting' => 'greetings' 'greeting' => 'greetings'
); );
// check if this is a list view // check if this is a list view
if (in_array($view, $views)) if (in_array($view, $views))
{ {
// this is a list view // this is a list view
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
} }
// check if it is an edit view // check if it is an edit view
elseif (array_key_exists($view, $views)) elseif (array_key_exists($view, $views))
{ {
// this is a edit view // this is a edit view
return array('edit' => true, 'view' => $view, 'views' => $views[$view]); return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
} }
} }
return false; return false;
} }
} }

View File

@ -1,65 +1,65 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greeting.php @subpackage greeting.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Greeting Controller * Greeting Controller
*/ */
class Hello_worldControllerGreeting extends JControllerForm class Hello_worldControllerGreeting extends JControllerForm
{ {
/** /**
* Current or most recently performed task. * Current or most recently performed task.
* *
* @var string * @var string
* @since 12.2 * @since 12.2
* @note Replaces _task. * @note Replaces _task.
*/ */
protected $task; protected $task;
/** /**
* Class constructor. * Class constructor.
* *
* @param array $config A named array of configuration variables. * @param array $config A named array of configuration variables.
* *
* @since 1.6 * @since 1.6
*/ */
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Greetings'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Greetings'; // safeguard for setting the return view listing to the main view.
parent::__construct($config); parent::__construct($config);
} }
/** /**
* Method override to check if you can add a new record. * Method override to check if you can add a new record.
* *
* @param array $data An array of input data. * @param array $data An array of input data.
* *
* @return boolean * @return boolean
* *
* @since 1.6 * @since 1.6
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// Get user object. // Get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
@ -71,20 +71,20 @@ class Hello_worldControllerGreeting extends JControllerForm
} }
// In the absense of better information, revert to the component permissions. // In the absense of better information, revert to the component permissions.
return parent::allowAdd($data); return parent::allowAdd($data);
} }
/** /**
* Method override to check if you can edit an existing record. * Method override to check if you can edit an existing record.
* *
* @param array $data An array of input data. * @param array $data An array of input data.
* @param string $key The name of the key for the primary key. * @param string $key The name of the key for the primary key.
* *
* @return boolean * @return boolean
* *
* @since 1.6 * @since 1.6
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// get user object. // get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
@ -127,199 +127,199 @@ class Hello_worldControllerGreeting extends JControllerForm
} }
} }
// Since there is no permission, revert to the component permissions. // Since there is no permission, revert to the component permissions.
return parent::allowEdit($data, $key); return parent::allowEdit($data, $key);
} }
/** /**
* Gets the URL arguments to append to an item redirect. * Gets the URL arguments to append to an item redirect.
* *
* @param integer $recordId The primary key id for the item. * @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id. * @param string $urlVar The name of the URL variable for the id.
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 1.6 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') 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('Greeting', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view=greetings' . $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; // 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('Greeting', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view=greetings' . $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;
}
}

View File

@ -1,55 +1,55 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greetings.php @subpackage greetings.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Greetings Controller * Greetings Controller
*/ */
class Hello_worldControllerGreetings extends JControllerAdmin class Hello_worldControllerGreetings extends JControllerAdmin
{ {
/** /**
* The prefix to use with controller messages. * The prefix to use with controller messages.
* *
* @var string * @var string
* @since 1.6 * @since 1.6
*/ */
protected $text_prefix = 'COM_HELLO_WORLD_GREETINGS'; protected $text_prefix = 'COM_HELLO_WORLD_GREETINGS';
/** /**
* Method to get a model object, loading it if required. * Method to get a model object, loading it if required.
* *
* @param string $name The model name. Optional. * @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional. * @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional. * @param array $config Configuration array for model. Optional.
* *
* @return JModelLegacy The model. * @return JModelLegacy The model.
* *
* @since 1.6 * @since 1.6
*/ */
public function getModel($name = 'Greeting', $prefix = 'Hello_worldModel', $config = array('ignore_request' => true)) public function getModel($name = 'Greeting', $prefix = 'Hello_worldModel', $config = array('ignore_request' => true))
{ {
return parent::getModel($name, $prefix, $config); return parent::getModel($name, $prefix, $config);
} }
public function exportData() public function exportData()
@ -113,5 +113,5 @@ class Hello_worldControllerGreetings extends JControllerAdmin
$message = JText::_('COM_HELLO_WORLD_IMPORT_FAILED'); $message = JText::_('COM_HELLO_WORLD_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view=greetings', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_hello_world&view=greetings', false), $message, 'error');
return; return;
} }
} }

View File

@ -1,30 +1,32 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage hello_world.php @subpackage hello_world.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/**
* Hello_world Controller
*/ /**
class Hello_worldControllerHello_world extends JControllerAdmin * Hello_world Controller
{ */
class Hello_worldControllerHello_world extends JControllerAdmin
} {
}

View File

@ -1,64 +1,64 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage import.php @subpackage import.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Hello_world Import Controller * Hello_world Import Controller
*/ */
class Hello_worldControllerImport extends JControllerLegacy class Hello_worldControllerImport extends JControllerLegacy
{ {
/** /**
* Import an spreadsheet. * Import an spreadsheet.
* *
* @return void * @return void
*/ */
public function import() public function import()
{ {
// Check for request forgeries // Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$model = $this->getModel('import'); $model = $this->getModel('import');
if ($model->import()) if ($model->import())
{ {
$cache = JFactory::getCache('mod_menu'); $cache = JFactory::getCache('mod_menu');
$cache->clean(); $cache->clean();
// TODO: Reset the users acl here as well to kill off any missing bits // TODO: Reset the users acl here as well to kill off any missing bits
} }
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$redirect_url = $app->getUserState('com_hello_world.redirect_url'); $redirect_url = $app->getUserState('com_hello_world.redirect_url');
if (empty($redirect_url)) if (empty($redirect_url))
{ {
$redirect_url = JRoute::_('index.php?option=com_hello_world&view=import', false); $redirect_url = JRoute::_('index.php?option=com_hello_world&view=import', false);
} }
else else
{ {
// wipe out the user state when we're going to redirect // wipe out the user state when we're going to redirect
$app->setUserState('com_hello_world.redirect_url', ''); $app->setUserState('com_hello_world.redirect_url', '');
$app->setUserState('com_hello_world.message', ''); $app->setUserState('com_hello_world.message', '');
$app->setUserState('com_hello_world.extension_message', ''); $app->setUserState('com_hello_world.extension_message', '');
} }
$this->setRedirect($redirect_url); $this->setRedirect($redirect_url);
} }
} }

View File

@ -1,48 +1,48 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage hello_world.php @subpackage hello_world.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Access check. // Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_hello_world')) if (!JFactory::getUser()->authorise('core.manage', 'com_hello_world'))
{ {
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}; };
// Add CSS file for all pages // Add CSS file for all pages
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$document->addStyleSheet('components/com_hello_world/assets/css/admin.css'); $document->addStyleSheet('components/com_hello_world/assets/css/admin.css');
$document->addScript('components/com_hello_world/assets/js/admin.js'); $document->addScript('components/com_hello_world/assets/js/admin.js');
// require helper files // require helper files
JLoader::register('Hello_worldHelper', __DIR__ . '/helpers/hello_world.php'); JLoader::register('Hello_worldHelper', __DIR__ . '/helpers/hello_world.php');
JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
// Get an instance of the controller prefixed by Hello_world // Get an instance of the controller prefixed by Hello_world
$controller = JControllerLegacy::getInstance('Hello_world'); $controller = JControllerLegacy::getInstance('Hello_world');
// Perform the Request task // Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task')); $controller->execute(JFactory::getApplication()->input->get('task'));
// Redirect if set by the controller // Redirect if set by the controller
$controller->redirect(); $controller->redirect();

View File

@ -1,80 +1,80 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage headercheck.php @subpackage headercheck.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
class hello_worldHeaderCheck class hello_worldHeaderCheck
{ {
function js_loaded($script_name) function js_loaded($script_name)
{ {
// UIkit check point // UIkit check point
if (strpos($script_name,'uikit') !== false) if (strpos($script_name,'uikit') !== false)
{ {
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template; $getTemplateName = $app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false) if (strpos($getTemplateName,'yoo') !== false)
{ {
return true; return true;
} }
} }
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$head_data = $document->getHeadData(); $head_data = $document->getHeadData();
foreach (array_keys($head_data['scripts']) as $script) foreach (array_keys($head_data['scripts']) as $script)
{ {
if (stristr($script, $script_name)) if (stristr($script, $script_name))
{ {
return true; return true;
} }
} }
return false; return false;
} }
function css_loaded($script_name) function css_loaded($script_name)
{ {
// UIkit check point // UIkit check point
if (strpos($script_name,'uikit') !== false) if (strpos($script_name,'uikit') !== false)
{ {
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template; $getTemplateName = $app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false) if (strpos($getTemplateName,'yoo') !== false)
{ {
return true; return true;
} }
} }
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$head_data = $document->getHeadData(); $head_data = $document->getHeadData();
foreach (array_keys($head_data['styleSheets']) as $script) foreach (array_keys($head_data['styleSheets']) as $script)
{ {
if (stristr($script, $script_name)) if (stristr($script, $script_name))
{ {
return true; return true;
} }
} }
return false; return false;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,87 +1,87 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage batch_.php @subpackage batch_.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('JPATH_PLATFORM') or die; defined('JPATH_PLATFORM') or die;
/** /**
* Utility class to render a list view batch selection options * Utility class to render a list view batch selection options
* *
* @since 3.0 * @since 3.0
*/ */
abstract class JHtmlBatch_ abstract class JHtmlBatch_
{ {
/** /**
* ListSelection * ListSelection
* *
* @var array * @var array
* @since 3.0 * @since 3.0
*/ */
protected static $ListSelection = array(); protected static $ListSelection = array();
/** /**
* Render the batch selection options. * Render the batch selection options.
* *
* @return string The necessary HTML to display the batch selection options * @return string The necessary HTML to display the batch selection options
* *
* @since 3.0 * @since 3.0
*/ */
public static function render() public static function render()
{ {
// Collect display data // Collect display data
$data = new stdClass; $data = new stdClass;
$data->ListSelection = static::getListSelection(); $data->ListSelection = static::getListSelection();
// Create a layout object and ask it to render the batch selection options // Create a layout object and ask it to render the batch selection options
$layout = new JLayoutFile('batchselection'); $layout = new JLayoutFile('batchselection');
$batchHtml = $layout->render($data); $batchHtml = $layout->render($data);
return $batchHtml; return $batchHtml;
} }
/** /**
* Method to add a list selection to the batch modal * Method to add a list selection to the batch modal
* *
* @param string $label Label for the menu item. * @param string $label Label for the menu item.
* @param string $name Name for the filter. Also used as id. * @param string $name Name for the filter. Also used as id.
* @param string $options Options for the select field. * @param string $options Options for the select field.
* @param bool $noDefault Don't the label as the empty option * @param bool $noDefault Don't the label as the empty option
* *
* @return void * @return void
* *
* @since 3.0 * @since 3.0
*/ */
public static function addListSelection($label, $name, $options, $noDefault = false) public static function addListSelection($label, $name, $options, $noDefault = false)
{ {
array_push(static::$ListSelection, array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault)); array_push(static::$ListSelection, array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault));
} }
/** /**
* Returns an array of all ListSelection * Returns an array of all ListSelection
* *
* @return array * @return array
* *
* @since 3.0 * @since 3.0
*/ */
public static function getListSelection() public static function getListSelection()
{ {
return static::$ListSelection; return static::$ListSelection;
} }
} }

View File

@ -114,7 +114,6 @@ COM_HELLO_WORLD_GREETING_CREATED_DATE_LABEL="Created Date"
COM_HELLO_WORLD_GREETING_DETAILS="Details" COM_HELLO_WORLD_GREETING_DETAILS="Details"
COM_HELLO_WORLD_GREETING_EDIT="Editing the Greeting" COM_HELLO_WORLD_GREETING_EDIT="Editing the Greeting"
COM_HELLO_WORLD_GREETING_ERROR_UNIQUE_ALIAS="Another Greeting has the same alias." COM_HELLO_WORLD_GREETING_ERROR_UNIQUE_ALIAS="Another Greeting has the same alias."
COM_HELLO_WORLD_GREETING_GREETING="Greeting"
COM_HELLO_WORLD_GREETING_GREETING_DESCRIPTION="Enter a greeting" COM_HELLO_WORLD_GREETING_GREETING_DESCRIPTION="Enter a greeting"
COM_HELLO_WORLD_GREETING_GREETING_HINT="Greeting here!" COM_HELLO_WORLD_GREETING_GREETING_HINT="Greeting here!"
COM_HELLO_WORLD_GREETING_GREETING_LABEL="Greeting" COM_HELLO_WORLD_GREETING_GREETING_LABEL="Greeting"

View File

@ -1,57 +1,57 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage batchselection.php @subpackage batchselection.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('JPATH_BASE') or die; defined('JPATH_BASE') or die;
JHtmlBehavior::core(); JHtmlBehavior::core();
$divWrapper = range(1,120,2); $divWrapper = range(1,120,2);
$counter = 0; $counter = 0;
?> ?>
<?php if ($displayData->ListSelection) : ?> <?php if ($displayData->ListSelection) : ?>
<div class="row-fluid"> <div class="row-fluid">
<?php foreach ($displayData->ListSelection as $ListSelection) : ?> <?php foreach ($displayData->ListSelection as $ListSelection) : ?>
<div class="control-group span6"> <div class="control-group span6">
<div class="controls"> <div class="controls">
<label for="<?php echo $ListSelection['name']; ?>" class="element-invisible"><?php echo $ListSelection['label']; ?></label> <label for="<?php echo $ListSelection['name']; ?>" class="element-invisible"><?php echo $ListSelection['label']; ?></label>
<select name="<?php echo $ListSelection['name']; ?>" id="<?php echo $ListSelection['name']; ?>" class="span12 small"> <select name="<?php echo $ListSelection['name']; ?>" id="<?php echo $ListSelection['name']; ?>" class="span12 small">
<?php if (!$ListSelection['noDefault']) : ?> <?php if (!$ListSelection['noDefault']) : ?>
<option value=""><?php echo $ListSelection['label']; ?></option> <option value=""><?php echo $ListSelection['label']; ?></option>
<?php endif; ?> <?php endif; ?>
<?php echo $ListSelection['options']; ?> <?php echo $ListSelection['options']; ?>
</select> </select>
</div> </div>
</div> </div>
<?php if (in_array($counter,$divWrapper)) : ?> <?php if (in_array($counter,$divWrapper)) : ?>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<?php endif; ?> <?php endif; ?>
<?php $counter++; ?> <?php $counter++; ?>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<div class="control-group radio" id="batch-move-copy"> <div class="control-group radio" id="batch-move-copy">
<div class="controls"> <div class="controls">
<label class="radio" id="batch[move_copy]c-lbl" for="batch[move_copy]c"> <label class="radio" id="batch[move_copy]c-lbl" for="batch[move_copy]c">
<input type="radio" value="c" id="batch[move_copy]c" name="batch[move_copy]"><?php echo JText::_('Copy'); ?></label> <input type="radio" value="c" id="batch[move_copy]c" name="batch[move_copy]"><?php echo JText::_('Copy'); ?></label>
<label class="radio" id="batch[move_copy]m-lbl" for="batch[move_copy]m"> <label class="radio" id="batch[move_copy]m-lbl" for="batch[move_copy]m">
<input type="radio" checked="checked" value="m" id="batch[move_copy]m" name="batch[move_copy]"><?php echo JText::_('Update'); ?></label> <input type="radio" checked="checked" value="m" id="batch[move_copy]m" name="batch[move_copy]"><?php echo JText::_('Update'); ?></label>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>

View File

@ -1,51 +1,51 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage details_left.php @subpackage details_left.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// get the form // get the form
$form = $displayData->getForm(); $form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID) // get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId()); $layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method // Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around // this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. // seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php // example of layout name: details_left.php
// example of method name: getFields_details_left() // example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1]; $fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields // get the fields
$fields = $displayData->get($fields_tab_layout) ?: array( $fields = $displayData->get($fields_tab_layout) ?: array(
'greeting' 'greeting'
); );
$hiddenFields = $displayData->get('hidden_fields') ?: array(); $hiddenFields = $displayData->get('hidden_fields') ?: array();
?> ?>
<?php if ($fields && count((array) $fields)) :?> <?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?> <?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?> <?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?> <?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?> <?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> <?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>

View File

@ -1,50 +1,50 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage metadata.php @subpackage metadata.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();
// JLayout for standard handling of metadata fields in the administrator content edit screens. // JLayout for standard handling of metadata fields in the administrator content edit screens.
$fieldSets = $form->getFieldsets('metadata'); $fieldSets = $form->getFieldsets('metadata');
?> ?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?> <?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?> <?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
<p class="alert alert-info"><?php echo $this->escape(JText::_($fieldSet->description)); ?></p> <p class="alert alert-info"><?php echo $this->escape(JText::_($fieldSet->description)); ?></p>
<?php endif; ?> <?php endif; ?>
<?php <?php
// Include the real fields in this panel. // Include the real fields in this panel.
if ($name == 'vdmmetadata') if ($name == 'vdmmetadata')
{ {
echo $form->renderField('metadesc'); echo $form->renderField('metadesc');
echo $form->renderField('metakey'); echo $form->renderField('metakey');
} }
foreach ($form->getFieldset($name) as $field) foreach ($form->getFieldset($name) as $field)
{ {
if ($field->name != 'jform[metadata][tags][]') if ($field->name != 'jform[metadata][tags][]')
{ {
echo $field->renderField(); echo $field->renderField();
} }
} ?> } ?>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -1,40 +1,40 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage publishing.php @subpackage publishing.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// get the form // get the form
$form = $displayData->getForm(); $form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID) // get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId()); $layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method // Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around // this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. // seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php // example of layout name: details_left.php
// example of method name: getFields_details_left() // example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1]; $fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields // get the fields
$fields = $displayData->get($fields_tab_layout) ?: array( $fields = $displayData->get($fields_tab_layout) ?: array(
'title', 'title',
'created', 'created',
'created_by', 'created_by',
@ -45,17 +45,17 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
'access', 'access',
'version', 'version',
'hits', 'hits',
'id' 'id'
); );
$hiddenFields = $displayData->get('hidden_fields') ?: array(); $hiddenFields = $displayData->get('hidden_fields') ?: array();
?> ?>
<?php if ($fields && count((array) $fields)) :?> <?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?> <?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?> <?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?> <?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?> <?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> <?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>

View File

@ -1,28 +1,28 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage trashhelper.php @subpackage trashhelper.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('JPATH_BASE') or die('Restricted access'); defined('JPATH_BASE') or die('Restricted access');
?> ?>
<?php if ($displayData->state->get('filter.published') == -2 && ($displayData->canState && $displayData->canDelete)) : ?> <?php if ($displayData->state->get('filter.published') == -2 && ($displayData->canState && $displayData->canDelete)) : ?>
<script> <script>
@ -79,4 +79,4 @@ defined('JPATH_BASE') or die('Restricted access');
<?= JText::_("COM_HELLO_WORLD_EXIT_TRASH") ?> <?= JText::_("COM_HELLO_WORLD_EXIT_TRASH") ?>
</button> </button>
</div> </div>
<?php endif; ?> <?php endif; ?>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<form <form
addrulepath="/administrator/components/com_hello_world/models/rules" addrulepath="/administrator/components/com_hello_world/models/rules"
addfieldpath="/administrator/components/com_hello_world/models/fields" addfieldpath="/administrator/components/com_hello_world/models/fields"
> >
<fields name="filter"> <fields name="filter">
<field <field
type="text" type="text"
@ -31,8 +31,8 @@
onchange="this.form.submit();" onchange="this.form.submit();"
/> />
<input type="hidden" name="form_submited" value="1"/> <input type="hidden" name="form_submited" value="1"/>
</fields> </fields>
<fields name="list"> <fields name="list">
<field <field
name="fullordering" name="fullordering"
@ -63,5 +63,5 @@
default="25" default="25"
onchange="this.form.submit();" onchange="this.form.submit();"
/> />
</fields> </fields>
</form> </form>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<form <form
addrulepath="/administrator/components/com_hello_world/models/rules" addrulepath="/administrator/components/com_hello_world/models/rules"
addfieldpath="/administrator/components/com_hello_world/models/fields" addfieldpath="/administrator/components/com_hello_world/models/fields"
> >
<fieldset name="details"> <fieldset name="details">
<!-- Default Fields. --> <!-- Default Fields. -->
<!-- Id Field. Type: Text (joomla) --> <!-- Id Field. Type: Text (joomla) -->
@ -154,8 +154,8 @@
cols="30" rows="2" cols="30" rows="2"
/> />
</fieldset> </fieldset>
</fields> </fields>
<!-- Access Control Fields. --> <!-- Access Control Fields. -->
<fieldset name="accesscontrol"> <fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) --> <!-- Asset Id Field. Type: Hidden (joomla) -->
@ -176,5 +176,5 @@
component="com_hello_world" component="com_hello_world"
section="greeting" section="greeting"
/> />
</fieldset> </fieldset>
</form> </form>

View File

@ -1,134 +1,128 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greeting.php @subpackage greeting.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper; use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Hello_world Greeting Model * Hello_world Greeting Model
*/ */
class Hello_worldModelGreeting extends JModelAdmin class Hello_worldModelGreeting extends JModelAdmin
{ {
/** /**
* The tab layout fields array. * The tab layout fields array.
* *
* @var array * @var array
*/ */
protected $tabLayoutFields = array( protected $tabLayoutFields = array(
'details' => array( 'details' => array(
'left' => array( 'left' => array(
'greeting' 'greeting'
) )
) )
); );
/** /**
* @var string The prefix to use with controller messages. * @var string The prefix to use with controller messages.
* @since 1.6 * @since 1.6
*/ */
protected $text_prefix = 'COM_HELLO_WORLD'; protected $text_prefix = 'COM_HELLO_WORLD';
/** /**
* The type alias for this content type. * The type alias for this content type.
* *
* @var string * @var string
* @since 3.2 * @since 3.2
*/ */
public $typeAlias = 'com_hello_world.greeting'; public $typeAlias = 'com_hello_world.greeting';
/** /**
* Returns a Table object, always creating it * Returns a Table object, always creating it
* *
* @param type $type The table type to instantiate * @param type $type The table type to instantiate
* @param string $prefix A prefix for the table class name. Optional. * @param string $prefix A prefix for the table class name. Optional.
* @param array $config Configuration array for model. Optional. * @param array $config Configuration array for model. Optional.
* *
* @return JTable A database object * @return JTable A database object
* *
* @since 1.6 * @since 1.6
*/ */
public function getTable($type = 'greeting', $prefix = 'Hello_worldTable', $config = array()) public function getTable($type = 'greeting', $prefix = 'Hello_worldTable', $config = array())
{ {
// add table path for when model gets used from other component // add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_hello_world/tables'); $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_hello_world/tables');
// get instance of the table // get instance of the table
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
} }
/** /**
* Method to get a single record. * Method to get a single record.
* *
* @param integer $pk The id of the primary key. * @param integer $pk The id of the primary key.
* *
* @return mixed Object on success, false on failure. * @return mixed Object on success, false on failure.
* *
* @since 1.6 * @since 1.6
*/ */
public function getItem($pk = null) public function getItem($pk = null)
{ {
if ($item = parent::getItem($pk)) if ($item = parent::getItem($pk))
{ {
if (!empty($item->params) && !is_array($item->params)) if (!empty($item->params) && !is_array($item->params))
{ {
// Convert the params field to an array. // Convert the params field to an array.
$registry = new Registry; $registry = new Registry;
$registry->loadString($item->params); $registry->loadString($item->params);
$item->params = $registry->toArray(); $item->params = $registry->toArray();
} }
if (!empty($item->metadata)) if (!empty($item->metadata))
{ {
// Convert the metadata field to an array. // Convert the metadata field to an array.
$registry = new Registry; $registry = new Registry;
$registry->loadString($item->metadata); $registry->loadString($item->metadata);
$item->metadata = $registry->toArray(); $item->metadata = $registry->toArray();
} }
}
if (!empty($item->id))
{ return $item;
$item->tags = new JHelperTags; }
$item->tags->getTagIds($item->id, 'com_hello_world.greeting');
} /**
} * Method to get the record form.
*
return $item; * @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.
/** *
* Method to get the record form. * @return mixed A JForm object on success, false on failure
* *
* @param array $data Data for the form. * @since 1.6
* @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. public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
* {
* @return mixed A JForm object on success, false on failure // set load data option
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{
// set load data option
$options['load_data'] = $loadData; $options['load_data'] = $loadData;
// check if xpath was set in options // check if xpath was set in options
$xpath = false; $xpath = false;
@ -221,29 +215,29 @@ class Hello_worldModelGreeting extends JModelAdmin
$form->setValue($redirectedField, null, $redirectedValue); $form->setValue($redirectedField, null, $redirectedValue);
} }
} }
return $form; return $form;
} }
/** /**
* Method to get the script that have to be included on the form * Method to get the script that have to be included on the form
* *
* @return string script files * @return string script files
*/ */
public function getScript() public function getScript()
{ {
return 'administrator/components/com_hello_world/models/forms/greeting.js'; return 'media/com_hello_world/js/greeting.js';
} }
/** /**
* Method to test whether a record can be deleted. * Method to test whether a record can be deleted.
* *
* @param object $record A record object. * @param object $record A record object.
* *
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
* *
* @since 1.6 * @since 1.6
*/ */
protected function canDelete($record) protected function canDelete($record)
{ {
if (!empty($record->id)) if (!empty($record->id))
{ {
@ -256,19 +250,19 @@ class Hello_worldModelGreeting extends JModelAdmin
// The record has been set. Check the record permissions. // The record has been set. Check the record permissions.
return $user->authorise('core.delete', 'com_hello_world.greeting.' . (int) $record->id); return $user->authorise('core.delete', 'com_hello_world.greeting.' . (int) $record->id);
} }
return false; return false;
} }
/** /**
* Method to test whether a record can have its state edited. * Method to test whether a record can have its state edited.
* *
* @param object $record A record object. * @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. * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
* *
* @since 1.6 * @since 1.6
*/ */
protected function canEditState($record) protected function canEditState($record)
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0; $recordId = (!empty($record->id)) ? $record->id : 0;
@ -283,103 +277,103 @@ class Hello_worldModelGreeting extends JModelAdmin
} }
} }
// In the absense of better information, revert to the component permissions. // In the absense of better information, revert to the component permissions.
return parent::canEditState($record); return parent::canEditState($record);
} }
/** /**
* Method override to check if you can edit an existing record. * Method override to check if you can edit an existing record.
* *
* @param array $data An array of input data. * @param array $data An array of input data.
* @param string $key The name of the key for the primary key. * @param string $key The name of the key for the primary key.
* *
* @return boolean * @return boolean
* @since 2.5 * @since 2.5
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// Check specific edit permission then general edit permission. // Check specific edit permission then general edit permission.
return JFactory::getUser()->authorise('core.edit', 'com_hello_world.greeting.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); return JFactory::getUser()->authorise('core.edit', 'com_hello_world.greeting.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
} }
/** /**
* Prepare and sanitise the table data prior to saving. * Prepare and sanitise the table data prior to saving.
* *
* @param JTable $table A JTable object. * @param JTable $table A JTable object.
* *
* @return void * @return void
* *
* @since 1.6 * @since 1.6
*/ */
protected function prepareTable($table) protected function prepareTable($table)
{ {
$date = JFactory::getDate(); $date = JFactory::getDate();
$user = JFactory::getUser(); $user = JFactory::getUser();
if (isset($table->name)) if (isset($table->name))
{ {
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
} }
if (isset($table->alias) && empty($table->alias)) if (isset($table->alias) && empty($table->alias))
{ {
$table->generateAlias(); $table->generateAlias();
} }
if (empty($table->id)) if (empty($table->id))
{ {
$table->created = $date->toSql(); $table->created = $date->toSql();
// set the user // set the user
if ($table->created_by == 0 || empty($table->created_by)) if ($table->created_by == 0 || empty($table->created_by))
{ {
$table->created_by = $user->id; $table->created_by = $user->id;
} }
// Set ordering to the last item if not set // Set ordering to the last item if not set
if (empty($table->ordering)) if (empty($table->ordering))
{ {
$db = JFactory::getDbo(); $db = JFactory::getDbo();
$query = $db->getQuery(true) $query = $db->getQuery(true)
->select('MAX(ordering)') ->select('MAX(ordering)')
->from($db->quoteName('#__hello_world_greeting')); ->from($db->quoteName('#__hello_world_greeting'));
$db->setQuery($query); $db->setQuery($query);
$max = $db->loadResult(); $max = $db->loadResult();
$table->ordering = $max + 1; $table->ordering = $max + 1;
} }
} }
else else
{ {
$table->modified = $date->toSql(); $table->modified = $date->toSql();
$table->modified_by = $user->id; $table->modified_by = $user->id;
} }
if (!empty($table->id)) if (!empty($table->id))
{ {
// Increment the items version number. // Increment the items version number.
$table->version++; $table->version++;
} }
} }
/** /**
* Method to get the data that should be injected in the form. * Method to get the data that should be injected in the form.
* *
* @return mixed The data for the form. * @return mixed The data for the form.
* *
* @since 1.6 * @since 1.6
*/ */
protected function loadFormData() protected function loadFormData()
{ {
// Check the session for previously entered form data. // Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_hello_world.edit.greeting.data', array()); $data = JFactory::getApplication()->getUserState('com_hello_world.edit.greeting.data', array());
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
// run the perprocess of the data // run the perprocess of the data
$this->preprocessData('com_hello_world.greeting', $data); $this->preprocessData('com_hello_world.greeting', $data);
} }
return $data; return $data;
} }
/** /**
@ -392,141 +386,141 @@ class Hello_worldModelGreeting extends JModelAdmin
protected function getUniqueFields() protected function getUniqueFields()
{ {
return false; return false;
} }
/** /**
* Method to delete one or more records. * Method to delete one or more records.
* *
* @param array &$pks An array of record primary keys. * @param array &$pks An array of record primary keys.
* *
* @return boolean True if successful, false if an error occurs. * @return boolean True if successful, false if an error occurs.
* *
* @since 12.2 * @since 12.2
*/ */
public function delete(&$pks) public function delete(&$pks)
{ {
if (!parent::delete($pks)) if (!parent::delete($pks))
{ {
return false; return false;
} }
return true; return true;
} }
/** /**
* Method to change the published state of one or more records. * Method to change the published state of one or more records.
* *
* @param array &$pks A list of the primary keys to change. * @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state. * @param integer $value The value of the published state.
* *
* @return boolean True on success. * @return boolean True on success.
* *
* @since 12.2 * @since 12.2
*/ */
public function publish(&$pks, $value = 1) public function publish(&$pks, $value = 1)
{ {
if (!parent::publish($pks, $value)) if (!parent::publish($pks, $value))
{ {
return false; return false;
} }
return true; return true;
} }
/** /**
* Method to perform batch operations on an item or a set of items. * Method to perform batch operations on an item or a set of items.
* *
* @param array $commands An array of commands to perform. * @param array $commands An array of commands to perform.
* @param array $pks An array of item ids. * @param array $pks An array of item ids.
* @param array $contexts An array of item contexts. * @param array $contexts An array of item contexts.
* *
* @return boolean Returns true on success, false on failure. * @return boolean Returns true on success, false on failure.
* *
* @since 12.2 * @since 12.2
*/ */
public function batch($commands, $pks, $contexts) public function batch($commands, $pks, $contexts)
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
ArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
{ {
unset($pks[array_search(0, $pks, true)]); unset($pks[array_search(0, $pks, true)]);
} }
if (empty($pks)) if (empty($pks))
{ {
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false; return false;
} }
$done = false; $done = false;
// Set some needed variables. // Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType; $this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName); $this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = Hello_worldHelper::getActions('greeting'); $this->canDo = Hello_worldHelper::getActions('greeting');
$this->batchSet = true; $this->batchSet = true;
if (!$this->canDo->get('core.batch')) if (!$this->canDo->get('core.batch'))
{ {
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false; return false;
} }
if ($this->type == false) if ($this->type == false)
{ {
$type = new JUcmType; $type = new JUcmType;
$this->type = $type->getTypeByAlias($this->typeAlias); $this->type = $type->getTypeByAlias($this->typeAlias);
} }
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
$result = $this->batchCopy($commands, $pks, $contexts); $result = $this->batchCopy($commands, $pks, $contexts);
if (is_array($result)) if (is_array($result))
{ {
foreach ($result as $old => $new) foreach ($result as $old => $new)
{ {
$contexts[$new] = $contexts[$old]; $contexts[$new] = $contexts[$old];
} }
$pks = array_values($result); $pks = array_values($result);
} }
else else
{ {
return false; return false;
} }
} }
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
{ {
return false; return false;
} }
$done = true; $done = true;
} }
if (!$done) if (!$done)
{ {
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false; return false;
} }
// Clear the cache // Clear the cache
$this->cleanCache(); $this->cleanCache();
return true; return true;
} }
/** /**
@ -778,38 +772,38 @@ class Hello_worldModelGreeting extends JModelAdmin
$this->cleanCache(); $this->cleanCache();
return true; return true;
} }
/** /**
* Method to save the form data. * Method to save the form data.
* *
* @param array $data The form data. * @param array $data The form data.
* *
* @return boolean True on success. * @return boolean True on success.
* *
* @since 1.6 * @since 1.6
*/ */
public function save($data) public function save($data)
{ {
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance(); $filter = JFilterInput::getInstance();
// set the metadata to the Item Data // set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author'])) if (isset($data['metadata']) && isset($data['metadata']['author']))
{ {
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry; $metadata = new JRegistry;
$metadata->loadArray($data['metadata']); $metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata; $data['metadata'] = (string) $metadata;
} }
// Set the Params Items to data // Set the Params Items to data
if (isset($data['params']) && is_array($data['params'])) if (isset($data['params']) && is_array($data['params']))
{ {
$params = new JRegistry; $params = new JRegistry;
$params->loadArray($data['params']); $params->loadArray($data['params']);
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the unique field for save as copy // Alter the unique field for save as copy
@ -824,37 +818,37 @@ class Hello_worldModelGreeting extends JModelAdmin
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
if (parent::save($data)) if (parent::save($data))
{ {
return true; return true;
} }
return false; return false;
} }
/** /**
* Method to generate a unique value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
* *
* @return string New value. * @return string New value.
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUnique($field,$value) protected function generateUnique($field,$value)
{ {
// set field value unique // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = StringHelper::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
} }
/** /**
@ -877,5 +871,5 @@ class Hello_worldModelGreeting extends JModelAdmin
} }
return $title; return $title;
} }
} }

View File

@ -1,70 +1,70 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greetings.php @subpackage greetings.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Greetings Model * Greetings Model
*/ */
class Hello_worldModelGreetings extends JModelList class Hello_worldModelGreetings extends JModelList
{ {
public function __construct($config = array()) public function __construct($config = array())
{ {
if (empty($config['filter_fields'])) if (empty($config['filter_fields']))
{ {
$config['filter_fields'] = array( $config['filter_fields'] = array(
'a.id','id', 'a.id','id',
'a.published','published', 'a.published','published',
'a.access','access', 'a.access','access',
'a.ordering','ordering', 'a.ordering','ordering',
'a.created_by','created_by', 'a.created_by','created_by',
'a.modified_by','modified_by', 'a.modified_by','modified_by',
'a.greeting','greeting' 'a.greeting','greeting'
); );
} }
parent::__construct($config); parent::__construct($config);
} }
/** /**
* Method to auto-populate the model state. * Method to auto-populate the model state.
* *
* Note. Calling getState in this method will result in recursion. * Note. Calling getState in this method will result in recursion.
* *
* @param string $ordering An optional ordering field. * @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc). * @param string $direction An optional direction (asc|desc).
* *
* @return void * @return void
* *
*/ */
protected function populateState($ordering = null, $direction = null) protected function populateState($ordering = null, $direction = null)
{ {
$app = JFactory::getApplication(); $app = JFactory::getApplication();
// Adjust the context to support modal layouts. // Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout')) if ($layout = $app->input->get('layout'))
{ {
$this->context .= '.' . $layout; $this->context .= '.' . $layout;
} }
// Check if the form was submitted // Check if the form was submitted
@ -97,36 +97,36 @@ class Hello_worldModelGreetings extends JModelList
{ {
$greeting = $app->input->post->get('greeting'); $greeting = $app->input->post->get('greeting');
$this->setState('filter.greeting', $greeting); $this->setState('filter.greeting', $greeting);
} }
// List state information. // List state information.
parent::populateState($ordering, $direction); parent::populateState($ordering, $direction);
} }
/** /**
* Method to get an array of data items. * Method to get an array of data items.
* *
* @return mixed An array of data items on success, false on failure. * @return mixed An array of data items on success, false on failure.
*/ */
public function getItems() public function getItems()
{ {
// check in items // Check in items
$this->checkInNow(); $this->checkInNow();
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// return items // return items
return $items; return $items;
} }
/** /**
* Method to build an SQL query to load the list data. * Method to build an SQL query to load the list data.
* *
* @return string An SQL query * @return string An SQL query
*/ */
protected function getListQuery() protected function getListQuery()
{ {
// Get the user object. // Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// Create a new query object. // Create a new query object.
@ -196,7 +196,7 @@ class Hello_worldModelGreetings extends JModelList
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
} }
return $query; return $query;
} }
/** /**
@ -311,16 +311,16 @@ class Hello_worldModelGreetings extends JModelList
return $headers; return $headers;
} }
return false; return false;
} }
/** /**
* Method to get a store id based on model configuration state. * Method to get a store id based on model configuration state.
* *
* @return string A store id. * @return string A store id.
* *
*/ */
protected function getStoreId($id = '') protected function getStoreId($id = '')
{ {
// Compile the store id. // Compile the store id.
$id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.search');
@ -340,9 +340,9 @@ class Hello_worldModelGreetings extends JModelList
$id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.greeting'); $id .= ':' . $this->getState('filter.greeting');
return parent::getStoreId($id); return parent::getStoreId($id);
} }
/** /**
@ -361,17 +361,19 @@ class Hello_worldModelGreetings extends JModelList
// Get a db connection. // Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// reset query // Reset query.
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select('*'); $query->select('*');
$query->from($db->quoteName('#__hello_world_greeting')); $query->from($db->quoteName('#__hello_world_greeting'));
$db->setQuery($query); // Only select items that are checked out.
$query->where($db->quoteName('checked_out') . '!=0');
$db->setQuery($query, 0, 1);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
// Get Yesterdays date // Get Yesterdays date.
$date = JFactory::getDate()->modify($time)->toSql(); $date = JFactory::getDate()->modify($time)->toSql();
// reset query // Reset query.
$query = $db->getQuery(true); $query = $db->getQuery(true);
// Fields to update. // Fields to update.
@ -386,7 +388,7 @@ class Hello_worldModelGreetings extends JModelList
$db->quoteName('checked_out_time') . '<\''.$date.'\'' $db->quoteName('checked_out_time') . '<\''.$date.'\''
); );
// Check table // Check table.
$query->update($db->quoteName('#__hello_world_greeting'))->set($fields)->where($conditions); $query->update($db->quoteName('#__hello_world_greeting'))->set($fields)->where($conditions);
$db->setQuery($query); $db->setQuery($query);
@ -396,5 +398,5 @@ class Hello_worldModelGreetings extends JModelList
} }
return false; return false;
} }
} }

View File

@ -1,40 +1,42 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage hello_world.php @subpackage hello_world.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/**
* Hello_world Model
*/ /**
class Hello_worldModelHello_world extends JModelList * Hello_world Model
{ */
public function getIcons() class Hello_worldModelHello_world extends JModelList
{ {
// load user for access menus public function getIcons()
$user = JFactory::getUser(); {
// reset icon array // load user for access menus
$icons = array(); $user = JFactory::getUser();
// view groups array // reset icon array
$viewGroups = array( $icons = array();
'main' => array('png.greeting.add', 'png.greetings') // view groups array
$viewGroups = array(
'main' => array('png.greeting.add', 'png.greetings')
); );
// view access array // view access array
$viewAccess = array( $viewAccess = array(
@ -42,190 +44,190 @@ class Hello_worldModelHello_world extends JModelList
'greeting.access' => 'greeting.access', 'greeting.access' => 'greeting.access',
'greetings.submenu' => 'greeting.submenu', 'greetings.submenu' => 'greeting.submenu',
'greetings.dashboard_list' => 'greeting.dashboard_list', 'greetings.dashboard_list' => 'greeting.dashboard_list',
'greeting.dashboard_add' => 'greeting.dashboard_add'); 'greeting.dashboard_add' => 'greeting.dashboard_add');
// loop over the $views // loop over the $views
foreach($viewGroups as $group => $views) foreach($viewGroups as $group => $views)
{ {
$i = 0; $i = 0;
if (Hello_worldHelper::checkArray($views)) if (Hello_worldHelper::checkArray($views))
{ {
foreach($views as $view) foreach($views as $view)
{ {
$add = false; $add = false;
// external views (links) // external views (links)
if (strpos($view,'||') !== false) if (strpos($view,'||') !== false)
{ {
$dwd = explode('||', $view); $dwd = explode('||', $view);
if (count($dwd) == 3) if (count($dwd) == 3)
{ {
list($type, $name, $url) = $dwd; list($type, $name, $url) = $dwd;
$viewName = $name; $viewName = $name;
$alt = $name; $alt = $name;
$url = $url; $url = $url;
$image = $name . '.' . $type; $image = $name . '.' . $type;
$name = 'COM_HELLO_WORLD_DASHBOARD_' . Hello_worldHelper::safeString($name,'U'); $name = 'COM_HELLO_WORLD_DASHBOARD_' . Hello_worldHelper::safeString($name,'U');
} }
} }
// internal views // internal views
elseif (strpos($view,'.') !== false) elseif (strpos($view,'.') !== false)
{ {
$dwd = explode('.', $view); $dwd = explode('.', $view);
if (count($dwd) == 3) if (count($dwd) == 3)
{ {
list($type, $name, $action) = $dwd; list($type, $name, $action) = $dwd;
} }
elseif (count($dwd) == 2) elseif (count($dwd) == 2)
{ {
list($type, $name) = $dwd; list($type, $name) = $dwd;
$action = false; $action = false;
} }
if ($action) if ($action)
{ {
$viewName = $name; $viewName = $name;
switch($action) switch($action)
{ {
case 'add': case 'add':
$url = 'index.php?option=com_hello_world&view=' . $name . '&layout=edit'; $url = 'index.php?option=com_hello_world&view=' . $name . '&layout=edit';
$image = $name . '_' . $action. '.' . $type; $image = $name . '_' . $action. '.' . $type;
$alt = $name . '&nbsp;' . $action; $alt = $name . '&nbsp;' . $action;
$name = 'COM_HELLO_WORLD_DASHBOARD_'.Hello_worldHelper::safeString($name,'U').'_ADD'; $name = 'COM_HELLO_WORLD_DASHBOARD_'.Hello_worldHelper::safeString($name,'U').'_ADD';
$add = true; $add = true;
break; break;
default: default:
// check for new convention (more stable) // check for new convention (more stable)
if (strpos($action, '_qpo0O0oqp_') !== false) if (strpos($action, '_qpo0O0oqp_') !== false)
{ {
list($action, $extension) = (array) explode('_qpo0O0oqp_', $action); list($action, $extension) = (array) explode('_qpo0O0oqp_', $action);
$extension = str_replace('_po0O0oq_', '.', $extension); $extension = str_replace('_po0O0oq_', '.', $extension);
} }
else else
{ {
$extension = 'com_hello_world.' . $name; $extension = 'com_hello_world.' . $name;
} }
$url = 'index.php?option=com_categories&view=categories&extension=' . $extension; $url = 'index.php?option=com_categories&view=categories&extension=' . $extension;
$image = $name . '_' . $action . '.' . $type; $image = $name . '_' . $action . '.' . $type;
$alt = $viewName . '&nbsp;' . $action; $alt = $viewName . '&nbsp;' . $action;
$name = 'COM_HELLO_WORLD_DASHBOARD_' . Hello_worldHelper::safeString($name,'U') . '_' . Hello_worldHelper::safeString($action,'U'); $name = 'COM_HELLO_WORLD_DASHBOARD_' . Hello_worldHelper::safeString($name,'U') . '_' . Hello_worldHelper::safeString($action,'U');
break; break;
} }
} }
else else
{ {
$viewName = $name; $viewName = $name;
$alt = $name; $alt = $name;
$url = 'index.php?option=com_hello_world&view=' . $name; $url = 'index.php?option=com_hello_world&view=' . $name;
$image = $name . '.' . $type; $image = $name . '.' . $type;
$name = 'COM_HELLO_WORLD_DASHBOARD_' . Hello_worldHelper::safeString($name,'U'); $name = 'COM_HELLO_WORLD_DASHBOARD_' . Hello_worldHelper::safeString($name,'U');
$hover = false; $hover = false;
} }
} }
else else
{ {
$viewName = $view; $viewName = $view;
$alt = $view; $alt = $view;
$url = 'index.php?option=com_hello_world&view=' . $view; $url = 'index.php?option=com_hello_world&view=' . $view;
$image = $view . '.png'; $image = $view . '.png';
$name = ucwords($view).'<br /><br />'; $name = ucwords($view).'<br /><br />';
$hover = false; $hover = false;
} }
// first make sure the view access is set // first make sure the view access is set
if (Hello_worldHelper::checkArray($viewAccess)) if (Hello_worldHelper::checkArray($viewAccess))
{ {
// setup some defaults // setup some defaults
$dashboard_add = false; $dashboard_add = false;
$dashboard_list = false; $dashboard_list = false;
$accessTo = ''; $accessTo = '';
$accessAdd = ''; $accessAdd = '';
// access checking start // access checking start
$accessCreate = (isset($viewAccess[$viewName.'.create'])) ? Hello_worldHelper::checkString($viewAccess[$viewName.'.create']):false; $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? Hello_worldHelper::checkString($viewAccess[$viewName.'.create']):false;
$accessAccess = (isset($viewAccess[$viewName.'.access'])) ? Hello_worldHelper::checkString($viewAccess[$viewName.'.access']):false; $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? Hello_worldHelper::checkString($viewAccess[$viewName.'.access']):false;
// set main controllers // set main controllers
$accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? Hello_worldHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false; $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? Hello_worldHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false;
$accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? Hello_worldHelper::checkString($viewAccess[$viewName.'.dashboard_list']):false; $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? Hello_worldHelper::checkString($viewAccess[$viewName.'.dashboard_list']):false;
// check for adding access // check for adding access
if ($add && $accessCreate) if ($add && $accessCreate)
{ {
$accessAdd = $viewAccess[$viewName.'.create']; $accessAdd = $viewAccess[$viewName.'.create'];
} }
elseif ($add) elseif ($add)
{ {
$accessAdd = 'core.create'; $accessAdd = 'core.create';
} }
// check if access to view is set // check if access to view is set
if ($accessAccess) if ($accessAccess)
{ {
$accessTo = $viewAccess[$viewName.'.access']; $accessTo = $viewAccess[$viewName.'.access'];
} }
// set main access controllers // set main access controllers
if ($accessDashboard_add) if ($accessDashboard_add)
{ {
$dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_hello_world'); $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_hello_world');
} }
if ($accessDashboard_list) if ($accessDashboard_list)
{ {
$dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_hello_world'); $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_hello_world');
} }
if (Hello_worldHelper::checkString($accessAdd) && Hello_worldHelper::checkString($accessTo)) if (Hello_worldHelper::checkString($accessAdd) && Hello_worldHelper::checkString($accessTo))
{ {
// check access // check access
if($user->authorise($accessAdd, 'com_hello_world') && $user->authorise($accessTo, 'com_hello_world') && $dashboard_add) if($user->authorise($accessAdd, 'com_hello_world') && $user->authorise($accessTo, 'com_hello_world') && $dashboard_add)
{ {
$icons[$group][$i] = new StdClass; $icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url; $icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name; $icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image; $icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt; $icons[$group][$i]->alt = $alt;
} }
} }
elseif (Hello_worldHelper::checkString($accessTo)) elseif (Hello_worldHelper::checkString($accessTo))
{ {
// check access // check access
if($user->authorise($accessTo, 'com_hello_world') && $dashboard_list) if($user->authorise($accessTo, 'com_hello_world') && $dashboard_list)
{ {
$icons[$group][$i] = new StdClass; $icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url; $icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name; $icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image; $icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt; $icons[$group][$i]->alt = $alt;
} }
} }
elseif (Hello_worldHelper::checkString($accessAdd)) elseif (Hello_worldHelper::checkString($accessAdd))
{ {
// check access // check access
if($user->authorise($accessAdd, 'com_hello_world') && $dashboard_add) if($user->authorise($accessAdd, 'com_hello_world') && $dashboard_add)
{ {
$icons[$group][$i] = new StdClass; $icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url; $icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name; $icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image; $icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt; $icons[$group][$i]->alt = $alt;
} }
} }
else else
{ {
$icons[$group][$i] = new StdClass; $icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url; $icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name; $icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image; $icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt; $icons[$group][$i]->alt = $alt;
} }
} }
else else
{ {
$icons[$group][$i] = new StdClass; $icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url; $icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name; $icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image; $icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt; $icons[$group][$i]->alt = $alt;
} }
$i++; $i++;
} }
} }
else else
{ {
$icons[$group][$i] = false; $icons[$group][$i] = false;
} }
} }
return $icons; return $icons;
} }
} }

View File

@ -1,372 +1,374 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage import.php @subpackage import.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\CMS\Filesystem\File;
use PhpOffice\PhpSpreadsheet\IOFactory; use Joomla\CMS\Filesystem\Folder;
use Joomla\Utilities\ArrayHelper;
/** use PhpOffice\PhpSpreadsheet\IOFactory;
* Hello_world Import Model
*/ /**
class Hello_worldModelImport extends JModelLegacy * Hello_world Import Model
{ */
// set uploading values class Hello_worldModelImport extends JModelLegacy
protected $use_streams = false; {
protected $allow_unsafe = false; // set uploading values
protected $safeFileOptions = array(); protected $use_streams = false;
protected $allow_unsafe = false;
/** protected $safeFileOptions = array();
* @var object JTable object
*/ /**
protected $_table = null; * @var object JTable object
*/
/** protected $_table = null;
* @var object JTable object
*/ /**
protected $_url = null; * @var object JTable object
*/
/** protected $_url = null;
* Model context string.
* /**
* @var string * Model context string.
*/ *
protected $_context = 'com_hello_world.import'; * @var string
*/
/** protected $_context = 'com_hello_world.import';
* Import Settings
*/ /**
protected $getType = NULL; * Import Settings
protected $dataType = NULL; */
protected $getType = NULL;
/** protected $dataType = NULL;
* Method to auto-populate the model state.
* /**
* Note. Calling getState in this method will result in recursion. * Method to auto-populate the model state.
* *
* @return void * Note. Calling getState in this method will result in recursion.
* *
*/ * @return void
protected function populateState() *
{ */
$app = JFactory::getApplication('administrator'); protected function populateState()
{
$this->setState('message', $app->getUserState('com_hello_world.message')); $app = JFactory::getApplication('administrator');
$app->setUserState('com_hello_world.message', '');
$this->setState('message', $app->getUserState('com_hello_world.message'));
// Recall the 'Import from Directory' path. $app->setUserState('com_hello_world.message', '');
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
$this->setState('import.directory', $path); // Recall the 'Import from Directory' path.
parent::populateState(); $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 * Import an spreadsheet from either folder, url or upload.
* *
*/ * @return boolean result of import
public function import() *
{ */
$this->setState('action', 'import'); public function import()
$app = JFactory::getApplication(); {
$session = JFactory::getSession(); $this->setState('action', 'import');
$package = null; $app = JFactory::getApplication();
$continue = false; $session = JFactory::getSession();
// get import type $package = null;
$this->getType = $app->input->getString('gettype', NULL); $continue = false;
// get import type // get import type
$this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL); $this->getType = $app->input->getString('gettype', NULL);
// get import type
if ($package === null) $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL);
{
switch ($this->getType) if ($package === null)
{ {
case 'folder': switch ($this->getType)
// Remember the 'Import from Directory' path. {
$app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory'); case 'folder':
$package = $this->_getPackageFromFolder(); // Remember the 'Import from Directory' path.
break; $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory');
$package = $this->_getPackageFromFolder();
case 'upload': break;
$package = $this->_getPackageFromUpload();
break; case 'upload':
$package = $this->_getPackageFromUpload();
case 'url': break;
$package = $this->_getPackageFromUrl();
break; case 'url':
$package = $this->_getPackageFromUrl();
case 'continue': break;
$continue = true;
$package = $session->get('package', null); case 'continue':
$package = json_decode($package, true); $continue = true;
// clear session $package = $session->get('package', null);
$session->clear('package'); $package = json_decode($package, true);
$session->clear('dataType'); // clear session
$session->clear('hasPackage'); $session->clear('package');
break; $session->clear('dataType');
$session->clear('hasPackage');
default: break;
$app->setUserState('com_hello_world.message', JText::_('COM_HELLO_WORLD_IMPORT_NO_IMPORT_TYPE_FOUND'));
default:
return false; $app->setUserState('com_hello_world.message', JText::_('COM_HELLO_WORLD_IMPORT_NO_IMPORT_TYPE_FOUND'));
break;
} return false;
} break;
// Was the package valid? }
if (!$package || !$package['type']) }
{ // Was the package valid?
if (in_array($this->getType, array('upload', 'url'))) if (!$package || !$package['type'])
{ {
$this->remove($package['packagename']); if (in_array($this->getType, array('upload', 'url')))
} {
$this->remove($package['packagename']);
$app->setUserState('com_hello_world.message', JText::_('COM_HELLO_WORLD_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); }
return false;
} $app->setUserState('com_hello_world.message', JText::_('COM_HELLO_WORLD_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE'));
return false;
// first link data to table headers }
if(!$continue){
$package = json_encode($package); // first link data to table headers
$session->set('package', $package); if(!$continue){
$session->set('dataType', $this->dataType); $package = json_encode($package);
$session->set('hasPackage', true); $session->set('package', $package);
return true; $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)) // set the data
{ $headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true);
// There was an error importing the package if (!$this->setData($package,$this->dataType,$headerList))
$msg = JText::_('COM_HELLO_WORLD_IMPORT_ERROR'); {
$back = $session->get('backto_VDM_IMPORT', NULL); // There was an error importing the package
if ($back) $msg = JText::_('COM_HELLO_WORLD_IMPORT_ERROR');
{ $back = $session->get('backto_VDM_IMPORT', NULL);
$app->setUserState('com_hello_world.redirect_url', 'index.php?option=com_hello_world&view='.$back); if ($back)
$session->clear('backto_VDM_IMPORT'); {
} $app->setUserState('com_hello_world.redirect_url', 'index.php?option=com_hello_world&view='.$back);
$result = false; $session->clear('backto_VDM_IMPORT');
} }
else $result = false;
{ }
// Package imported sucessfully else
$msg = JText::sprintf('COM_HELLO_WORLD_IMPORT_SUCCESS', $package['packagename']); {
$back = $session->get('backto_VDM_IMPORT', NULL); // Package imported sucessfully
if ($back) $msg = JText::sprintf('COM_HELLO_WORLD_IMPORT_SUCCESS', $package['packagename']);
{ $back = $session->get('backto_VDM_IMPORT', NULL);
$app->setUserState('com_hello_world.redirect_url', 'index.php?option=com_hello_world&view='.$back); if ($back)
$session->clear('backto_VDM_IMPORT'); {
} $app->setUserState('com_hello_world.redirect_url', 'index.php?option=com_hello_world&view='.$back);
$result = true; $session->clear('backto_VDM_IMPORT');
} }
$result = true;
// Set some model state values }
$app->enqueueMessage($msg);
// Set some model state values
// remove file after import $app->enqueueMessage($msg);
$this->remove($package['packagename']);
$session->clear($this->getType.'_VDM_IMPORTHEADERS'); // remove file after import
$this->remove($package['packagename']);
return $result; $session->clear($this->getType.'_VDM_IMPORTHEADERS');
}
return $result;
/** }
* Works out an importation spreadsheet from a HTTP upload
* /**
* @return spreadsheet definition or false on failure * Works out an importation spreadsheet from a HTTP upload
*/ *
protected function _getPackageFromUpload() * @return spreadsheet definition or false on failure
{ */
// Get the uploaded file information protected function _getPackageFromUpload()
$app = JFactory::getApplication(); {
$input = $app->input; // Get the uploaded file information
$app = JFactory::getApplication();
// Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. $input = $app->input;
$userfile = $input->files->get('import_package', null, 'raw');
// Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get.
// Make sure that file uploads are enabled in php $userfile = $input->files->get('import_package', null, 'raw');
if (!(bool) ini_get('file_uploads'))
{ // Make sure that file uploads are enabled in php
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); if (!(bool) ini_get('file_uploads'))
return false; {
} $app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_WARNIMPORTFILE'), 'warning');
return false;
// If there is no uploaded file, we have a problem... }
if (!is_array($userfile))
{ // If there is no uploaded file, we have a problem...
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); if (!is_array($userfile))
return false; {
} $app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_NO_FILE_SELECTED'), 'warning');
return false;
// Check if there was a problem uploading the file. }
if ($userfile['error'] || $userfile['size'] < 1)
{ // Check if there was a problem uploading the file.
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); if ($userfile['error'] || $userfile['size'] < 1)
return false; {
} $app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning');
return false;
// Build the appropriate paths }
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; // Build the appropriate paths
$tmp_src = $userfile['tmp_name']; $config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name'];
// Move uploaded file $tmp_src = $userfile['tmp_name'];
jimport('joomla.filesystem.file');
$p_file = JFile::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); // Move uploaded file
jimport('joomla.filesystem.file');
// Was the package downloaded? $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions);
if (!$p_file)
{ // Was the package downloaded?
$session = JFactory::getSession(); if (!$p_file)
$session->clear('package'); {
$session->clear('dataType'); $session = JFactory::getSession();
$session->clear('hasPackage'); $session->clear('package');
// was not uploaded $session->clear('dataType');
return false; $session->clear('hasPackage');
} // was not uploaded
return false;
// check that this is a valid spreadsheet }
$package = $this->check($userfile['name']);
// check that this is a valid spreadsheet
return $package; $package = $this->check($userfile['name']);
}
return $package;
/** }
* Import an spreadsheet from a directory
* /**
* @return array Spreadsheet details or false on failure * Import an spreadsheet from a directory
* *
*/ * @return array Spreadsheet details or false on failure
protected function _getPackageFromFolder() *
{ */
$app = JFactory::getApplication(); protected function _getPackageFromFolder()
$input = $app->input; {
$app = JFactory::getApplication();
// Get the path to the package to import $input = $app->input;
$p_dir = $input->getString('import_directory');
$p_dir = JPath::clean($p_dir); // Get the path to the package to import
// Did you give us a valid path? $p_dir = $input->getString('import_directory');
if (!file_exists($p_dir)) $p_dir = JPath::clean($p_dir);
{ // Did you give us a valid path?
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); if (!file_exists($p_dir))
return false; {
} $app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning');
return false;
// Detect the package type }
$type = $this->getType;
// Detect the package type
// Did you give us a valid package? $type = $this->getType;
if (!$type)
{ // Did you give us a valid package?
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); if (!$type)
} {
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning');
// check the extention }
if(!$this->checkExtension($p_dir))
{ // check the extention
// set error message if(!$this->checkExtension($p_dir))
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); {
return false; // set error message
} $app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
return false;
$package['packagename'] = null; }
$package['dir'] = $p_dir;
$package['type'] = $type; $package['packagename'] = null;
$package['dir'] = $p_dir;
return $package; $package['type'] = $type;
}
return $package;
/** }
* Import an spreadsheet from a URL
* /**
* @return Package details or false on failure * Import an spreadsheet from a URL
* *
*/ * @return Package details or false on failure
protected function _getPackageFromUrl() *
{ */
$app = JFactory::getApplication(); protected function _getPackageFromUrl()
$input = $app->input; {
$app = JFactory::getApplication();
// Get the URL of the package to import $input = $app->input;
$url = $input->getString('import_url');
// Get the URL of the package to import
// Did you give us a URL? $url = $input->getString('import_url');
if (!$url)
{ // Did you give us a URL?
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_ENTER_A_URL'), 'warning'); if (!$url)
return false; {
} $app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_ENTER_A_URL'), 'warning');
return false;
// Download the package at the URL given }
$p_file = JInstallerHelper::downloadPackage($url);
// Download the package at the URL given
// Was the package downloaded? $p_file = JInstallerHelper::downloadPackage($url);
if (!$p_file)
{ // Was the package downloaded?
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_INVALID_URL'), 'warning'); if (!$p_file)
return false; {
} $app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_INVALID_URL'), 'warning');
return false;
// check that this is a valid spreadsheet }
$package = $this->check($p_file);
// check that this is a valid spreadsheet
return $package; $package = $this->check($p_file);
}
return $package;
/** }
* Check a file and verifies it as a spreadsheet file
* Supports .csv .xlsx .xls and .ods /**
* * Check a file and verifies it as a spreadsheet file
* @param string $p_filename The uploaded package filename or import directory * Supports .csv .xlsx .xls and .ods
* *
* @return array of elements * @param string $p_filename The uploaded package filename or import directory
* *
*/ * @return array of elements
protected function check($archivename) *
{ */
$app = JFactory::getApplication(); protected function check($archivename)
// Clean the name {
$archivename = JPath::clean($archivename); $app = JFactory::getApplication();
// Clean the name
// check the extention $archivename = JPath::clean($archivename);
if(!$this->checkExtension($archivename))
{ // check the extention
// Cleanup the import files if(!$this->checkExtension($archivename))
$this->remove($archivename); {
$app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); // Cleanup the import files
return false; $this->remove($archivename);
} $app->enqueueMessage(JText::_('COM_HELLO_WORLD_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
return false;
$config = JFactory::getConfig(); }
// set Package Name
$check['packagename'] = $archivename; $config = JFactory::getConfig();
// set Package Name
// set directory $check['packagename'] = $archivename;
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
// set directory
// set type $check['dir'] = $config->get('tmp_path'). '/' .$archivename;
$check['type'] = $this->getType;
// set type
return $check; $check['type'] = $this->getType;
return $check;
} }
/** /**
@ -389,33 +391,33 @@ class Hello_worldModelImport extends JModelLegacy
break; break;
} }
return false; return false;
} }
/** /**
* Clean up temporary uploaded spreadsheet * Clean up temporary uploaded spreadsheet
* *
* @param string $package Name of the uploaded spreadsheet file * @param string $package Name of the uploaded spreadsheet file
* *
* @return boolean True on success * @return boolean True on success
* *
*/ */
protected function remove($package) protected function remove($package)
{ {
jimport('joomla.filesystem.file'); jimport('joomla.filesystem.file');
$config = JFactory::getConfig(); $config = JFactory::getConfig();
$package = $config->get('tmp_path'). '/' .$package; $package = $config->get('tmp_path'). '/' .$package;
// Is the package file a valid file? // Is the package file a valid file?
if (is_file($package)) if (is_file($package))
{ {
JFile::delete($package); File::delete($package);
} }
elseif (is_file(JPath::clean($package))) elseif (is_file(JPath::clean($package)))
{ {
// It might also be just a base filename // It might also be just a base filename
JFile::delete(JPath::clean($package)); File::delete(JPath::clean($package));
} }
} }
/** /**
@ -679,70 +681,70 @@ class Hello_worldModelImport extends JModelLegacy
} }
} }
return false; return false;
} }
protected function getAlias($name,$type = false) protected function getAlias($name,$type = false)
{ {
// sanitize the name to an alias // sanitize the name to an alias
if (JFactory::getConfig()->get('unicodeslugs') == 1) if (JFactory::getConfig()->get('unicodeslugs') == 1)
{ {
$alias = JFilterOutput::stringURLUnicodeSlug($name); $alias = JFilterOutput::stringURLUnicodeSlug($name);
} }
else else
{ {
$alias = JFilterOutput::stringURLSafe($name); $alias = JFilterOutput::stringURLSafe($name);
} }
// must be a uniqe alias // must be a uniqe alias
if ($type) if ($type)
{ {
return $this->getUniqe($alias,'alias',$type); return $this->getUniqe($alias,'alias',$type);
} }
return $alias; return $alias;
} }
/** /**
* Method to generate a uniqe value. * Method to generate a uniqe value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
* @param string $type table. * @param string $type table.
* *
* @return string New value. * @return string New value.
*/ */
protected function getUniqe($value,$field,$type) protected function getUniqe($value,$field,$type)
{ {
// insure the filed is always uniqe // insure the filed is always uniqe
while (isset($this->uniqeValueArray[$type][$field][$value])) while (isset($this->uniqeValueArray[$type][$field][$value]))
{ {
$value = JString::increment($value, 'dash'); $value = JString::increment($value, 'dash');
} }
$this->uniqeValueArray[$type][$field][$value] = $value; $this->uniqeValueArray[$type][$field][$value] = $value;
return $value; return $value;
} }
protected function getAliasesUsed($table) protected function getAliasesUsed($table)
{ {
// Get a db connection. // Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// first we check if there is a alias column // first we check if there is a alias column
$columns = $db->getTableColumns('#__hello_world_'.$table); $columns = $db->getTableColumns('#__hello_world_'.$table);
if(isset($columns['alias'])){ if(isset($columns['alias'])){
// Create a new query object. // Create a new query object.
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select($db->quoteName(array('alias'))); $query->select($db->quoteName(array('alias')));
$query->from($db->quoteName('#__hello_world_'.$table)); $query->from($db->quoteName('#__hello_world_'.$table));
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
$aliases = $db->loadColumn(); $aliases = $db->loadColumn();
foreach($aliases as $alias) foreach($aliases as $alias)
{ {
$this->uniqeValueArray[$table]['alias'][$alias] = $alias; $this->uniqeValueArray[$table]['alias'][$alias] = $alias;
} }
} }
return true; return true;
} }
return false; return false;
} }
} }

View File

@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS `#__hello_world_greeting` (
`id` INT(11) NOT NULL AUTO_INCREMENT, `id` INT(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
`greeting` VARCHAR(255) NOT NULL DEFAULT '', `greeting` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NOT NULL, `params` text NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1, `published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0, `created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0,

View File

@ -1,322 +1,322 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greeting.php @subpackage greeting.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper; use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Greetings Table class * Greetings Table class
*/ */
class Hello_worldTableGreeting extends JTable class Hello_worldTableGreeting extends JTable
{ {
/** /**
* Ensure the params and metadata in json encoded in the bind method * Ensure the params and metadata in json encoded in the bind method
* *
* @var array * @var array
* @since 3.3 * @since 3.3
*/ */
protected $_jsonEncode = array('params', 'metadata'); protected $_jsonEncode = array('params', 'metadata');
/** /**
* Constructor * Constructor
* *
* @param object Database connector object * @param object Database connector object
*/ */
function __construct(&$db) function __construct(&$db)
{ {
parent::__construct('#__hello_world_greeting', 'id', $db); parent::__construct('#__hello_world_greeting', 'id', $db);
// Adding History Options // Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_hello_world.greeting')); JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_hello_world.greeting'));
} }
public function bind($array, $ignore = '') public function bind($array, $ignore = '')
{ {
if (isset($array['params']) && is_array($array['params'])) if (isset($array['params']) && is_array($array['params']))
{ {
$registry = new JRegistry; $registry = new JRegistry;
$registry->loadArray($array['params']); $registry->loadArray($array['params']);
$array['params'] = (string) $registry; $array['params'] = (string) $registry;
} }
if (isset($array['metadata']) && is_array($array['metadata'])) if (isset($array['metadata']) && is_array($array['metadata']))
{ {
$registry = new JRegistry; $registry = new JRegistry;
$registry->loadArray($array['metadata']); $registry->loadArray($array['metadata']);
$array['metadata'] = (string) $registry; $array['metadata'] = (string) $registry;
} }
// Bind the rules. // Bind the rules.
if (isset($array['rules']) && is_array($array['rules'])) if (isset($array['rules']) && is_array($array['rules']))
{ {
$rules = new JAccessRules($array['rules']); $rules = new JAccessRules($array['rules']);
$this->setRules($rules); $this->setRules($rules);
} }
return parent::bind($array, $ignore); return parent::bind($array, $ignore);
} }
/** /**
* Overload the store method for the Greeting table. * Overload the store method for the Greeting table.
* *
* @param boolean Toggle whether null values should be updated. * @param boolean Toggle whether null values should be updated.
* @return boolean True on success, false on failure. * @return boolean True on success, false on failure.
* @since 1.6 * @since 1.6
*/ */
public function store($updateNulls = false) public function store($updateNulls = false)
{ {
$date = JFactory::getDate(); $date = JFactory::getDate();
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($this->id) if ($this->id)
{ {
// Existing item // Existing item
$this->modified = $date->toSql(); $this->modified = $date->toSql();
$this->modified_by = $user->get('id'); $this->modified_by = $user->get('id');
} }
else else
{ {
// New greeting. A greeting created and created_by field can be set by the user, // New greeting. A greeting created and created_by field can be set by the user,
// so we don't touch either of these if they are set. // so we don't touch either of these if they are set.
if (!(int) $this->created) if (!(int) $this->created)
{ {
$this->created = $date->toSql(); $this->created = $date->toSql();
} }
if (empty($this->created_by)) if (empty($this->created_by))
{ {
$this->created_by = $user->get('id'); $this->created_by = $user->get('id');
} }
} }
if (isset($this->alias)) if (isset($this->alias))
{ {
// Verify that the alias is unique // Verify that the alias is unique
$table = JTable::getInstance('greeting', 'Hello_worldTable'); $table = JTable::getInstance('greeting', 'Hello_worldTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{ {
$this->setError(JText::_('COM_HELLO_WORLD_GREETING_ERROR_UNIQUE_ALIAS')); $this->setError(JText::_('COM_HELLO_WORLD_GREETING_ERROR_UNIQUE_ALIAS'));
return false; return false;
} }
} }
if (isset($this->url)) if (isset($this->url))
{ {
// Convert IDN urls to punycode // Convert IDN urls to punycode
$this->url = JStringPunycode::urlToPunycode($this->url); $this->url = JStringPunycode::urlToPunycode($this->url);
} }
if (isset($this->website)) if (isset($this->website))
{ {
// Convert IDN urls to punycode // Convert IDN urls to punycode
$this->website = JStringPunycode::urlToPunycode($this->website); $this->website = JStringPunycode::urlToPunycode($this->website);
} }
return parent::store($updateNulls); return parent::store($updateNulls);
} }
/** /**
* Overloaded check method to ensure data integrity. * Overloaded check method to ensure data integrity.
* *
* @return boolean True on success. * @return boolean True on success.
*/ */
public function check() public function check()
{ {
if (isset($this->alias)) if (isset($this->alias))
{ {
// Generate a valid alias // Generate a valid alias
$this->generateAlias(); $this->generateAlias();
$table = JTable::getInstance('greeting', 'hello_worldTable'); $table = JTable::getInstance('greeting', 'hello_worldTable');
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{ {
$this->alias = StringHelper::increment($this->alias, 'dash'); $this->alias = StringHelper::increment($this->alias, 'dash');
} }
} }
/* /*
* Clean up keywords -- eliminate extra spaces between phrases * Clean up keywords -- eliminate extra spaces between phrases
* and cr (\r) and lf (\n) characters from string. * and cr (\r) and lf (\n) characters from string.
* Only process if not empty. * Only process if not empty.
*/ */
if (!empty($this->metakey)) if (!empty($this->metakey))
{ {
// Array of characters to remove. // Array of characters to remove.
$bad_characters = array("\n", "\r", "\"", "<", ">"); $bad_characters = array("\n", "\r", "\"", "<", ">");
// Remove bad characters. // Remove bad characters.
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
// Create array using commas as delimiter. // Create array using commas as delimiter.
$keys = explode(',', $after_clean); $keys = explode(',', $after_clean);
$clean_keys = array(); $clean_keys = array();
foreach ($keys as $key) foreach ($keys as $key)
{ {
// Ignore blank keywords. // Ignore blank keywords.
if (trim($key)) if (trim($key))
{ {
$clean_keys[] = trim($key); $clean_keys[] = trim($key);
} }
} }
// Put array back together delimited by ", " // Put array back together delimited by ", "
$this->metakey = implode(", ", $clean_keys); $this->metakey = implode(", ", $clean_keys);
} }
// Clean up description -- eliminate quotes and <> brackets // Clean up description -- eliminate quotes and <> brackets
if (!empty($this->metadesc)) if (!empty($this->metadesc))
{ {
// Only process if not empty // Only process if not empty
$bad_characters = array("\"", "<", ">"); $bad_characters = array("\"", "<", ">");
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); $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 we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules()) if (!$this->getRules())
{ {
$rules = $this->getDefaultAssetValues('com_hello_world.greeting.'.$this->id); $rules = $this->getDefaultAssetValues('com_hello_world.greeting.'.$this->id);
$this->setRules($rules); $this->setRules($rules);
} }
// Set ordering // Set ordering
if ($this->published < 0) if ($this->published < 0)
{ {
// Set ordering to 0 if state is archived or trashed // Set ordering to 0 if state is archived or trashed
$this->ordering = 0; $this->ordering = 0;
} }
return true; return true;
} }
/** /**
* Gets the default asset values for a component. * Gets the default asset values for a component.
* *
* @param $string $component The component asset name to search for * @param $string $component The component asset name to search for
* *
* @return JAccessRules The JAccessRules object for the asset * @return JAccessRules The JAccessRules object for the asset
*/ */
protected function getDefaultAssetValues($component, $try = true) protected function getDefaultAssetValues($component, $try = true)
{ {
// Need to find the asset id by the name of the component. // Need to find the asset id by the name of the component.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
$query = $db->getQuery(true) $query = $db->getQuery(true)
->select($db->quoteName('id')) ->select($db->quoteName('id'))
->from($db->quoteName('#__assets')) ->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component)); ->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->loadRowList()) if ($db->loadRowList())
{ {
// asset already set so use saved rules // asset already set so use saved rules
$assetId = (int) $db->loadResult(); $assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
} }
// try again // try again
elseif ($try) elseif ($try)
{ {
$try = explode('.',$component); $try = explode('.',$component);
$result = $this->getDefaultAssetValues($try[0], false); $result = $this->getDefaultAssetValues($try[0], false);
if ($result instanceof JAccessRules) if ($result instanceof JAccessRules)
{ {
if (isset($try[1])) if (isset($try[1]))
{ {
$_result = (string) $result; $_result = (string) $result;
$_result = json_decode($_result); $_result = json_decode($_result);
foreach ($_result as $name => &$rule) foreach ($_result as $name => &$rule)
{ {
$v = explode('.', $name); $v = explode('.', $name);
if ($try[1] !== $v[0]) if ($try[1] !== $v[0])
{ {
// remove since it is not part of this view // remove since it is not part of this view
unset($_result->$name); unset($_result->$name);
} }
else else
{ {
// clear the value since we inherit // clear the value since we inherit
$rule = array(); $rule = array();
} }
} }
// check if there are any view values remaining // check if there are any view values remaining
if (count( (array) $_result)) if (count( (array) $_result))
{ {
$_result = json_encode($_result); $_result = json_encode($_result);
$_result = array($_result); $_result = array($_result);
// Instantiate and return the JAccessRules object for the asset rules. // Instantiate and return the JAccessRules object for the asset rules.
$rules = new JAccessRules; $rules = new JAccessRules;
$rules->mergeCollection($_result); $rules->mergeCollection($_result);
return $rules; return $rules;
} }
} }
return $result; return $result;
} }
} }
return JAccess::getAssetRules(0); return JAccess::getAssetRules(0);
} }
/** /**
* Method to compute the default name of the asset. * Method to compute the default name of the asset.
* The default name is in the form 'table_name.id' * The default name is in the form 'table_name.id'
* where id is the value of the primary key of the table. * where id is the value of the primary key of the table.
* *
* @return string * @return string
* @since 2.5 * @since 2.5
*/ */
protected function _getAssetName() protected function _getAssetName()
{ {
$k = $this->_tbl_key; $k = $this->_tbl_key;
return 'com_hello_world.greeting.'.(int) $this->$k; return 'com_hello_world.greeting.'.(int) $this->$k;
} }
/** /**
* Method to return the title to use for the asset table. * Method to return the title to use for the asset table.
* *
* @return string * @return string
* @since 2.5 * @since 2.5
*/ */
protected function _getAssetTitle() protected function _getAssetTitle()
{ {
if (isset($this->title)) if (isset($this->title))
{ {
return $this->title; return $this->title;
} }
return ''; return '';
} }
/** /**
* Get the parent asset id for the record * Get the parent asset id for the record
* *
* @return int * @return int
* @since 2.5 * @since 2.5
*/ */
protected function _getAssetParentId(JTable $table = NULL, $id = NULL) protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
{ {
$asset = JTable::getInstance('Asset'); $asset = JTable::getInstance('Asset');
$asset->loadByName('com_hello_world'); $asset->loadByName('com_hello_world');
return $asset->id; return $asset->id;
} }
/** /**
@ -327,6 +327,6 @@ class Hello_worldTableGreeting extends JTable
public function generateAlias() public function generateAlias()
{ {
return false; return false;
} }
} }

View File

@ -1,34 +1,34 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage submitbutton.js @subpackage submitbutton.js
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
Joomla.submitbutton = function(task) Joomla.submitbutton = function(task)
{ {
if (task == ''){ if (task == ''){
return false; return false;
} else { } else {
var action = task.split('.'); var action = task.split('.');
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
Joomla.submitform(task, document.getElementById("adminForm")); Joomla.submitform(task, document.getElementById("adminForm"));
return true; return true;
} else { } else {
alert(Joomla.JText._('greeting, some values are not acceptable.','Some values are unacceptable')); alert(Joomla.JText._('greeting, some values are not acceptable.','Some values are unacceptable'));
return false; return false;
} }
} }
} }

View File

@ -1,33 +1,32 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage edit.php @subpackage edit.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidator');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive'); JHtml::_('behavior.keepalive');
$componentParams = $this->params; // will be removed just use $this->params instead $componentParams = $this->params; // will be removed just use $this->params instead
?> ?>
<script type="text/javascript"> <script type="text/javascript">
// waiting spinner // waiting spinner
var outerDiv = jQuery('body'); var outerDiv = jQuery('body');
@ -50,8 +49,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
jQuery('#loading').hide(); jQuery('#loading').hide();
}); });
</script> </script>
<div id="hello_world_loader" style="display: none;"> <div id="hello_world_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_hello_world&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data"> <form action="<?php echo JRoute::_('index.php?option=com_hello_world&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div class="form-horizontal"> <div class="form-horizontal">
@ -107,6 +106,6 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<input type="hidden" name="task" value="greeting.edit" /> <input type="hidden" name="task" value="greeting.edit" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</div> </div>
</div> </div>
</form> </form>
</div> </div>

View File

@ -1,92 +1,92 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/** /**
* Greeting View class * Greeting View class
*/ */
class Hello_worldViewGreeting extends JViewLegacy class Hello_worldViewGreeting extends JViewLegacy
{ {
/** /**
* display method of View * display method of View
* @return void * @return void
*/ */
public function display($tpl = null) public function display($tpl = null)
{ {
// set params // set params
$this->params = JComponentHelper::getParams('com_hello_world'); $this->params = JComponentHelper::getParams('com_hello_world');
// Assign the variables // Assign the variables
$this->form = $this->get('Form'); $this->form = $this->get('Form');
$this->item = $this->get('Item'); $this->item = $this->get('Item');
$this->script = $this->get('Script'); $this->script = $this->get('Script');
$this->state = $this->get('State'); $this->state = $this->get('State');
// get action permissions // get action permissions
$this->canDo = Hello_worldHelper::getActions('greeting', $this->item); $this->canDo = Hello_worldHelper::getActions('greeting', $this->item);
// get input // get input
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word'); $this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int'); $this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64'); $return = $jinput->get('return', null, 'base64');
// set the referral string // set the referral string
$this->referral = ''; $this->referral = '';
if ($this->refid && $this->ref) if ($this->refid && $this->ref)
{ {
// return to the item that referred to this item // return to the item that referred to this item
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
} }
elseif($this->ref) elseif($this->ref)
{ {
// return to the list view that referred to this item // return to the list view that referred to this item
$this->referral = '&ref=' . (string)$this->ref; $this->referral = '&ref=' . (string)$this->ref;
} }
// check return value // check return value
if (!is_null($return)) if (!is_null($return))
{ {
// add the return value // add the return value
$this->referral .= '&return=' . (string)$return; $this->referral .= '&return=' . (string)$return;
} }
// Set the toolbar // Set the toolbar
$this->addToolBar(); $this->addToolBar();
// Check for errors. // Check for errors.
if (count($errors = $this->get('Errors'))) if (count($errors = $this->get('Errors')))
{ {
throw new Exception(implode("\n", $errors), 500); throw new Exception(implode("\n", $errors), 500);
} }
// Display the template // Display the template
parent::display($tpl); parent::display($tpl);
// Set the document // Set the document
$this->setDocument(); $this->setDocument();
} }
/** /**
* Setting the toolbar * Setting the toolbar
*/ */
protected function addToolBar() protected function addToolBar()
{ {
JFactory::getApplication()->input->set('hidemainmenu', true); JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser(); $user = JFactory::getUser();
$userId = $user->id; $userId = $user->id;
@ -158,47 +158,47 @@ class Hello_worldViewGreeting extends JViewLegacy
} }
JToolbarHelper::divider(); JToolbarHelper::divider();
// set help url for this view if found // set help url for this view if found
$help_url = Hello_worldHelper::getHelpUrl('greeting'); $this->help_url = Hello_worldHelper::getHelpUrl('greeting');
if (Hello_worldHelper::checkString($help_url)) if (Hello_worldHelper::checkString($this->help_url))
{ {
JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $help_url); JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $this->help_url);
} }
} }
/** /**
* Escapes a value for output in a view script. * Escapes a value for output in a view script.
* *
* @param mixed $var The output to escape. * @param mixed $var The output to escape.
* *
* @return mixed The escaped value. * @return mixed The escaped value.
*/ */
public function escape($var) public function escape($var)
{ {
if(strlen($var) > 30) if(strlen($var) > 30)
{ {
// use the helper htmlEscape method instead and shorten the string // use the helper htmlEscape method instead and shorten the string
return Hello_worldHelper::htmlEscape($var, $this->_charset, true, 30); return Hello_worldHelper::htmlEscape($var, $this->_charset, true, 30);
} }
// use the helper htmlEscape method instead. // use the helper htmlEscape method instead.
return Hello_worldHelper::htmlEscape($var, $this->_charset); return Hello_worldHelper::htmlEscape($var, $this->_charset);
} }
/** /**
* Method to set up the document properties * Method to set up the document properties
* *
* @return void * @return void
*/ */
protected function setDocument() protected function setDocument()
{ {
$isNew = ($this->item->id < 1); $isNew = ($this->item->id < 1);
if (!isset($this->document)) if (!isset($this->document))
{ {
$this->document = JFactory::getDocument(); $this->document = JFactory::getDocument();
} }
$this->document->setTitle(JText::_($isNew ? 'COM_HELLO_WORLD_GREETING_NEW' : 'COM_HELLO_WORLD_GREETING_EDIT')); $this->document->setTitle(JText::_($isNew ? 'COM_HELLO_WORLD_GREETING_NEW' : 'COM_HELLO_WORLD_GREETING_EDIT'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_hello_world/assets/css/greeting.css", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); $this->document->addStyleSheet(JURI::root() . "administrator/components/com_hello_world/assets/css/greeting.css", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addScript(JURI::root() . $this->script, (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . $this->script, (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root() . "administrator/components/com_hello_world/views/greeting/submitbutton.js", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . "administrator/components/com_hello_world/views/greeting/submitbutton.js", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -1,37 +1,36 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default.php @subpackage default.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect'); JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init'); JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_HELLO_WORLD_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_HELLO_WORLD_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder) if ($this->saveOrder)
{ {
$saveOrderingUrl = 'index.php?option=com_hello_world&task=greetings.saveOrderAjax&tmpl=component'; $saveOrderingUrl = 'index.php?option=com_hello_world&task=greetings.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'greetingList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); JHtml::_('sortablelist.sortable', 'greetingList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
} }
?> ?>
<form action="<?php echo JRoute::_('index.php?option=com_hello_world&view=greetings'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_hello_world&view=greetings'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?> <?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2"> <div id="j-sidebar-container" class="span2">
@ -74,4 +73,4 @@ if ($this->saveOrder)
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>

View File

@ -1,27 +1,27 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default_batch_body.php @subpackage default_batch_body.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<p><?php echo JText::_('COM_HELLO_WORLD_GREETINGS_BATCH_TIP'); ?></p> <p><?php echo JText::_('COM_HELLO_WORLD_GREETINGS_BATCH_TIP'); ?></p>
<?php echo $this->batchDisplay; ?> <?php echo $this->batchDisplay; ?>

View File

@ -1,32 +1,32 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default_batch_footer.php @subpackage default_batch_footer.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<!-- clear the batch values if cancel --> <!-- clear the batch values if cancel -->
<button class="btn" type="button" onclick="" data-dismiss="modal"> <button class="btn" type="button" onclick="" data-dismiss="modal">
<?php echo JText::_('JCANCEL'); ?> <?php echo JText::_('JCANCEL'); ?>
</button> </button>
<!-- post the batch values if process --> <!-- post the batch values if process -->
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('greeting.batch');"> <button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('greeting.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?> <?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button> </button>

View File

@ -1,29 +1,29 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default_body.php @subpackage default_body.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_hello_world&view=greetings&task=greeting.edit"; $edit = "index.php?option=com_hello_world&view=greetings&task=greeting.edit";
?> ?>
<?php foreach ($this->items as $i => $item): ?> <?php foreach ($this->items as $i => $item): ?>
<?php <?php
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;

View File

@ -1,27 +1,27 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default_foot.php @subpackage default_foot.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<tr> <tr>
<td colspan="5"><?php echo $this->pagination->getListFooter(); ?></td> <td colspan="5"><?php echo $this->pagination->getListFooter(); ?></td>
</tr> </tr>

View File

@ -1,27 +1,27 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default_head.php @subpackage default_head.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<tr> <tr>
<?php if ($this->canEdit&& $this->canState): ?> <?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone"> <th width="1%" class="nowrap center hidden-phone">

View File

@ -1,54 +1,54 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default_toolbar.php @subpackage default_toolbar.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<div id="filter-bar" class="btn-toolbar"> <div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left"> <div class="filter-search btn-group pull-left">
<label for="filter_search" class="element-invisible"><?php echo JText::_('Search');?></label> <label for="filter_search" class="element-invisible"><?php echo JText::_('Search');?></label>
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('Search Greetings'); ?>" /> <input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('Search Greetings'); ?>" />
</div> </div>
<div class="btn-group pull-left"> <div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button> <button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button> <button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div> </div>
<div class="btn-group pull-right hidden-phone"> <div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label> <label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
<?php echo $this->pagination->getLimitBox(); ?> <?php echo $this->pagination->getLimitBox(); ?>
</div> </div>
<div class="btn-group pull-right hidden-phone"> <div class="btn-group pull-right hidden-phone">
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label> <label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()"> <select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option> <option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option> <option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option> <option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
</select> </select>
</div> </div>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label> <label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()"> <select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option> <option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
<?php echo JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?> <?php echo JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
</select> </select>
</div> </div>
</div> </div>
<div class="clearfix"> </div> <div class="clearfix"> </div>

View File

@ -1,47 +1,47 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/** /**
* Hello_world View class for the Greetings * Hello_world View class for the Greetings
*/ */
class Hello_worldViewGreetings extends JViewLegacy class Hello_worldViewGreetings extends JViewLegacy
{ {
/** /**
* Greetings view display method * Greetings view display method
* @return void * @return void
*/ */
function display($tpl = null) function display($tpl = null)
{ {
if ($this->getLayout() !== 'modal') if ($this->getLayout() !== 'modal')
{ {
// Include helper submenu // Include helper submenu
Hello_worldHelper::addSubmenu('greetings'); Hello_worldHelper::addSubmenu('greetings');
} }
// Assign data to the view // Assign data to the view
$this->items = $this->get('Items'); $this->items = $this->get('Items');
$this->pagination = $this->get('Pagination'); $this->pagination = $this->get('Pagination');
$this->state = $this->get('State'); $this->state = $this->get('State');
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Load the filter form from xml. // Load the filter form from xml.
$this->filterForm = $this->get('FilterForm'); $this->filterForm = $this->get('FilterForm');
@ -49,122 +49,122 @@ class Hello_worldViewGreetings extends JViewLegacy
$this->activeFilters = $this->get('ActiveFilters'); $this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause. // Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering'; $this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value // set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance())); $this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions // get global action permissions
$this->canDo = Hello_worldHelper::getActions('greeting'); $this->canDo = Hello_worldHelper::getActions('greeting');
$this->canEdit = $this->canDo->get('core.edit'); $this->canEdit = $this->canDo->get('core.edit');
$this->canState = $this->canDo->get('core.edit.state'); $this->canState = $this->canDo->get('core.edit.state');
$this->canCreate = $this->canDo->get('core.create'); $this->canCreate = $this->canDo->get('core.create');
$this->canDelete = $this->canDo->get('core.delete'); $this->canDelete = $this->canDo->get('core.delete');
$this->canBatch = $this->canDo->get('core.batch'); $this->canBatch = $this->canDo->get('core.batch');
// We don't need toolbar in the modal window. // We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal') if ($this->getLayout() !== 'modal')
{ {
$this->addToolbar(); $this->addToolbar();
$this->sidebar = JHtmlSidebar::render(); $this->sidebar = JHtmlSidebar::render();
// load the batch html // load the batch html
if ($this->canCreate && $this->canEdit && $this->canState) if ($this->canCreate && $this->canEdit && $this->canState)
{ {
$this->batchDisplay = JHtmlBatch_::render(); $this->batchDisplay = JHtmlBatch_::render();
} }
} }
// Check for errors. // Check for errors.
if (count($errors = $this->get('Errors'))) if (count($errors = $this->get('Errors')))
{ {
throw new Exception(implode("\n", $errors), 500); throw new Exception(implode("\n", $errors), 500);
} }
// Display the template // Display the template
parent::display($tpl); parent::display($tpl);
// Set the document // Set the document
$this->setDocument(); $this->setDocument();
} }
/** /**
* Setting the toolbar * Setting the toolbar
*/ */
protected function addToolBar() protected function addToolBar()
{ {
JToolBarHelper::title(JText::_('COM_HELLO_WORLD_GREETINGS'), 'joomla'); JToolBarHelper::title(JText::_('COM_HELLO_WORLD_GREETINGS'), 'joomla');
JHtmlSidebar::setAction('index.php?option=com_hello_world&view=greetings'); JHtmlSidebar::setAction('index.php?option=com_hello_world&view=greetings');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate) if ($this->canCreate)
{ {
JToolBarHelper::addNew('greeting.add'); JToolBarHelper::addNew('greeting.add');
} }
// Only load if there are items // Only load if there are items
if (Hello_worldHelper::checkArray($this->items)) if (Hello_worldHelper::checkArray($this->items))
{ {
if ($this->canEdit) if ($this->canEdit)
{ {
JToolBarHelper::editList('greeting.edit'); JToolBarHelper::editList('greeting.edit');
} }
if ($this->canState) if ($this->canState)
{ {
JToolBarHelper::publishList('greetings.publish'); JToolBarHelper::publishList('greetings.publish');
JToolBarHelper::unpublishList('greetings.unpublish'); JToolBarHelper::unpublishList('greetings.unpublish');
JToolBarHelper::archiveList('greetings.archive'); JToolBarHelper::archiveList('greetings.archive');
if ($this->canDo->get('core.admin')) if ($this->canDo->get('core.admin'))
{ {
JToolBarHelper::checkin('greetings.checkin'); JToolBarHelper::checkin('greetings.checkin');
} }
} }
// Add a batch button // Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
{ {
// Get the toolbar object instance // Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar'); $bar = JToolBar::getInstance('toolbar');
// set the batch button name // set the batch button name
$title = JText::_('JTOOLBAR_BATCH'); $title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button // Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch'); $layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page // add the button to the page
$dhtml = $layout->render(array('title' => $title)); $dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch'); $bar->appendButton('Custom', $dhtml, 'batch');
} }
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{ {
JToolbarHelper::deleteList('', 'greetings.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolbarHelper::deleteList('', 'greetings.delete', 'JTOOLBAR_EMPTY_TRASH');
} }
elseif ($this->canState && $this->canDelete) elseif ($this->canState && $this->canDelete)
{ {
JToolbarHelper::trash('greetings.trash'); JToolbarHelper::trash('greetings.trash');
} }
if ($this->canDo->get('core.export') && $this->canDo->get('greeting.export')) if ($this->canDo->get('core.export') && $this->canDo->get('greeting.export'))
{ {
JToolBarHelper::custom('greetings.exportData', 'download', '', 'COM_HELLO_WORLD_EXPORT_DATA', true); JToolBarHelper::custom('greetings.exportData', 'download', '', 'COM_HELLO_WORLD_EXPORT_DATA', true);
} }
} }
if ($this->canDo->get('core.import') && $this->canDo->get('greeting.import')) if ($this->canDo->get('core.import') && $this->canDo->get('greeting.import'))
{ {
JToolBarHelper::custom('greetings.importData', 'upload', '', 'COM_HELLO_WORLD_IMPORT_DATA', false); JToolBarHelper::custom('greetings.importData', 'upload', '', 'COM_HELLO_WORLD_IMPORT_DATA', false);
} }
// set help url for this view if found // set help url for this view if found
$help_url = Hello_worldHelper::getHelpUrl('greetings'); $this->help_url = Hello_worldHelper::getHelpUrl('greetings');
if (Hello_worldHelper::checkString($help_url)) if (Hello_worldHelper::checkString($this->help_url))
{ {
JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $help_url); JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $this->help_url);
} }
// add the options comp button // add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{ {
JToolBarHelper::preferences('com_hello_world'); JToolBarHelper::preferences('com_hello_world');
} }
// Only load published batch if state and batch is allowed // Only load published batch if state and batch is allowed
@ -185,54 +185,54 @@ class Hello_worldViewGreetings extends JViewLegacy
'batch[access]', 'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
); );
} }
} }
/** /**
* Method to set up the document properties * Method to set up the document properties
* *
* @return void * @return void
*/ */
protected function setDocument() protected function setDocument()
{ {
if (!isset($this->document)) if (!isset($this->document))
{ {
$this->document = JFactory::getDocument(); $this->document = JFactory::getDocument();
} }
$this->document->setTitle(JText::_('COM_HELLO_WORLD_GREETINGS')); $this->document->setTitle(JText::_('COM_HELLO_WORLD_GREETINGS'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_hello_world/assets/css/greetings.css", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); $this->document->addStyleSheet(JURI::root() . "administrator/components/com_hello_world/assets/css/greetings.css", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
} }
/** /**
* Escapes a value for output in a view script. * Escapes a value for output in a view script.
* *
* @param mixed $var The output to escape. * @param mixed $var The output to escape.
* *
* @return mixed The escaped value. * @return mixed The escaped value.
*/ */
public function escape($var) public function escape($var)
{ {
if(strlen($var) > 50) if(strlen($var) > 50)
{ {
// use the helper htmlEscape method instead and shorten the string // use the helper htmlEscape method instead and shorten the string
return Hello_worldHelper::htmlEscape($var, $this->_charset, true); return Hello_worldHelper::htmlEscape($var, $this->_charset, true);
} }
// use the helper htmlEscape method instead. // use the helper htmlEscape method instead.
return Hello_worldHelper::htmlEscape($var, $this->_charset); return Hello_worldHelper::htmlEscape($var, $this->_charset);
} }
/** /**
* Returns an array of fields the table can be sorted by * Returns an array of fields the table can be sorted by
* *
* @return array Array containing the field name to sort by as the key and display text as value * @return array Array containing the field name to sort by as the key and display text as value
*/ */
protected function getSortFields() protected function getSortFields()
{ {
return array( return array(
'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'), 'a.published' => JText::_('JSTATUS'),
'a.greeting' => JText::_('COM_HELLO_WORLD_GREETING_GREETING_LABEL'), 'a.greeting' => JText::_('COM_HELLO_WORLD_GREETING_GREETING_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID') 'a.id' => JText::_('JGRID_HEADING_ID')
); );
} }
} }

View File

@ -1,28 +1,28 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default.php @subpackage default.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
?> ?>
<div id="j-main-container"> <div id="j-main-container">
<div class="span9"> <div class="span9">

View File

@ -1,39 +1,39 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default_main.php @subpackage default_main.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<?php if(isset($this->icons['main']) && is_array($this->icons['main'])) :?> <?php if(isset($this->icons['main']) && is_array($this->icons['main'])) :?>
<?php foreach($this->icons['main'] as $icon): ?> <?php foreach($this->icons['main'] as $icon): ?>
<div class="dashboard-wraper"> <div class="dashboard-wraper">
<div class="dashboard-content"> <div class="dashboard-content">
<a class="icon" href="<?php echo $icon->url; ?>"> <a class="icon" href="<?php echo $icon->url; ?>">
<img alt="<?php echo $icon->alt; ?>" src="components/com_hello_world/assets/images/icons/<?php echo $icon->image; ?>"> <img alt="<?php echo $icon->alt; ?>" src="components/com_hello_world/assets/images/icons/<?php echo $icon->image; ?>">
<span class="dashboard-title"><?php echo JText::_($icon->name); ?></span> <span class="dashboard-title"><?php echo JText::_($icon->name); ?></span>
</a> </a>
</div> </div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<div class="clearfix"></div> <div class="clearfix"></div>
<?php else: ?> <?php else: ?>
<div class="alert alert-error"><h4 class="alert-heading"><?php echo JText::_("Permission denied, or not correctly set"); ?></h4><div class="alert-message"><?php echo JText::_("Please notify your System Administrator if result is unexpected."); ?></div></div> <div class="alert alert-error"><h4 class="alert-heading"><?php echo JText::_("Permission denied, or not correctly set"); ?></h4><div class="alert-message"><?php echo JText::_("Please notify your System Administrator if result is unexpected."); ?></div></div>
<?php endif; ?> <?php endif; ?>

View File

@ -1,47 +1,47 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default_vdm.php @subpackage default_vdm.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<img alt="<?php echo JText::_('COM_HELLO_WORLD'); ?>" src="components/com_hello_world/assets/images/vdm-component.jpg"> <img alt="<?php echo JText::_('COM_HELLO_WORLD'); ?>" src="components/com_hello_world/assets/images/vdm-component.jpg">
<ul class="list-striped"> <ul class="list-striped">
<li><b><?php echo JText::_('COM_HELLO_WORLD_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice"></span></li> <li><b><?php echo JText::_('COM_HELLO_WORLD_VERSION'); ?>:</b> <?php echo $this->manifest->version; ?>&nbsp;&nbsp;<span class="update-notice"></span></li>
<li><b><?php echo JText::_('COM_HELLO_WORLD_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li> <li><b><?php echo JText::_('COM_HELLO_WORLD_DATE'); ?>:</b> <?php echo $this->manifest->creationDate; ?></li>
<li><b><?php echo JText::_('COM_HELLO_WORLD_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li> <li><b><?php echo JText::_('COM_HELLO_WORLD_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $this->manifest->authorEmail; ?>"><?php echo $this->manifest->author; ?></a></li>
<li><b><?php echo JText::_('COM_HELLO_WORLD_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li> <li><b><?php echo JText::_('COM_HELLO_WORLD_WEBSITE'); ?>:</b> <a href="<?php echo $this->manifest->authorUrl; ?>" target="_blank"><?php echo $this->manifest->authorUrl; ?></a></li>
<li><b><?php echo JText::_('COM_HELLO_WORLD_LICENSE'); ?>:</b> <?php echo $this->manifest->license; ?></li> <li><b><?php echo JText::_('COM_HELLO_WORLD_LICENSE'); ?>:</b> <?php echo $this->manifest->license; ?></li>
<li><b><?php echo $this->manifest->copyright; ?></b></li> <li><b><?php echo $this->manifest->copyright; ?></b></li>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
<?php if(Hello_worldHelper::checkArray($this->contributors)): ?> <?php if(Hello_worldHelper::checkArray($this->contributors)): ?>
<?php if(count($this->contributors) > 1): ?> <?php if(count($this->contributors) > 1): ?>
<h3><?php echo JText::_('COM_HELLO_WORLD_CONTRIBUTORS'); ?></h3> <h3><?php echo JText::_('COM_HELLO_WORLD_CONTRIBUTORS'); ?></h3>
<?php else: ?> <?php else: ?>
<h3><?php echo JText::_('COM_HELLO_WORLD_CONTRIBUTOR'); ?></h3> <h3><?php echo JText::_('COM_HELLO_WORLD_CONTRIBUTOR'); ?></h3>
<?php endif; ?> <?php endif; ?>
<ul class="list-striped"> <ul class="list-striped">
<?php foreach($this->contributors as $contributor): ?> <?php foreach($this->contributors as $contributor): ?>
<li><b><?php echo $contributor['title']; ?>:</b> <?php echo $contributor['name']; ?></li> <li><b><?php echo $contributor['title']; ?>:</b> <?php echo $contributor['name']; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
<?php endif; ?> <?php endif; ?>

View File

@ -1,97 +1,99 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/**
* Hello_world View class
*/ /**
class Hello_worldViewHello_world extends JViewLegacy * Hello_world View class
{ */
/** class Hello_worldViewHello_world extends JViewLegacy
* View display method {
* @return void /**
*/ * View display method
function display($tpl = null) * @return void
{ */
// Assign data to the view function display($tpl = null)
$this->icons = $this->get('Icons'); {
$this->contributors = Hello_worldHelper::getContributors(); // Assign data to the view
$this->icons = $this->get('Icons');
// get the manifest details of the component $this->contributors = Hello_worldHelper::getContributors();
$this->manifest = Hello_worldHelper::manifest();
// get the manifest details of the component
// Set the toolbar $this->manifest = Hello_worldHelper::manifest();
$this->addToolBar();
// Set the toolbar
// Check for errors. $this->addToolBar();
if (count($errors = $this->get('Errors')))
{ // Check for errors.
throw new Exception(implode("\n", $errors), 500); if (count($errors = $this->get('Errors')))
} {
throw new Exception(implode("\n", $errors), 500);
// Display the template }
parent::display($tpl);
// Display the template
// Set the document parent::display($tpl);
$this->setDocument();
} // Set the document
$this->setDocument();
/** }
* Setting the toolbar
*/ /**
protected function addToolBar() * Setting the toolbar
{ */
$canDo = Hello_worldHelper::getActions('hello_world'); protected function addToolBar()
JToolBarHelper::title(JText::_('COM_HELLO_WORLD_DASHBOARD'), 'grid-2'); {
$canDo = Hello_worldHelper::getActions('hello_world');
// set help url for this view if found JToolBarHelper::title(JText::_('COM_HELLO_WORLD_DASHBOARD'), 'grid-2');
$help_url = Hello_worldHelper::getHelpUrl('hello_world');
if (Hello_worldHelper::checkString($help_url)) // set help url for this view if found
{ $this->help_url = Hello_worldHelper::getHelpUrl('hello_world');
JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $help_url); if (Hello_worldHelper::checkString($this->help_url))
} {
JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $this->help_url);
if ($canDo->get('core.admin') || $canDo->get('core.options')) }
{
JToolBarHelper::preferences('com_hello_world'); if ($canDo->get('core.admin') || $canDo->get('core.options'))
} {
} JToolBarHelper::preferences('com_hello_world');
}
/** }
* Method to set up the document properties
* /**
* @return void * Method to set up the document properties
*/ *
protected function setDocument() * @return void
{ */
$document = JFactory::getDocument(); protected function setDocument()
{
// add dashboard style sheets $document = JFactory::getDocument();
$document->addStyleSheet(JURI::root() . "administrator/components/com_hello_world/assets/css/dashboard.css");
// add dashboard style sheets
// set page title $document->addStyleSheet(JURI::root() . "administrator/components/com_hello_world/assets/css/dashboard.css");
$document->setTitle(JText::_('COM_HELLO_WORLD_DASHBOARD'));
// set page title
// add manifest to page JavaScript $document->setTitle(JText::_('COM_HELLO_WORLD_DASHBOARD'));
$document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript");
} // add manifest to page JavaScript
} $document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript");
}
}

View File

@ -1,226 +1,226 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default.php @subpackage default.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::_('jquery.framework'); JHtml::_('jquery.framework');
JHtml::_('bootstrap.tooltip'); JHtml::_('bootstrap.tooltip');
JHtml::_('script', 'system/core.js', false, true); JHtml::_('script', 'system/core.js', false, true);
JHtml::_('behavior.keepalive'); JHtml::_('behavior.keepalive');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
<?php if ($this->hasPackage && Hello_worldHelper::checkArray($this->headerList)) : ?> <?php if ($this->hasPackage && Hello_worldHelper::checkArray($this->headerList)) : ?>
Joomla.continueImport = function() Joomla.continueImport = function()
{ {
var form = document.getElementById('adminForm'); var form = document.getElementById('adminForm');
var error = false; var error = false;
var therequired = [<?php $i = 0; foreach($this->headerList as $name => $title) { echo ($i != 0)? ', "vdm_'.$name.'"':'"vdm_'.$name.'"'; $i++; } ?>]; var therequired = [<?php $i = 0; foreach($this->headerList as $name => $title) { echo ($i != 0)? ', "vdm_'.$name.'"':'"vdm_'.$name.'"'; $i++; } ?>];
for(i = 0; i < therequired.length; i++) for(i = 0; i < therequired.length; i++)
{ {
if(jQuery('#'+therequired[i]).val() == "" ) if(jQuery('#'+therequired[i]).val() == "" )
{ {
error = true; error = true;
break; break;
} }
} }
// do field validation // do field validation
if (error) if (error)
{ {
alert("<?php echo JText::_('COM_HELLO_WORLD_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS', true); ?>"); alert("<?php echo JText::_('COM_HELLO_WORLD_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS', true); ?>");
} }
else else
{ {
jQuery('#loading').css('display', 'block'); jQuery('#loading').css('display', 'block');
form.gettype.value = 'continue'; form.gettype.value = 'continue';
form.submit(); form.submit();
} }
}; };
<?php else: ?> <?php else: ?>
Joomla.submitbutton = function() Joomla.submitbutton = function()
{ {
var form = document.getElementById('adminForm'); var form = document.getElementById('adminForm');
// do field validation // do field validation
if (form.import_package.value == "") if (form.import_package.value == "")
{ {
alert("<?php echo JText::_('COM_HELLO_WORLD_IMPORT_MSG_PLEASE_SELECT_A_FILE', true); ?>"); alert("<?php echo JText::_('COM_HELLO_WORLD_IMPORT_MSG_PLEASE_SELECT_A_FILE', true); ?>");
} }
else else
{ {
jQuery('#loading').css('display', 'block'); jQuery('#loading').css('display', 'block');
form.gettype.value = 'upload'; form.gettype.value = 'upload';
form.submit(); form.submit();
} }
}; };
Joomla.submitbutton3 = function() Joomla.submitbutton3 = function()
{ {
var form = document.getElementById('adminForm'); var form = document.getElementById('adminForm');
// do field validation // do field validation
if (form.import_directory.value == ""){ if (form.import_directory.value == ""){
alert("<?php echo JText::_('COM_HELLO_WORLD_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY', true); ?>"); alert("<?php echo JText::_('COM_HELLO_WORLD_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY', true); ?>");
} }
else else
{ {
jQuery('#loading').css('display', 'block'); jQuery('#loading').css('display', 'block');
form.gettype.value = 'folder'; form.gettype.value = 'folder';
form.submit(); form.submit();
} }
}; };
Joomla.submitbutton4 = function() Joomla.submitbutton4 = function()
{ {
var form = document.getElementById('adminForm'); var form = document.getElementById('adminForm');
// do field validation // do field validation
if (form.import_url.value == "" || form.import_url.value == "http://") if (form.import_url.value == "" || form.import_url.value == "http://")
{ {
alert("<?php echo JText::_('COM_HELLO_WORLD_IMPORT_MSG_ENTER_A_URL', true); ?>"); alert("<?php echo JText::_('COM_HELLO_WORLD_IMPORT_MSG_ENTER_A_URL', true); ?>");
} }
else else
{ {
jQuery('#loading').css('display', 'block'); jQuery('#loading').css('display', 'block');
form.gettype.value = 'url'; form.gettype.value = 'url';
form.submit(); form.submit();
} }
}; };
<?php endif; ?> <?php endif; ?>
// Add spindle-wheel for importations: // Add spindle-wheel for importations:
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
var outerDiv = $('body'); var outerDiv = $('body');
$('<div id="loading"></div>') $('<div id="loading"></div>')
.css("background", "rgba(255, 255, 255, .8) url('components/com_hello_world/assets/images/import.gif') 50% 15% no-repeat") .css("background", "rgba(255, 255, 255, .8) url('components/com_hello_world/assets/images/import.gif') 50% 15% no-repeat")
.css("top", outerDiv.position().top - $(window).scrollTop()) .css("top", outerDiv.position().top - $(window).scrollTop())
.css("left", outerDiv.position().left - $(window).scrollLeft()) .css("left", outerDiv.position().left - $(window).scrollLeft())
.css("width", outerDiv.width()) .css("width", outerDiv.width())
.css("height", outerDiv.height()) .css("height", outerDiv.height())
.css("position", "fixed") .css("position", "fixed")
.css("opacity", "0.80") .css("opacity", "0.80")
.css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)") .css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)")
.css("filter", "alpha(opacity = 80)") .css("filter", "alpha(opacity = 80)")
.css("display", "none") .css("display", "none")
.appendTo(outerDiv); .appendTo(outerDiv);
}); });
</script> </script>
<div id="installer-import" class="clearfix"> <div id="installer-import" class="clearfix">
<form enctype="multipart/form-data" action="<?php echo JRoute::_('index.php?option=com_hello_world&view=import');?>" method="post" name="adminForm" id="adminForm" class="form-horizontal form-validate"> <form enctype="multipart/form-data" action="<?php echo JRoute::_('index.php?option=com_hello_world&view=import');?>" method="post" name="adminForm" id="adminForm" class="form-horizontal form-validate">
<?php if (!empty( $this->sidebar)) : ?> <?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2"> <div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?> <?php echo $this->sidebar; ?>
</div> </div>
<div id="j-main-container" class="span10"> <div id="j-main-container" class="span10">
<?php else : ?> <?php else : ?>
<div id="j-main-container"> <div id="j-main-container">
<?php endif;?> <?php endif;?>
<?php if ($this->hasPackage && Hello_worldHelper::checkArray($this->headerList) && Hello_worldHelper::checkArray($this->headers)) : ?> <?php if ($this->hasPackage && Hello_worldHelper::checkArray($this->headerList) && Hello_worldHelper::checkArray($this->headers)) : ?>
<fieldset class="uploadform"> <fieldset class="uploadform">
<legend><?php echo JText::_('COM_HELLO_WORLD_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'); ?></legend> <legend><?php echo JText::_('COM_HELLO_WORLD_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'); ?></legend>
<div class="control-group"> <div class="control-group">
<label class="control-label" ><h4><?php echo JText::_('COM_HELLO_WORLD_IMPORT_TABLE_COLUMNS'); ?></h4></label> <label class="control-label" ><h4><?php echo JText::_('COM_HELLO_WORLD_IMPORT_TABLE_COLUMNS'); ?></h4></label>
<div class="controls"> <div class="controls">
<label class="control-label" ><h4><?php echo JText::_('COM_HELLO_WORLD_IMPORT_FILE_COLUMNS'); ?></h4></label> <label class="control-label" ><h4><?php echo JText::_('COM_HELLO_WORLD_IMPORT_FILE_COLUMNS'); ?></h4></label>
</div> </div>
</div> </div>
<?php foreach($this->headerList as $name => $title): ?> <?php foreach($this->headerList as $name => $title): ?>
<div class="control-group"> <div class="control-group">
<label for="<?php echo $name; ?>" class="control-label" ><?php echo $title; ?></label> <label for="<?php echo $name; ?>" class="control-label" ><?php echo $title; ?></label>
<div class="controls"> <div class="controls">
<select name="<?php echo $name; ?>" id="vdm_<?php echo $name; ?>" required class="required input_box" > <select name="<?php echo $name; ?>" id="vdm_<?php echo $name; ?>" required class="required input_box" >
<option value=""><?php echo JText::_('COM_HELLO_WORLD_IMPORT_PLEASE_SELECT_COLUMN'); ?></option> <option value=""><?php echo JText::_('COM_HELLO_WORLD_IMPORT_PLEASE_SELECT_COLUMN'); ?></option>
<option value="IGNORE"><?php echo JText::_('COM_HELLO_WORLD_IMPORT_IGNORE_COLUMN'); ?></option> <option value="IGNORE"><?php echo JText::_('COM_HELLO_WORLD_IMPORT_IGNORE_COLUMN'); ?></option>
<?php foreach($this->headers as $value => $option): ?> <?php foreach($this->headers as $value => $option): ?>
<?php $selected = (strtolower($option) == strtolower ($title) || strtolower($option) == strtolower($name))? 'selected="selected"':''; ?> <?php $selected = (strtolower($option) == strtolower ($title) || strtolower($option) == strtolower($name))? 'selected="selected"':''; ?>
<option value="<?php echo Hello_worldHelper::htmlEscape($value); ?>" class="required" <?php echo $selected ?>><?php echo Hello_worldHelper::htmlEscape($option); ?></option> <option value="<?php echo Hello_worldHelper::htmlEscape($value); ?>" class="required" <?php echo $selected ?>><?php echo Hello_worldHelper::htmlEscape($option); ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<div class="form-actions"> <div class="form-actions">
<input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_HELLO_WORLD_IMPORT_CONTINUE'); ?>" onclick="Joomla.continueImport()" /> <input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_HELLO_WORLD_IMPORT_CONTINUE'); ?>" onclick="Joomla.continueImport()" />
</div> </div>
</fieldset> </fieldset>
<input type="hidden" name="gettype" value="continue" /> <input type="hidden" name="gettype" value="continue" />
<?php else: ?> <?php else: ?>
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'upload')); ?> <?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'upload')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'upload', JText::_('COM_HELLO_WORLD_IMPORT_FROM_UPLOAD', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'upload', JText::_('COM_HELLO_WORLD_IMPORT_FROM_UPLOAD', true)); ?>
<fieldset class="uploadform"> <fieldset class="uploadform">
<legend><?php echo JText::_('COM_HELLO_WORLD_IMPORT_UPDATE_DATA'); ?></legend> <legend><?php echo JText::_('COM_HELLO_WORLD_IMPORT_UPDATE_DATA'); ?></legend>
<div class="control-group"> <div class="control-group">
<label for="import_package" class="control-label"><?php echo JText::_('COM_HELLO_WORLD_IMPORT_SELECT_FILE'); ?></label> <label for="import_package" class="control-label"><?php echo JText::_('COM_HELLO_WORLD_IMPORT_SELECT_FILE'); ?></label>
<div class="controls"> <div class="controls">
<input class="input_box" id="import_package" name="import_package" type="file" size="57" /> <input class="input_box" id="import_package" name="import_package" type="file" size="57" />
</div> </div>
</div> </div>
<div class="form-actions"> <div class="form-actions">
<input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_HELLO_WORLD_IMPORT_UPLOAD_BOTTON'); ?>" onclick="Joomla.submitbutton()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_HELLO_WORLD_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small> <input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_HELLO_WORLD_IMPORT_UPLOAD_BOTTON'); ?>" onclick="Joomla.submitbutton()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_HELLO_WORLD_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
</div> </div>
</fieldset> </fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'directory', JText::_('COM_HELLO_WORLD_IMPORT_FROM_DIRECTORY', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'directory', JText::_('COM_HELLO_WORLD_IMPORT_FROM_DIRECTORY', true)); ?>
<fieldset class="uploadform"> <fieldset class="uploadform">
<legend><?php echo JText::_('COM_HELLO_WORLD_IMPORT_UPDATE_DATA'); ?></legend> <legend><?php echo JText::_('COM_HELLO_WORLD_IMPORT_UPDATE_DATA'); ?></legend>
<div class="control-group"> <div class="control-group">
<label for="import_directory" class="control-label"><?php echo JText::_('COM_HELLO_WORLD_IMPORT_SELECT_FILE_DIRECTORY'); ?></label> <label for="import_directory" class="control-label"><?php echo JText::_('COM_HELLO_WORLD_IMPORT_SELECT_FILE_DIRECTORY'); ?></label>
<div class="controls"> <div class="controls">
<input type="text" id="import_directory" name="import_directory" class="span5 input_box" size="70" value="<?php echo $this->state->get('import.directory'); ?>" /> <input type="text" id="import_directory" name="import_directory" class="span5 input_box" size="70" value="<?php echo $this->state->get('import.directory'); ?>" />
</div> </div>
</div> </div>
<div class="form-actions"> <div class="form-actions">
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_HELLO_WORLD_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton3()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_HELLO_WORLD_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small> <input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_HELLO_WORLD_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton3()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_HELLO_WORLD_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
</div> </div>
</fieldset> </fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'url', JText::_('COM_HELLO_WORLD_IMPORT_FROM_URL', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'url', JText::_('COM_HELLO_WORLD_IMPORT_FROM_URL', true)); ?>
<fieldset class="uploadform"> <fieldset class="uploadform">
<legend><?php echo JText::_('COM_HELLO_WORLD_IMPORT_UPDATE_DATA'); ?></legend> <legend><?php echo JText::_('COM_HELLO_WORLD_IMPORT_UPDATE_DATA'); ?></legend>
<div class="control-group"> <div class="control-group">
<label for="import_url" class="control-label"><?php echo JText::_('COM_HELLO_WORLD_IMPORT_SELECT_FILE_URL'); ?></label> <label for="import_url" class="control-label"><?php echo JText::_('COM_HELLO_WORLD_IMPORT_SELECT_FILE_URL'); ?></label>
<div class="controls"> <div class="controls">
<input type="text" id="import_url" name="import_url" class="span5 input_box" size="70" value="http://" /> <input type="text" id="import_url" name="import_url" class="span5 input_box" size="70" value="http://" />
</div> </div>
</div> </div>
<div class="form-actions"> <div class="form-actions">
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_HELLO_WORLD_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton4()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_HELLO_WORLD_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small> <input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_HELLO_WORLD_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton4()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_HELLO_WORLD_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
</div> </div>
</fieldset> </fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?> <?php echo JHtml::_('bootstrap.endTabSet'); ?>
<input type="hidden" name="gettype" value="upload" /> <input type="hidden" name="gettype" value="upload" />
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value="import.import" /> <input type="hidden" name="task" value="import.import" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>
</div> </div>

View File

@ -1,102 +1,102 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/** /**
* Hello_world Import View * Hello_world Import View
*/ */
class Hello_worldViewImport extends JViewLegacy class Hello_worldViewImport extends JViewLegacy
{ {
protected $headerList; protected $headerList;
protected $hasPackage = false; protected $hasPackage = false;
protected $headers; protected $headers;
protected $hasHeader = 0; protected $hasHeader = 0;
protected $dataType; protected $dataType;
public function display($tpl = null) public function display($tpl = null)
{ {
if ($this->getLayout() !== 'modal') if ($this->getLayout() !== 'modal')
{ {
// Include helper submenu // Include helper submenu
Hello_worldHelper::addSubmenu('import'); Hello_worldHelper::addSubmenu('import');
} }
$paths = new stdClass; $paths = new stdClass;
$paths->first = ''; $paths->first = '';
$state = $this->get('state'); $state = $this->get('state');
$this->paths = &$paths; $this->paths = &$paths;
$this->state = &$state; $this->state = &$state;
// get global action permissions // get global action permissions
$this->canDo = Hello_worldHelper::getActions('import'); $this->canDo = Hello_worldHelper::getActions('import');
// We don't need toolbar in the modal window. // We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal') if ($this->getLayout() !== 'modal')
{ {
$this->addToolbar(); $this->addToolbar();
$this->sidebar = JHtmlSidebar::render(); $this->sidebar = JHtmlSidebar::render();
} }
// get the session object // get the session object
$session = JFactory::getSession(); $session = JFactory::getSession();
// check if it has package // check if it has package
$this->hasPackage = $session->get('hasPackage', false); $this->hasPackage = $session->get('hasPackage', false);
$this->dataType = $session->get('dataType', false); $this->dataType = $session->get('dataType', false);
if($this->hasPackage && $this->dataType) if($this->hasPackage && $this->dataType)
{ {
$this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true);
$this->headers = Hello_worldHelper::getFileHeaders($this->dataType); $this->headers = Hello_worldHelper::getFileHeaders($this->dataType);
// clear the data type // clear the data type
$session->clear('dataType'); $session->clear('dataType');
} }
// Check for errors. // Check for errors.
if (count($errors = $this->get('Errors'))) if (count($errors = $this->get('Errors')))
{ {
throw new Exception(implode("\n", $errors), 500); throw new Exception(implode("\n", $errors), 500);
} }
// Display the template // Display the template
parent::display($tpl); parent::display($tpl);
} }
/** /**
* Setting the toolbar * Setting the toolbar
*/ */
protected function addToolBar() protected function addToolBar()
{ {
JToolBarHelper::title(JText::_('COM_HELLO_WORLD_IMPORT_TITLE'), 'upload'); JToolBarHelper::title(JText::_('COM_HELLO_WORLD_IMPORT_TITLE'), 'upload');
JHtmlSidebar::setAction('index.php?option=com_hello_world&view=import'); JHtmlSidebar::setAction('index.php?option=com_hello_world&view=import');
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{ {
JToolBarHelper::preferences('com_hello_world'); JToolBarHelper::preferences('com_hello_world');
} }
// set help url for this view if found // set help url for this view if found
$help_url = Hello_worldHelper::getHelpUrl('import'); $this->help_url = Hello_worldHelper::getHelpUrl('import');
if (Hello_worldHelper::checkString($help_url)) if (Hello_worldHelper::checkString($this->help_url))
{ {
JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $help_url); JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $this->help_url);
} }
} }
} }

View File

@ -1,102 +1,102 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="4" method="upgrade">
<name>COM_HELLO_WORLD</name> <name>COM_HELLO_WORLD</name>
<creationDate>4th January, 2021</creationDate> <creationDate>3rd March, 2022</creationDate>
<author>Llewellyn</author> <author>Llewellyn</author>
<authorEmail>joomla@vdm.io</authorEmail> <authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://www.vdm.io</authorUrl> <authorUrl>https://www.vdm.io</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright> <copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license> <license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>1.0.1</version> <version>1.0.1</version>
<description><![CDATA[ <description><![CDATA[
<h1>Hello World (v.1.0.1)</h1> <h1>Hello World (v.1.0.1)</h1>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<p></p> <p></p>
<p>Created by <a href="https://www.vdm.io" target="_blank">Llewellyn</a><br /><small>Development started 20th September, 2017</small></p> <p>Created by <a href="https://www.vdm.io" target="_blank">Llewellyn</a><br /><small>Development started 20th September, 2017</small></p>
]]></description> ]]></description>
<!-- Runs on install; New in Joomla 1.5 --> <!-- Runs on install; New in Joomla 1.5 -->
<install> <install>
<sql> <sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file> <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql> </sql>
</install> </install>
<!-- Runs on uninstall; New in Joomla 1.5 --> <!-- Runs on uninstall; New in Joomla 1.5 -->
<uninstall> <uninstall>
<sql> <sql>
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file> <file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
</sql> </sql>
</uninstall> </uninstall>
<!-- Runs on install/uninstall/update; New in Joomla 2.5 --> <!-- Runs on install/uninstall/update; New in Joomla 2.5 -->
<scriptfile>script.php</scriptfile> <scriptfile>script.php</scriptfile>
<media destination="com_hello_world" folder="media"> <media destination="com_hello_world" folder="media">
<filename>index.html</filename> <filename>index.html</filename>
<folder>js</folder> <folder>js</folder>
<folder>css</folder> <folder>css</folder>
<folder>images</folder> <folder>images</folder>
<folder>uikit-v2</folder> <folder>uikit-v2</folder>
<folder>footable-v3</folder> <folder>footable-v3</folder>
</media> </media>
<!-- Update Schema; New in Joomla 2.5 --> <!-- Update Schema; New in Joomla 2.5 -->
<update> <update>
<schemas> <schemas>
<schemapath type="mysql">sql/updates/mysql/</schemapath> <schemapath type="mysql">sql/updates/mysql/</schemapath>
</schemas> </schemas>
</update> </update>
<files folder="site"> <files folder="site">
<filename>controller.php</filename> <filename>controller.php</filename>
<filename>index.html</filename> <filename>index.html</filename>
<filename>router.php</filename> <filename>router.php</filename>
<filename>hello_world.php</filename> <filename>hello_world.php</filename>
<filename>router.php</filename> <filename>router.php</filename>
<folder>assets</folder> <folder>assets</folder>
<folder>helpers</folder> <folder>helpers</folder>
<folder>controllers</folder> <folder>controllers</folder>
<folder>models</folder> <folder>models</folder>
<folder>views</folder> <folder>views</folder>
<folder>layouts</folder> <folder>layouts</folder>
</files> </files>
<languages folder="site"> <languages folder="site">
<language tag="en-GB">language/en-GB/en-GB.com_hello_world.ini</language> <language tag="en-GB">language/en-GB/en-GB.com_hello_world.ini</language>
<language tag="en-GB">language/en-GB/en-GB.com_hello_world.sys.ini</language> <language tag="en-GB">language/en-GB/en-GB.com_hello_world.sys.ini</language>
</languages> </languages>
<administration> <administration>
<menu>COM_HELLO_WORLD_MENU</menu> <menu>COM_HELLO_WORLD_MENU</menu>
<submenu> <submenu>
<!-- Instead of link you can specify individual link attributes --> <!-- Instead of link you can specify individual link attributes -->
<menu option="com_hello_world" view="greetings">COM_HELLO_WORLD_MENU_GREETINGS</menu> <menu option="com_hello_world" view="greetings">COM_HELLO_WORLD_MENU_GREETINGS</menu>
</submenu> </submenu>
<files folder="admin"> <files folder="admin">
<filename>access.xml</filename> <filename>access.xml</filename>
<filename>config.xml</filename> <filename>config.xml</filename>
<filename>controller.php</filename> <filename>controller.php</filename>
<filename>index.html</filename> <filename>index.html</filename>
<filename>hello_world.php</filename> <filename>hello_world.php</filename>
<filename>README.txt</filename> <filename>README.txt</filename>
<folder>assets</folder> <folder>assets</folder>
<folder>controllers</folder> <folder>controllers</folder>
<folder>helpers</folder> <folder>helpers</folder>
<folder>models</folder> <folder>models</folder>
<folder>sql</folder> <folder>sql</folder>
<folder>tables</folder> <folder>tables</folder>
<folder>views</folder> <folder>views</folder>
<folder>layouts</folder> <folder>layouts</folder>
</files> </files>
<languages folder="admin"> <languages folder="admin">
<language tag="en-GB">language/en-GB/en-GB.com_hello_world.ini</language> <language tag="en-GB">language/en-GB/en-GB.com_hello_world.ini</language>
<language tag="en-GB">language/en-GB/en-GB.com_hello_world.sys.ini</language> <language tag="en-GB">language/en-GB/en-GB.com_hello_world.sys.ini</language>
</languages> </languages>
</administration> </administration>
<updateservers> <updateservers>
<server type="extension" enabled="1" element="com_hello_world" name="Hello World">https://raw.githubusercontent.com/Llewellynvdm/Joomla-Hello-World-Component/master/helloworld_updateserver.xml</server> <server type="extension" enabled="1" element="com_hello_world" name="Hello World">https://raw.githubusercontent.com/Llewellynvdm/Joomla-Hello-World-Component/master/helloworld_updateserver.xml</server>
</updateservers> </updateservers>
</extension> </extension>

View File

@ -1,20 +1,20 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greeting.js @subpackage greeting.js
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/

View File

@ -1,55 +1,58 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage script.php @subpackage script.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.modal'); use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/** use Joomla\CMS\Installer\Adapter\ComponentAdapter;
* Script File of Hello_world Component JHTML::_('bootstrap.renderModal');
*/
class com_hello_worldInstallerScript /**
{ * Script File of Hello_world Component
/** */
* Constructor class com_hello_worldInstallerScript
* {
* @param JAdapterInstance $parent The object responsible for running this script /**
*/ * Constructor
public function __construct(JAdapterInstance $parent) {} *
* @param JAdapterInstance $parent The object responsible for running this script
/** */
* Called on installation public function __construct(ComponentAdapter $parent) {}
*
* @param JAdapterInstance $parent The object responsible for running this script /**
* * Called on installation
* @return boolean True on success *
*/ * @param ComponentAdapter $parent The object responsible for running this script
public function install(JAdapterInstance $parent) {} *
* @return boolean True on success
/** */
* Called on uninstallation public function install(ComponentAdapter $parent) {}
*
* @param JAdapterInstance $parent The object responsible for running this script /**
*/ * Called on uninstallation
public function uninstall(JAdapterInstance $parent) *
* @param ComponentAdapter $parent The object responsible for running this script
*/
public function uninstall(ComponentAdapter $parent)
{ {
// Get Application object // Get Application object
$app = JFactory::getApplication(); $app = JFactory::getApplication();
@ -373,83 +376,83 @@ class com_hello_worldInstallerScript
{ {
// If successfully removed Hello_world Greeting add queued success message. // If successfully removed Hello_world Greeting add queued success message.
$app->enqueueMessage(JText::_('The com_hello_world.greeting type alias was removed from the <b>#__action_log_config</b> table')); $app->enqueueMessage(JText::_('The com_hello_world.greeting type alias was removed from the <b>#__action_log_config</b> table'));
} }
// little notice as after service, in case of bad experience with component. // little notice as after service, in case of bad experience with component.
echo '<h2>Did something go wrong? Are you disappointed?</h2> echo '<h2>Did something go wrong? Are you disappointed?</h2>
<p>Please let me know at <a href="mailto:joomla@vdm.io">joomla@vdm.io</a>. <p>Please let me know at <a href="mailto:joomla@vdm.io">joomla@vdm.io</a>.
<br />We at VDM are committed to building extensions that performs proficiently! You can help us, really! <br />We at VDM are committed to building extensions that performs proficiently! You can help us, really!
<br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful! <br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
<br />Visit us at <a href="https://www.vdm.io" target="_blank">https://www.vdm.io</a> today!</p>'; <br />Visit us at <a href="https://www.vdm.io" target="_blank">https://www.vdm.io</a> today!</p>';
} }
/** /**
* Called on update * Called on update
* *
* @param JAdapterInstance $parent The object responsible for running this script * @param ComponentAdapter $parent The object responsible for running this script
* *
* @return boolean True on success * @return boolean True on success
*/ */
public function update(JAdapterInstance $parent){} public function update(ComponentAdapter $parent){}
/** /**
* Called before any type of action * Called before any type of action
* *
* @param string $type Which action is happening (install|uninstall|discover_install|update) * @param string $type Which action is happening (install|uninstall|discover_install|update)
* @param JAdapterInstance $parent The object responsible for running this script * @param ComponentAdapter $parent The object responsible for running this script
* *
* @return boolean True on success * @return boolean True on success
*/ */
public function preflight($type, JAdapterInstance $parent) public function preflight($type, ComponentAdapter $parent)
{ {
// get application // get application
$app = JFactory::getApplication(); $app = JFactory::getApplication();
// is redundant or so it seems ...hmmm let me know if it works again // is redundant or so it seems ...hmmm let me know if it works again
if ($type === 'uninstall') if ($type === 'uninstall')
{ {
return true; return true;
} }
// the default for both install and update // the default for both install and update
$jversion = new JVersion(); $jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0')) if (!$jversion->isCompatible('3.8.0'))
{ {
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
return false; return false;
} }
// do any updates needed // do any updates needed
if ($type === 'update') if ($type === 'update')
{ {
} }
// do any install needed // do any install needed
if ($type === 'install') if ($type === 'install')
{ {
} }
// check if the PHPExcel stuff is still around // check if the PHPExcel stuff is still around
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_hello_world/helpers/PHPExcel.php')) if (File::exists(JPATH_ADMINISTRATOR . '/components/com_hello_world/helpers/PHPExcel.php'))
{ {
// We need to remove this old PHPExcel folder // We need to remove this old PHPExcel folder
$this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_hello_world/helpers/PHPExcel'); $this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_hello_world/helpers/PHPExcel');
// We need to remove this old PHPExcel file // We need to remove this old PHPExcel file
JFile::delete(JPATH_ADMINISTRATOR . '/components/com_hello_world/helpers/PHPExcel.php'); File::delete(JPATH_ADMINISTRATOR . '/components/com_hello_world/helpers/PHPExcel.php');
} }
return true; return true;
} }
/** /**
* Called after any type of action * Called after any type of action
* *
* @param string $type Which action is happening (install|uninstall|discover_install|update) * @param string $type Which action is happening (install|uninstall|discover_install|update)
* @param JAdapterInstance $parent The object responsible for running this script * @param ComponentAdapter $parent The object responsible for running this script
* *
* @return boolean True on success * @return boolean True on success
*/ */
public function postflight($type, JAdapterInstance $parent) public function postflight($type, ComponentAdapter $parent)
{ {
// get application // get application
$app = JFactory::getApplication(); $app = JFactory::getApplication();
// We check if we have dynamic folders to copy // We check if we have dynamic folders to copy
$this->setDynamicF0ld3rs($app, $parent); $this->setDynamicF0ld3rs($app, $parent);
// set the default component settings // set the default component settings
if ($type === 'install') if ($type === 'install')
{ {
// Get The Database object // Get The Database object
@ -482,7 +485,7 @@ class com_hello_worldInstallerScript
$db->setQuery($query); $db->setQuery($query);
$allDone = $db->execute(); $allDone = $db->execute();
// Install the global extenstion params. // Install the global extension params.
$query = $db->getQuery(true); $query = $db->getQuery(true);
// Field to update. // Field to update.
$fields = array( $fields = array(
@ -527,10 +530,10 @@ class com_hello_worldInstallerScript
$greeting_action_log_config->text_prefix = 'COM_HELLO_WORLD'; $greeting_action_log_config->text_prefix = 'COM_HELLO_WORLD';
// Set the object into the action log config table. // Set the object into the action log config table.
$greeting_Inserted = $db->insertObject('#__action_log_config', $greeting_action_log_config); $greeting_Inserted = $db->insertObject('#__action_log_config', $greeting_action_log_config);
} }
// do any updates needed // do any updates needed
if ($type === 'update') if ($type === 'update')
{ {
// Get The Database object // Get The Database object
@ -626,110 +629,110 @@ class com_hello_worldInstallerScript
else else
{ {
$greeting_action_log_config_Inserted = $db->insertObject('#__action_log_config', $greeting_action_log_config); $greeting_action_log_config_Inserted = $db->insertObject('#__action_log_config', $greeting_action_log_config);
} }
} }
return true; return true;
} }
/** /**
* Remove folders with files * Remove folders with files
* *
* @param string $dir The path to folder to remove * @param string $dir The path to folder to remove
* @param boolean $ignore The folders and files to ignore and not remove * @param boolean $ignore The folders and files to ignore and not remove
* *
* @return boolean True in all is removed * @return boolean True in all is removed
* *
*/ */
protected function removeFolder($dir, $ignore = false) protected function removeFolder($dir, $ignore = false)
{ {
if (JFolder::exists($dir)) if (Folder::exists($dir))
{ {
$it = new RecursiveDirectoryIterator($dir); $it = new RecursiveDirectoryIterator($dir);
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
// remove ending / // remove ending /
$dir = rtrim($dir, '/'); $dir = rtrim($dir, '/');
// now loop the files & folders // now loop the files & folders
foreach ($it as $file) foreach ($it as $file)
{ {
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue; if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
// set file dir // set file dir
$file_dir = $file->getPathname(); $file_dir = $file->getPathname();
// check if this is a dir or a file // check if this is a dir or a file
if ($file->isDir()) if ($file->isDir())
{ {
$keeper = false; $keeper = false;
if ($this->checkArray($ignore)) if ($this->checkArray($ignore))
{ {
foreach ($ignore as $keep) foreach ($ignore as $keep)
{ {
if (strpos($file_dir, $dir.'/'.$keep) !== false) if (strpos($file_dir, $dir.'/'.$keep) !== false)
{ {
$keeper = true; $keeper = true;
} }
} }
} }
if ($keeper) if ($keeper)
{ {
continue; continue;
} }
JFolder::delete($file_dir); Folder::delete($file_dir);
} }
else else
{ {
$keeper = false; $keeper = false;
if ($this->checkArray($ignore)) if ($this->checkArray($ignore))
{ {
foreach ($ignore as $keep) foreach ($ignore as $keep)
{ {
if (strpos($file_dir, $dir.'/'.$keep) !== false) if (strpos($file_dir, $dir.'/'.$keep) !== false)
{ {
$keeper = true; $keeper = true;
} }
} }
} }
if ($keeper) if ($keeper)
{ {
continue; continue;
} }
JFile::delete($file_dir); File::delete($file_dir);
} }
} }
// delete the root folder if not ignore found // delete the root folder if not ignore found
if (!$this->checkArray($ignore)) if (!$this->checkArray($ignore))
{ {
return JFolder::delete($dir); return Folder::delete($dir);
} }
return true; return true;
} }
return false; return false;
} }
/** /**
* Check if have an array with a length * Check if have an array with a length
* *
* @input array The array to check * @input array The array to check
* *
* @returns bool/int number of items in array on success * @returns bool/int number of items in array on success
*/ */
protected function checkArray($array, $removeEmptyString = false) protected function checkArray($array, $removeEmptyString = false)
{ {
if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
{ {
// also make sure the empty strings are removed // also make sure the empty strings are removed
if ($removeEmptyString) if ($removeEmptyString)
{ {
foreach ($array as $key => $string) foreach ($array as $key => $string)
{ {
if (empty($string)) if (empty($string))
{ {
unset($array[$key]); unset($array[$key]);
} }
} }
return $this->checkArray($array, false); return $this->checkArray($array, false);
} }
return $nr; return $nr;
} }
return false; return false;
} }
/** /**
@ -743,7 +746,7 @@ class com_hello_worldInstallerScript
$installer = $parent->getParent(); $installer = $parent->getParent();
$installPath = $installer->getPath('source'); $installPath = $installer->getPath('source');
// get all the folders // get all the folders
$folders = JFolder::folders($installPath); $folders = Folder::folders($installPath);
// check if we have folders we may want to copy // check if we have folders we may want to copy
$doNotCopy = array('media','admin','site'); // Joomla already deals with these $doNotCopy = array('media','admin','site'); // Joomla already deals with these
if (count((array) $folders) > 1) if (count((array) $folders) > 1)
@ -758,12 +761,12 @@ class com_hello_worldInstallerScript
// set the destination path // set the destination path
$dest = JPATH_ROOT.'/'.$folder; $dest = JPATH_ROOT.'/'.$folder;
// now try to copy the folder // now try to copy the folder
if (!JFolder::copy($src, $dest, '', true)) if (!Folder::copy($src, $dest, '', true))
{ {
$app->enqueueMessage('Could not copy '.$folder.' folder into place, please make sure destination is writable!', 'error'); $app->enqueueMessage('Could not copy '.$folder.' folder into place, please make sure destination is writable!', 'error');
} }
} }
} }
} }
} }
} }

View File

@ -1,22 +1,22 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greet.css @subpackage greet.css
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* CSS Document */ /* CSS Document */

View File

@ -1,22 +1,22 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greeting.css @subpackage greeting.css
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* CSS Document */ /* CSS Document */

View File

@ -1,22 +1,22 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greetings.css @subpackage greetings.css
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* CSS Document */ /* CSS Document */

View File

@ -1,24 +1,24 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage site.css @subpackage site.css
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* CSS Document */ /* CSS Document */
.no-click { .no-click {
pointer-events: none; pointer-events: none;
} }

View File

@ -1,20 +1,20 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage site.js @subpackage site.js
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
/* JS Document */ /* JS Document */

View File

@ -1,131 +1,131 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage controller.php @subpackage controller.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Hello_world Component Controller * Hello_world Component Controller
*/ */
class Hello_worldController extends JControllerLegacy class Hello_worldController extends JControllerLegacy
{ {
/** /**
* Method to display a view. * Method to display a view.
* *
* @param boolean $cachable If true, the view output will be cached. * @param boolean $cachable If true, the view output will be cached.
* @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
* *
* @return JController This object to support chaining. * @return JController This object to support chaining.
* *
*/ */
function display($cachable = false, $urlparams = false) function display($cachable = false, $urlparams = false)
{ {
// set default view if not set // set default view if not set
$view = $this->input->getCmd('view', 'greetings'); $view = $this->input->getCmd('view', 'greetings');
$this->input->set('view', $view); $this->input->set('view', $view);
$isEdit = $this->checkEditView($view); $isEdit = $this->checkEditView($view);
$layout = $this->input->get('layout', null, 'WORD'); $layout = $this->input->get('layout', null, 'WORD');
$id = $this->input->getInt('id'); $id = $this->input->getInt('id');
// $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238) // $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238)
// insure that the view is not cashable if edit view or if user is logged in // insure that the view is not cashable if edit view or if user is logged in
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->get('id') || $isEdit) if ($user->get('id') || $isEdit)
{ {
$cachable = false; $cachable = false;
} }
// Check for edit form. // Check for edit form.
if($isEdit) if($isEdit)
{ {
if ($layout == 'edit' && !$this->checkEditId('com_hello_world.edit.'.$view, $id)) if ($layout == 'edit' && !$this->checkEditId('com_hello_world.edit.'.$view, $id))
{ {
// Somehow the person just went to the form - we don't allow that. // Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error'); $this->setMessage($this->getError(), 'error');
// check if item was opend from other then its own list view // check if item was opend from other then its own list view
$ref = $this->input->getCmd('ref', 0); $ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0); $refid = $this->input->getInt('refid', 0);
// set redirect // set redirect
if ($refid > 0 && Hello_worldHelper::checkString($ref)) if ($refid > 0 && Hello_worldHelper::checkString($ref))
{ {
// redirect to item of ref // redirect to item of ref
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); $this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
} }
elseif (Hello_worldHelper::checkString($ref)) elseif (Hello_worldHelper::checkString($ref))
{ {
// redirect to ref // redirect to ref
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.(string)$ref, false)); $this->setRedirect(JRoute::_('index.php?option=com_hello_world&view='.(string)$ref, false));
} }
else else
{ {
// normal redirect back to the list default site view // normal redirect back to the list default site view
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view=greetings', false)); $this->setRedirect(JRoute::_('index.php?option=com_hello_world&view=greetings', false));
} }
return false; return false;
} }
} }
// we may need to make this more dynamic in the future. (TODO) // we may need to make this more dynamic in the future. (TODO)
$safeurlparams = array( $safeurlparams = array(
'catid' => 'INT', 'catid' => 'INT',
'id' => 'INT', 'id' => 'INT',
'cid' => 'ARRAY', 'cid' => 'ARRAY',
'year' => 'INT', 'year' => 'INT',
'month' => 'INT', 'month' => 'INT',
'limit' => 'UINT', 'limit' => 'UINT',
'limitstart' => 'UINT', 'limitstart' => 'UINT',
'showall' => 'INT', 'showall' => 'INT',
'return' => 'BASE64', 'return' => 'BASE64',
'filter' => 'STRING', 'filter' => 'STRING',
'filter_order' => 'CMD', 'filter_order' => 'CMD',
'filter_order_Dir' => 'CMD', 'filter_order_Dir' => 'CMD',
'filter-search' => 'STRING', 'filter-search' => 'STRING',
'print' => 'BOOLEAN', 'print' => 'BOOLEAN',
'lang' => 'CMD', 'lang' => 'CMD',
'Itemid' => 'INT'); 'Itemid' => 'INT');
// should these not merge? // should these not merge?
if (Hello_worldHelper::checkArray($urlparams)) if (Hello_worldHelper::checkArray($urlparams))
{ {
$safeurlparams = Hello_worldHelper::mergeArrays(array($urlparams, $safeurlparams)); $safeurlparams = Hello_worldHelper::mergeArrays(array($urlparams, $safeurlparams));
} }
return parent::display($cachable, $safeurlparams); return parent::display($cachable, $safeurlparams);
} }
protected function checkEditView($view) protected function checkEditView($view)
{ {
if (Hello_worldHelper::checkString($view)) if (Hello_worldHelper::checkString($view))
{ {
$views = array( $views = array(
'greeting' 'greeting'
); );
// check if this is a edit view // check if this is a edit view
if (in_array($view,$views)) if (in_array($view,$views))
{ {
return true; return true;
} }
} }
return false; return false;
} }
} }

View File

@ -1,65 +1,65 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greeting.php @subpackage greeting.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Greeting Controller * Greeting Controller
*/ */
class Hello_worldControllerGreeting extends JControllerForm class Hello_worldControllerGreeting extends JControllerForm
{ {
/** /**
* Current or most recently performed task. * Current or most recently performed task.
* *
* @var string * @var string
* @since 12.2 * @since 12.2
* @note Replaces _task. * @note Replaces _task.
*/ */
protected $task; protected $task;
/** /**
* Class constructor. * Class constructor.
* *
* @param array $config A named array of configuration variables. * @param array $config A named array of configuration variables.
* *
* @since 1.6 * @since 1.6
*/ */
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'greetings'; // safeguard for setting the return view listing to the default site view. $this->view_list = 'greetings'; // safeguard for setting the return view listing to the default site view.
parent::__construct($config); parent::__construct($config);
} }
/** /**
* Method override to check if you can add a new record. * Method override to check if you can add a new record.
* *
* @param array $data An array of input data. * @param array $data An array of input data.
* *
* @return boolean * @return boolean
* *
* @since 1.6 * @since 1.6
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// Get user object. // Get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
@ -71,20 +71,20 @@ class Hello_worldControllerGreeting extends JControllerForm
} }
// In the absense of better information, revert to the component permissions. // In the absense of better information, revert to the component permissions.
return parent::allowAdd($data); return parent::allowAdd($data);
} }
/** /**
* Method override to check if you can edit an existing record. * Method override to check if you can edit an existing record.
* *
* @param array $data An array of input data. * @param array $data An array of input data.
* @param string $key The name of the key for the primary key. * @param string $key The name of the key for the primary key.
* *
* @return boolean * @return boolean
* *
* @since 1.6 * @since 1.6
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// get user object. // get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
@ -127,199 +127,199 @@ class Hello_worldControllerGreeting extends JControllerForm
} }
} }
// Since there is no permission, revert to the component permissions. // Since there is no permission, revert to the component permissions.
return parent::allowEdit($data, $key); return parent::allowEdit($data, $key);
} }
/** /**
* Gets the URL arguments to append to an item redirect. * Gets the URL arguments to append to an item redirect.
* *
* @param integer $recordId The primary key id for the item. * @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id. * @param string $urlVar The name of the URL variable for the id.
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 1.6 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') 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('Greeting', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view=greetings' . $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; // 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('Greeting', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_hello_world&view=greetings' . $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;
}
}

View File

@ -1,42 +1,42 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage hello_world.php @subpackage hello_world.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Set the component css/js // Set the component css/js
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$document->addStyleSheet('components/com_hello_world/assets/css/site.css'); $document->addStyleSheet('components/com_hello_world/assets/css/site.css');
$document->addScript('components/com_hello_world/assets/js/site.js'); $document->addScript('components/com_hello_world/assets/js/site.js');
// Require helper files // Require helper files
JLoader::register('Hello_worldHelper', __DIR__ . '/helpers/hello_world.php'); JLoader::register('Hello_worldHelper', __DIR__ . '/helpers/hello_world.php');
JLoader::register('Hello_worldHelperRoute', __DIR__ . '/helpers/route.php'); JLoader::register('Hello_worldHelperRoute', __DIR__ . '/helpers/route.php');
// Get an instance of the controller prefixed by Hello_world // Get an instance of the controller prefixed by Hello_world
$controller = JControllerLegacy::getInstance('Hello_world'); $controller = JControllerLegacy::getInstance('Hello_world');
// Perform the request task // Perform the request task
$controller->execute(JFactory::getApplication()->input->get('task')); $controller->execute(JFactory::getApplication()->input->get('task'));
// Redirect if set by the controller // Redirect if set by the controller
$controller->redirect(); $controller->redirect();

View File

@ -1,21 +1,21 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage category.php @subpackage category.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file

View File

@ -1,80 +1,80 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage headercheck.php @subpackage headercheck.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
class hello_worldHeaderCheck class hello_worldHeaderCheck
{ {
function js_loaded($script_name) function js_loaded($script_name)
{ {
// UIkit check point // UIkit check point
if (strpos($script_name,'uikit') !== false) if (strpos($script_name,'uikit') !== false)
{ {
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template; $getTemplateName = $app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false) if (strpos($getTemplateName,'yoo') !== false)
{ {
return true; return true;
} }
} }
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$head_data = $document->getHeadData(); $head_data = $document->getHeadData();
foreach (array_keys($head_data['scripts']) as $script) foreach (array_keys($head_data['scripts']) as $script)
{ {
if (stristr($script, $script_name)) if (stristr($script, $script_name))
{ {
return true; return true;
} }
} }
return false; return false;
} }
function css_loaded($script_name) function css_loaded($script_name)
{ {
// UIkit check point // UIkit check point
if (strpos($script_name,'uikit') !== false) if (strpos($script_name,'uikit') !== false)
{ {
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template; $getTemplateName = $app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false) if (strpos($getTemplateName,'yoo') !== false)
{ {
return true; return true;
} }
} }
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$head_data = $document->getHeadData(); $head_data = $document->getHeadData();
foreach (array_keys($head_data['styleSheets']) as $script) foreach (array_keys($head_data['styleSheets']) as $script)
{ {
if (stristr($script, $script_name)) if (stristr($script, $script_name))
{ {
return true; return true;
} }
} }
return false; return false;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +1,31 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage route.php @subpackage route.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/** /**
* Hello_world Route Helper * Hello_world Route Helper
**/ **/
abstract class Hello_worldHelperRoute abstract class Hello_worldHelperRoute
{ {
protected static $lookup; protected static $lookup;
/** /**
@ -112,196 +112,196 @@ abstract class Hello_worldHelperRoute
} }
return $link; return $link;
} }
/** /**
* Get the URL route for hello_world category from a category ID and language * Get the URL route for hello_world category from a category ID and language
* *
* @param mixed $catid The id of the items's category either an integer id or a instance of JCategoryNode * @param mixed $catid The id of the items's category either an integer id or a instance of JCategoryNode
* @param mixed $language The id of the language being used. * @param mixed $language The id of the language being used.
* *
* @return string The link to the contact * @return string The link to the contact
* *
* @since 1.5 * @since 1.5
*/ */
public static function getCategoryRoute_keep_for_later($catid, $language = 0) public static function getCategoryRoute_keep_for_later($catid, $language = 0)
{ {
if ($catid instanceof JCategoryNode) if ($catid instanceof JCategoryNode)
{ {
$id = $catid->id; $id = $catid->id;
$category = $catid; $category = $catid;
} }
else else
{ {
throw new Exception('First parameter must be JCategoryNode'); throw new Exception('First parameter must be JCategoryNode');
} }
$views = array(); $views = array();
$view = $views[$category->extension]; $view = $views[$category->extension];
if ($id < 1 || !($category instanceof JCategoryNode)) if ($id < 1 || !($category instanceof JCategoryNode))
{ {
$link = ''; $link = '';
} }
else else
{ {
//Create the link //Create the link
$link = 'index.php?option=com_hello_world&view='.$view.'&category='.$category->slug; $link = 'index.php?option=com_hello_world&view='.$view.'&category='.$category->slug;
$needles = array( $needles = array(
$view => array($id), $view => array($id),
'category' => array($id) 'category' => array($id)
); );
if ($language && $language != "*" && JLanguageMultilang::isEnabled()) if ($language && $language != "*" && JLanguageMultilang::isEnabled())
{ {
$db = JFactory::getDbo(); $db = JFactory::getDbo();
$query = $db->getQuery(true) $query = $db->getQuery(true)
->select('a.sef AS sef') ->select('a.sef AS sef')
->select('a.lang_code AS lang_code') ->select('a.lang_code AS lang_code')
->from('#__languages AS a'); ->from('#__languages AS a');
$db->setQuery($query); $db->setQuery($query);
$langs = $db->loadObjectList(); $langs = $db->loadObjectList();
foreach ($langs as $lang) foreach ($langs as $lang)
{ {
if ($language == $lang->lang_code) if ($language == $lang->lang_code)
{ {
$link .= '&lang='.$lang->sef; $link .= '&lang='.$lang->sef;
$needles['language'] = $language; $needles['language'] = $language;
} }
} }
} }
if ($item = self::_findItem($needles,'category')) if ($item = self::_findItem($needles,'category'))
{ {
$link .= '&Itemid='.$item; $link .= '&Itemid='.$item;
} }
else else
{ {
if ($category) if ($category)
{ {
$catids = array_reverse($category->getPath()); $catids = array_reverse($category->getPath());
$needles = array( $needles = array(
'category' => $catids 'category' => $catids
); );
if ($item = self::_findItem($needles,'category')) if ($item = self::_findItem($needles,'category'))
{ {
$link .= '&Itemid='.$item; $link .= '&Itemid='.$item;
} }
elseif ($item = self::_findItem(null, 'category')) elseif ($item = self::_findItem(null, 'category'))
{ {
$link .= '&Itemid='.$item; $link .= '&Itemid='.$item;
} }
} }
} }
} }
return $link; return $link;
} }
protected static function _findItem($needles = null,$type = null) protected static function _findItem($needles = null,$type = null)
{ {
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$menus = $app->getMenu('site'); $menus = $app->getMenu('site');
$language = isset($needles['language']) ? $needles['language'] : '*'; $language = isset($needles['language']) ? $needles['language'] : '*';
// Prepare the reverse lookup array. // Prepare the reverse lookup array.
if (!isset(self::$lookup[$language])) if (!isset(self::$lookup[$language]))
{ {
self::$lookup[$language] = array(); self::$lookup[$language] = array();
$component = JComponentHelper::getComponent('com_hello_world'); $component = JComponentHelper::getComponent('com_hello_world');
$attributes = array('component_id'); $attributes = array('component_id');
$values = array($component->id); $values = array($component->id);
if ($language != '*') if ($language != '*')
{ {
$attributes[] = 'language'; $attributes[] = 'language';
$values[] = array($needles['language'], '*'); $values[] = array($needles['language'], '*');
} }
$items = $menus->getItems($attributes, $values); $items = $menus->getItems($attributes, $values);
foreach ($items as $item) foreach ($items as $item)
{ {
if (isset($item->query) && isset($item->query['view'])) if (isset($item->query) && isset($item->query['view']))
{ {
$view = $item->query['view']; $view = $item->query['view'];
if (!isset(self::$lookup[$language][$view])) if (!isset(self::$lookup[$language][$view]))
{ {
self::$lookup[$language][$view] = array(); self::$lookup[$language][$view] = array();
} }
if (isset($item->query['id'])) if (isset($item->query['id']))
{ {
/** /**
* Here it will become a bit tricky * Here it will become a bit tricky
* language != * can override existing entries * language != * can override existing entries
* language == * cannot override existing entries * language == * cannot override existing entries
*/ */
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*') if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
{ {
self::$lookup[$language][$view][$item->query['id']] = $item->id; self::$lookup[$language][$view][$item->query['id']] = $item->id;
} }
} }
else else
{ {
self::$lookup[$language][$view][0] = $item->id; self::$lookup[$language][$view][0] = $item->id;
} }
} }
} }
} }
if ($needles) if ($needles)
{ {
foreach ($needles as $view => $ids) foreach ($needles as $view => $ids)
{ {
if (isset(self::$lookup[$language][$view])) if (isset(self::$lookup[$language][$view]))
{ {
if (Hello_worldHelper::checkArray($ids)) if (Hello_worldHelper::checkArray($ids))
{ {
foreach ($ids as $id) foreach ($ids as $id)
{ {
if (isset(self::$lookup[$language][$view][(int) $id])) if (isset(self::$lookup[$language][$view][(int) $id]))
{ {
return self::$lookup[$language][$view][(int) $id]; return self::$lookup[$language][$view][(int) $id];
} }
} }
} }
elseif (isset(self::$lookup[$language][$view][0])) elseif (isset(self::$lookup[$language][$view][0]))
{ {
return self::$lookup[$language][$view][0]; return self::$lookup[$language][$view][0];
} }
} }
} }
} }
if ($type) if ($type)
{ {
// Check if the global menu item has been set. // Check if the global menu item has been set.
$params = JComponentHelper::getParams('com_hello_world'); $params = JComponentHelper::getParams('com_hello_world');
if ($item = $params->get($type.'_menu', 0)) if ($item = $params->get($type.'_menu', 0))
{ {
return $item; return $item;
} }
} }
// Check if the active menuitem matches the requested language // Check if the active menuitem matches the requested language
$active = $menus->getActive(); $active = $menus->getActive();
if ($active if ($active
&& $active->component == 'com_hello_world' && $active->component == 'com_hello_world'
&& ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled()))
{ {
return $active->id; return $active->id;
} }
// If not found, return language specific home link // If not found, return language specific home link
$default = $menus->getDefault($language); $default = $menus->getDefault($language);
return !empty($default->id) ? $default->id : null; return !empty($default->id) ? $default->id : null;
} }
} }

View File

@ -37,7 +37,6 @@ COM_HELLO_WORLD_GREETING_CREATED_DATE_LABEL="Created Date"
COM_HELLO_WORLD_GREETING_DETAILS="Details" COM_HELLO_WORLD_GREETING_DETAILS="Details"
COM_HELLO_WORLD_GREETING_EDIT="Editing the Greeting" COM_HELLO_WORLD_GREETING_EDIT="Editing the Greeting"
COM_HELLO_WORLD_GREETING_ERROR_UNIQUE_ALIAS="Another Greeting has the same alias." COM_HELLO_WORLD_GREETING_ERROR_UNIQUE_ALIAS="Another Greeting has the same alias."
COM_HELLO_WORLD_GREETING_GREETING="Greeting"
COM_HELLO_WORLD_GREETING_GREETING_DESCRIPTION="Enter a greeting" COM_HELLO_WORLD_GREETING_GREETING_DESCRIPTION="Enter a greeting"
COM_HELLO_WORLD_GREETING_GREETING_HINT="Greeting here!" COM_HELLO_WORLD_GREETING_GREETING_HINT="Greeting here!"
COM_HELLO_WORLD_GREETING_GREETING_LABEL="Greeting" COM_HELLO_WORLD_GREETING_GREETING_LABEL="Greeting"

View File

@ -1,51 +1,51 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage details_left.php @subpackage details_left.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// get the form // get the form
$form = $displayData->getForm(); $form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID) // get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId()); $layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method // Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around // this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. // seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php // example of layout name: details_left.php
// example of method name: getFields_details_left() // example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1]; $fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields // get the fields
$fields = $displayData->get($fields_tab_layout) ?: array( $fields = $displayData->get($fields_tab_layout) ?: array(
'greeting' 'greeting'
); );
$hiddenFields = $displayData->get('hidden_fields') ?: array(); $hiddenFields = $displayData->get('hidden_fields') ?: array();
?> ?>
<?php if ($fields && count((array) $fields)) :?> <?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?> <?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?> <?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?> <?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?> <?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> <?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>

View File

@ -1,50 +1,50 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage metadata.php @subpackage metadata.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();
// JLayout for standard handling of metadata fields in the administrator content edit screens. // JLayout for standard handling of metadata fields in the administrator content edit screens.
$fieldSets = $form->getFieldsets('metadata'); $fieldSets = $form->getFieldsets('metadata');
?> ?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?> <?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?> <?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
<p class="alert alert-info"><?php echo $this->escape(JText::_($fieldSet->description)); ?></p> <p class="alert alert-info"><?php echo $this->escape(JText::_($fieldSet->description)); ?></p>
<?php endif; ?> <?php endif; ?>
<?php <?php
// Include the real fields in this panel. // Include the real fields in this panel.
if ($name == 'vdmmetadata') if ($name == 'vdmmetadata')
{ {
echo $form->renderField('metadesc'); echo $form->renderField('metadesc');
echo $form->renderField('metakey'); echo $form->renderField('metakey');
} }
foreach ($form->getFieldset($name) as $field) foreach ($form->getFieldset($name) as $field)
{ {
if ($field->name != 'jform[metadata][tags][]') if ($field->name != 'jform[metadata][tags][]')
{ {
echo $field->renderField(); echo $field->renderField();
} }
} ?> } ?>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -1,40 +1,40 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage publishing.php @subpackage publishing.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// get the form // get the form
$form = $displayData->getForm(); $form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID) // get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId()); $layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method // Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around // this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. // seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php // example of layout name: details_left.php
// example of method name: getFields_details_left() // example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1]; $fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields // get the fields
$fields = $displayData->get($fields_tab_layout) ?: array( $fields = $displayData->get($fields_tab_layout) ?: array(
'title', 'title',
'created', 'created',
'created_by', 'created_by',
@ -45,17 +45,17 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
'access', 'access',
'version', 'version',
'hits', 'hits',
'id' 'id'
); );
$hiddenFields = $displayData->get('hidden_fields') ?: array(); $hiddenFields = $displayData->get('hidden_fields') ?: array();
?> ?>
<?php if ($fields && count((array) $fields)) :?> <?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?> <?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?> <?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?> <?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?> <?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> <?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>

View File

@ -1,20 +1,20 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greeting.js @subpackage greeting.js
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<form <form
addrulepath="/administrator/components/com_hello_world/models/rules" addrulepath="/administrator/components/com_hello_world/models/rules"
addfieldpath="/administrator/components/com_hello_world/models/fields" addfieldpath="/administrator/components/com_hello_world/models/fields"
> >
<fieldset name="details"> <fieldset name="details">
<!-- Default Fields. --> <!-- Default Fields. -->
<!-- Id Field. Type: Text (joomla) --> <!-- Id Field. Type: Text (joomla) -->
@ -154,8 +154,8 @@
cols="30" rows="2" cols="30" rows="2"
/> />
</fieldset> </fieldset>
</fields> </fields>
<!-- Access Control Fields. --> <!-- Access Control Fields. -->
<fieldset name="accesscontrol"> <fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) --> <!-- Asset Id Field. Type: Hidden (joomla) -->
@ -176,5 +176,5 @@
component="com_hello_world" component="com_hello_world"
section="greeting" section="greeting"
/> />
</fieldset> </fieldset>
</form> </form>

View File

@ -1,91 +1,91 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greet.php @subpackage greet.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Hello_world Greet Model * Hello_world Greet Model
*/ */
class Hello_worldModelGreet extends JModelItem class Hello_worldModelGreet extends JModelItem
{ {
/** /**
* Model context string. * Model context string.
* *
* @var string * @var string
*/ */
protected $_context = 'com_hello_world.greet'; protected $_context = 'com_hello_world.greet';
/** /**
* Model user data. * Model user data.
* *
* @var strings * @var strings
*/ */
protected $user; protected $user;
protected $userId; protected $userId;
protected $guest; protected $guest;
protected $groups; protected $groups;
protected $levels; protected $levels;
protected $app; protected $app;
protected $input; protected $input;
protected $uikitComp; protected $uikitComp;
/** /**
* @var object item * @var object item
*/ */
protected $item; protected $item;
/** /**
* Method to auto-populate the model state. * Method to auto-populate the model state.
* *
* Note. Calling getState in this method will result in recursion. * Note. Calling getState in this method will result in recursion.
* *
* @since 1.6 * @since 1.6
* *
* @return void * @return void
*/ */
protected function populateState() protected function populateState()
{ {
$this->app = JFactory::getApplication(); $this->app = JFactory::getApplication();
$this->input = $this->app->input; $this->input = $this->app->input;
// Get the itme main id // Get the itme main id
$id = $this->input->getInt('id', null); $id = $this->input->getInt('id', null);
$this->setState('greet.id', $id); $this->setState('greet.id', $id);
// Load the parameters. // Load the parameters.
$params = $this->app->getParams(); $params = $this->app->getParams();
$this->setState('params', $params); $this->setState('params', $params);
parent::populateState(); parent::populateState();
} }
/** /**
* Method to get article data. * Method to get article data.
* *
* @param integer $pk The id of the article. * @param integer $pk The id of the article.
* *
* @return mixed Menu item data object on success, false on failure. * @return mixed Menu item data object on success, false on failure.
*/ */
public function getItem($pk = null) public function getItem($pk = null)
{ {
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// check if this user has permission to access item // check if this user has permission to access item
if (!$this->user->authorise('site.greet.access', 'com_hello_world')) if (!$this->user->authorise('site.greet.access', 'com_hello_world'))
@ -95,24 +95,24 @@ class Hello_worldModelGreet extends JModelItem
// redirect away to the home page if no access allowed. // redirect away to the home page if no access allowed.
$app->redirect(JURI::root()); $app->redirect(JURI::root());
return false; return false;
} }
$this->userId = $this->user->get('id'); $this->userId = $this->user->get('id');
$this->guest = $this->user->get('guest'); $this->guest = $this->user->get('guest');
$this->groups = $this->user->get('groups'); $this->groups = $this->user->get('groups');
$this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->authorisedGroups = $this->user->getAuthorisedGroups();
$this->levels = $this->user->getAuthorisedViewLevels(); $this->levels = $this->user->getAuthorisedViewLevels();
$this->initSet = true; $this->initSet = true;
$pk = (!empty($pk)) ? $pk : (int) $this->getState('greet.id'); $pk = (!empty($pk)) ? $pk : (int) $this->getState('greet.id');
if ($this->_item === null) if ($this->_item === null)
{ {
$this->_item = array(); $this->_item = array();
} }
if (!isset($this->_item[$pk])) if (!isset($this->_item[$pk]))
{ {
try try
{ {
// Get a db connection. // Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
@ -142,24 +142,24 @@ class Hello_worldModelGreet extends JModelItem
} }
// set data object to item. // set data object to item.
$this->_item[$pk] = $data; $this->_item[$pk] = $data;
} }
catch (Exception $e) catch (Exception $e)
{ {
if ($e->getCode() == 404) if ($e->getCode() == 404)
{ {
// Need to go thru the error handler to allow Redirect to work. // Need to go thru the error handler to allow Redirect to work.
JError::raiseWarning(404, $e->getMessage()); JError::raiseWarning(404, $e->getMessage());
} }
else else
{ {
$this->setError($e); $this->setError($e);
$this->_item[$pk] = false; $this->_item[$pk] = false;
} }
} }
} }
return $this->_item[$pk]; return $this->_item[$pk];
} }
/** /**
@ -175,5 +175,5 @@ class Hello_worldModelGreet extends JModelItem
return $this->uikitComp; return $this->uikitComp;
} }
return false; return false;
} }
} }

View File

@ -1,134 +1,128 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greeting.php @subpackage greeting.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
use Joomla\String\StringHelper; use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Hello_world Greeting Model * Hello_world Greeting Model
*/ */
class Hello_worldModelGreeting extends JModelAdmin class Hello_worldModelGreeting extends JModelAdmin
{ {
/** /**
* The tab layout fields array. * The tab layout fields array.
* *
* @var array * @var array
*/ */
protected $tabLayoutFields = array( protected $tabLayoutFields = array(
'details' => array( 'details' => array(
'left' => array( 'left' => array(
'greeting' 'greeting'
) )
) )
); );
/** /**
* @var string The prefix to use with controller messages. * @var string The prefix to use with controller messages.
* @since 1.6 * @since 1.6
*/ */
protected $text_prefix = 'COM_HELLO_WORLD'; protected $text_prefix = 'COM_HELLO_WORLD';
/** /**
* The type alias for this content type. * The type alias for this content type.
* *
* @var string * @var string
* @since 3.2 * @since 3.2
*/ */
public $typeAlias = 'com_hello_world.greeting'; public $typeAlias = 'com_hello_world.greeting';
/** /**
* Returns a Table object, always creating it * Returns a Table object, always creating it
* *
* @param type $type The table type to instantiate * @param type $type The table type to instantiate
* @param string $prefix A prefix for the table class name. Optional. * @param string $prefix A prefix for the table class name. Optional.
* @param array $config Configuration array for model. Optional. * @param array $config Configuration array for model. Optional.
* *
* @return JTable A database object * @return JTable A database object
* *
* @since 1.6 * @since 1.6
*/ */
public function getTable($type = 'greeting', $prefix = 'Hello_worldTable', $config = array()) public function getTable($type = 'greeting', $prefix = 'Hello_worldTable', $config = array())
{ {
// add table path for when model gets used from other component // add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_hello_world/tables'); $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_hello_world/tables');
// get instance of the table // get instance of the table
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
} }
/** /**
* Method to get a single record. * Method to get a single record.
* *
* @param integer $pk The id of the primary key. * @param integer $pk The id of the primary key.
* *
* @return mixed Object on success, false on failure. * @return mixed Object on success, false on failure.
* *
* @since 1.6 * @since 1.6
*/ */
public function getItem($pk = null) public function getItem($pk = null)
{ {
if ($item = parent::getItem($pk)) if ($item = parent::getItem($pk))
{ {
if (!empty($item->params) && !is_array($item->params)) if (!empty($item->params) && !is_array($item->params))
{ {
// Convert the params field to an array. // Convert the params field to an array.
$registry = new Registry; $registry = new Registry;
$registry->loadString($item->params); $registry->loadString($item->params);
$item->params = $registry->toArray(); $item->params = $registry->toArray();
} }
if (!empty($item->metadata)) if (!empty($item->metadata))
{ {
// Convert the metadata field to an array. // Convert the metadata field to an array.
$registry = new Registry; $registry = new Registry;
$registry->loadString($item->metadata); $registry->loadString($item->metadata);
$item->metadata = $registry->toArray(); $item->metadata = $registry->toArray();
} }
}
if (!empty($item->id))
{ return $item;
$item->tags = new JHelperTags; }
$item->tags->getTagIds($item->id, 'com_hello_world.greeting');
} /**
} * Method to get the record form.
*
return $item; * @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.
/** *
* Method to get the record form. * @return mixed A JForm object on success, false on failure
* *
* @param array $data Data for the form. * @since 1.6
* @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. public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
* {
* @return mixed A JForm object on success, false on failure // set load data option
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{
// set load data option
$options['load_data'] = $loadData; $options['load_data'] = $loadData;
// check if xpath was set in options // check if xpath was set in options
$xpath = false; $xpath = false;
@ -221,29 +215,29 @@ class Hello_worldModelGreeting extends JModelAdmin
$form->setValue($redirectedField, null, $redirectedValue); $form->setValue($redirectedField, null, $redirectedValue);
} }
} }
return $form; return $form;
} }
/** /**
* Method to get the script that have to be included on the form * Method to get the script that have to be included on the form
* *
* @return string script files * @return string script files
*/ */
public function getScript() public function getScript()
{ {
return 'administrator/components/com_hello_world/models/forms/greeting.js'; return 'media/com_hello_world/js/greeting.js';
} }
/** /**
* Method to test whether a record can be deleted. * Method to test whether a record can be deleted.
* *
* @param object $record A record object. * @param object $record A record object.
* *
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
* *
* @since 1.6 * @since 1.6
*/ */
protected function canDelete($record) protected function canDelete($record)
{ {
if (!empty($record->id)) if (!empty($record->id))
{ {
@ -256,19 +250,19 @@ class Hello_worldModelGreeting extends JModelAdmin
// The record has been set. Check the record permissions. // The record has been set. Check the record permissions.
return $user->authorise('core.delete', 'com_hello_world.greeting.' . (int) $record->id); return $user->authorise('core.delete', 'com_hello_world.greeting.' . (int) $record->id);
} }
return false; return false;
} }
/** /**
* Method to test whether a record can have its state edited. * Method to test whether a record can have its state edited.
* *
* @param object $record A record object. * @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. * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
* *
* @since 1.6 * @since 1.6
*/ */
protected function canEditState($record) protected function canEditState($record)
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0; $recordId = (!empty($record->id)) ? $record->id : 0;
@ -283,103 +277,103 @@ class Hello_worldModelGreeting extends JModelAdmin
} }
} }
// In the absense of better information, revert to the component permissions. // In the absense of better information, revert to the component permissions.
return parent::canEditState($record); return parent::canEditState($record);
} }
/** /**
* Method override to check if you can edit an existing record. * Method override to check if you can edit an existing record.
* *
* @param array $data An array of input data. * @param array $data An array of input data.
* @param string $key The name of the key for the primary key. * @param string $key The name of the key for the primary key.
* *
* @return boolean * @return boolean
* @since 2.5 * @since 2.5
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// Check specific edit permission then general edit permission. // Check specific edit permission then general edit permission.
return JFactory::getUser()->authorise('core.edit', 'com_hello_world.greeting.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); return JFactory::getUser()->authorise('core.edit', 'com_hello_world.greeting.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
} }
/** /**
* Prepare and sanitise the table data prior to saving. * Prepare and sanitise the table data prior to saving.
* *
* @param JTable $table A JTable object. * @param JTable $table A JTable object.
* *
* @return void * @return void
* *
* @since 1.6 * @since 1.6
*/ */
protected function prepareTable($table) protected function prepareTable($table)
{ {
$date = JFactory::getDate(); $date = JFactory::getDate();
$user = JFactory::getUser(); $user = JFactory::getUser();
if (isset($table->name)) if (isset($table->name))
{ {
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
} }
if (isset($table->alias) && empty($table->alias)) if (isset($table->alias) && empty($table->alias))
{ {
$table->generateAlias(); $table->generateAlias();
} }
if (empty($table->id)) if (empty($table->id))
{ {
$table->created = $date->toSql(); $table->created = $date->toSql();
// set the user // set the user
if ($table->created_by == 0 || empty($table->created_by)) if ($table->created_by == 0 || empty($table->created_by))
{ {
$table->created_by = $user->id; $table->created_by = $user->id;
} }
// Set ordering to the last item if not set // Set ordering to the last item if not set
if (empty($table->ordering)) if (empty($table->ordering))
{ {
$db = JFactory::getDbo(); $db = JFactory::getDbo();
$query = $db->getQuery(true) $query = $db->getQuery(true)
->select('MAX(ordering)') ->select('MAX(ordering)')
->from($db->quoteName('#__hello_world_greeting')); ->from($db->quoteName('#__hello_world_greeting'));
$db->setQuery($query); $db->setQuery($query);
$max = $db->loadResult(); $max = $db->loadResult();
$table->ordering = $max + 1; $table->ordering = $max + 1;
} }
} }
else else
{ {
$table->modified = $date->toSql(); $table->modified = $date->toSql();
$table->modified_by = $user->id; $table->modified_by = $user->id;
} }
if (!empty($table->id)) if (!empty($table->id))
{ {
// Increment the items version number. // Increment the items version number.
$table->version++; $table->version++;
} }
} }
/** /**
* Method to get the data that should be injected in the form. * Method to get the data that should be injected in the form.
* *
* @return mixed The data for the form. * @return mixed The data for the form.
* *
* @since 1.6 * @since 1.6
*/ */
protected function loadFormData() protected function loadFormData()
{ {
// Check the session for previously entered form data. // Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_hello_world.edit.greeting.data', array()); $data = JFactory::getApplication()->getUserState('com_hello_world.edit.greeting.data', array());
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
// run the perprocess of the data // run the perprocess of the data
$this->preprocessData('com_hello_world.greeting', $data); $this->preprocessData('com_hello_world.greeting', $data);
} }
return $data; return $data;
} }
/** /**
@ -392,141 +386,141 @@ class Hello_worldModelGreeting extends JModelAdmin
protected function getUniqueFields() protected function getUniqueFields()
{ {
return false; return false;
} }
/** /**
* Method to delete one or more records. * Method to delete one or more records.
* *
* @param array &$pks An array of record primary keys. * @param array &$pks An array of record primary keys.
* *
* @return boolean True if successful, false if an error occurs. * @return boolean True if successful, false if an error occurs.
* *
* @since 12.2 * @since 12.2
*/ */
public function delete(&$pks) public function delete(&$pks)
{ {
if (!parent::delete($pks)) if (!parent::delete($pks))
{ {
return false; return false;
} }
return true; return true;
} }
/** /**
* Method to change the published state of one or more records. * Method to change the published state of one or more records.
* *
* @param array &$pks A list of the primary keys to change. * @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state. * @param integer $value The value of the published state.
* *
* @return boolean True on success. * @return boolean True on success.
* *
* @since 12.2 * @since 12.2
*/ */
public function publish(&$pks, $value = 1) public function publish(&$pks, $value = 1)
{ {
if (!parent::publish($pks, $value)) if (!parent::publish($pks, $value))
{ {
return false; return false;
} }
return true; return true;
} }
/** /**
* Method to perform batch operations on an item or a set of items. * Method to perform batch operations on an item or a set of items.
* *
* @param array $commands An array of commands to perform. * @param array $commands An array of commands to perform.
* @param array $pks An array of item ids. * @param array $pks An array of item ids.
* @param array $contexts An array of item contexts. * @param array $contexts An array of item contexts.
* *
* @return boolean Returns true on success, false on failure. * @return boolean Returns true on success, false on failure.
* *
* @since 12.2 * @since 12.2
*/ */
public function batch($commands, $pks, $contexts) public function batch($commands, $pks, $contexts)
{ {
// Sanitize ids. // Sanitize ids.
$pks = array_unique($pks); $pks = array_unique($pks);
ArrayHelper::toInteger($pks); ArrayHelper::toInteger($pks);
// Remove any values of zero. // Remove any values of zero.
if (array_search(0, $pks, true)) if (array_search(0, $pks, true))
{ {
unset($pks[array_search(0, $pks, true)]); unset($pks[array_search(0, $pks, true)]);
} }
if (empty($pks)) if (empty($pks))
{ {
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false; return false;
} }
$done = false; $done = false;
// Set some needed variables. // Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType; $this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName); $this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = Hello_worldHelper::getActions('greeting'); $this->canDo = Hello_worldHelper::getActions('greeting');
$this->batchSet = true; $this->batchSet = true;
if (!$this->canDo->get('core.batch')) if (!$this->canDo->get('core.batch'))
{ {
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false; return false;
} }
if ($this->type == false) if ($this->type == false)
{ {
$type = new JUcmType; $type = new JUcmType;
$this->type = $type->getTypeByAlias($this->typeAlias); $this->type = $type->getTypeByAlias($this->typeAlias);
} }
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
if (!empty($commands['move_copy'])) if (!empty($commands['move_copy']))
{ {
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c') if ($cmd == 'c')
{ {
$result = $this->batchCopy($commands, $pks, $contexts); $result = $this->batchCopy($commands, $pks, $contexts);
if (is_array($result)) if (is_array($result))
{ {
foreach ($result as $old => $new) foreach ($result as $old => $new)
{ {
$contexts[$new] = $contexts[$old]; $contexts[$new] = $contexts[$old];
} }
$pks = array_values($result); $pks = array_values($result);
} }
else else
{ {
return false; return false;
} }
} }
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
{ {
return false; return false;
} }
$done = true; $done = true;
} }
if (!$done) if (!$done)
{ {
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false; return false;
} }
// Clear the cache // Clear the cache
$this->cleanCache(); $this->cleanCache();
return true; return true;
} }
/** /**
@ -778,38 +772,38 @@ class Hello_worldModelGreeting extends JModelAdmin
$this->cleanCache(); $this->cleanCache();
return true; return true;
} }
/** /**
* Method to save the form data. * Method to save the form data.
* *
* @param array $data The form data. * @param array $data The form data.
* *
* @return boolean True on success. * @return boolean True on success.
* *
* @since 1.6 * @since 1.6
*/ */
public function save($data) public function save($data)
{ {
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance(); $filter = JFilterInput::getInstance();
// set the metadata to the Item Data // set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author'])) if (isset($data['metadata']) && isset($data['metadata']['author']))
{ {
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry; $metadata = new JRegistry;
$metadata->loadArray($data['metadata']); $metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata; $data['metadata'] = (string) $metadata;
} }
// Set the Params Items to data // Set the Params Items to data
if (isset($data['params']) && is_array($data['params'])) if (isset($data['params']) && is_array($data['params']))
{ {
$params = new JRegistry; $params = new JRegistry;
$params->loadArray($data['params']); $params->loadArray($data['params']);
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// Alter the unique field for save as copy // Alter the unique field for save as copy
@ -824,37 +818,37 @@ class Hello_worldModelGreeting extends JModelAdmin
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
} }
} }
} }
if (parent::save($data)) if (parent::save($data))
{ {
return true; return true;
} }
return false; return false;
} }
/** /**
* Method to generate a unique value. * Method to generate a unique value.
* *
* @param string $field name. * @param string $field name.
* @param string $value data. * @param string $value data.
* *
* @return string New value. * @return string New value.
* *
* @since 3.0 * @since 3.0
*/ */
protected function generateUnique($field,$value) protected function generateUnique($field,$value)
{ {
// set field value unique // set field value unique
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array($field => $value))) while ($table->load(array($field => $value)))
{ {
$value = StringHelper::increment($value); $value = StringHelper::increment($value);
} }
return $value; return $value;
} }
/** /**
@ -877,5 +871,5 @@ class Hello_worldModelGreeting extends JModelAdmin
} }
return $title; return $title;
} }
} }

View File

@ -1,63 +1,63 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage greetings.php @subpackage greetings.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
/** /**
* Hello_world Model for Greetings * Hello_world Model for Greetings
*/ */
class Hello_worldModelGreetings extends JModelList class Hello_worldModelGreetings extends JModelList
{ {
/** /**
* Model user data. * Model user data.
* *
* @var strings * @var strings
*/ */
protected $user; protected $user;
protected $userId; protected $userId;
protected $guest; protected $guest;
protected $groups; protected $groups;
protected $levels; protected $levels;
protected $app; protected $app;
protected $input; protected $input;
protected $uikitComp; protected $uikitComp;
/** /**
* Method to build an SQL query to load the list data. * Method to build an SQL query to load the list data.
* *
* @return string An SQL query * @return string An SQL query
*/ */
protected function getListQuery() protected function getListQuery()
{ {
// Get the current user for authorisation checks // Get the current user for authorisation checks
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->userId = $this->user->get('id'); $this->userId = $this->user->get('id');
$this->guest = $this->user->get('guest'); $this->guest = $this->user->get('guest');
$this->groups = $this->user->get('groups'); $this->groups = $this->user->get('groups');
$this->authorisedGroups = $this->user->getAuthorisedGroups(); $this->authorisedGroups = $this->user->getAuthorisedGroups();
$this->levels = $this->user->getAuthorisedViewLevels(); $this->levels = $this->user->getAuthorisedViewLevels();
$this->app = JFactory::getApplication(); $this->app = JFactory::getApplication();
$this->input = $this->app->input; $this->input = $this->app->input;
$this->initSet = true; $this->initSet = true;
// Make sure all records load, since no pagination allowed. // Make sure all records load, since no pagination allowed.
$this->setState('list.limit', 0); $this->setState('list.limit', 0);
@ -76,16 +76,16 @@ class Hello_worldModelGreetings extends JModelList
$query->where('a.published = 1'); $query->where('a.published = 1');
// return the query object // return the query object
return $query; return $query;
} }
/** /**
* Method to get an array of data items. * Method to get an array of data items.
* *
* @return mixed An array of data items on success, false on failure. * @return mixed An array of data items on success, false on failure.
*/ */
public function getItems() public function getItems()
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
// check if this user has permission to access item // check if this user has permission to access item
if (!$user->authorise('site.greetings.access', 'com_hello_world')) if (!$user->authorise('site.greetings.access', 'com_hello_world'))
@ -95,11 +95,11 @@ class Hello_worldModelGreetings extends JModelList
// redirect away to the home page if no access allowed. // redirect away to the home page if no access allowed.
$app->redirect(JURI::root()); $app->redirect(JURI::root());
return false; return false;
} }
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// Get the global params // Get the global params
$globalParams = JComponentHelper::getParams('com_hello_world', true); $globalParams = JComponentHelper::getParams('com_hello_world', true);
// Insure all item fields are adapted where needed. // Insure all item fields are adapted where needed.
@ -110,10 +110,10 @@ class Hello_worldModelGreetings extends JModelList
// Always create a slug for sef URL's // Always create a slug for sef URL's
$item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id;
} }
} }
// return items // return items
return $items; return $items;
} }
/** /**
@ -129,5 +129,5 @@ class Hello_worldModelGreetings extends JModelList
return $this->uikitComp; return $this->uikitComp;
} }
return false; return false;
} }
} }

View File

@ -1,130 +1,130 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage router.php @subpackage router.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/** /**
* Routing class from com_hello_world * Routing class from com_hello_world
* *
* @since 3.3 * @since 3.3
*/ */
class Hello_worldRouter extends JComponentRouterBase class Hello_worldRouter extends JComponentRouterBase
{ {
/** /**
* Build the route for the com_hello_world component * Build the route for the com_hello_world component
* *
* @param array &$query An array of URL arguments * @param array &$query An array of URL arguments
* *
* @return array The URL arguments to use to assemble the subsequent URL. * @return array The URL arguments to use to assemble the subsequent URL.
* *
* @since 3.3 * @since 3.3
*/ */
public function build(&$query) public function build(&$query)
{ {
$segments = array(); $segments = array();
// Get a menu item based on Itemid or currently active // Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_hello_world'); $params = JComponentHelper::getParams('com_hello_world');
if (empty($query['Itemid'])) if (empty($query['Itemid']))
{ {
$menuItem = $this->menu->getActive(); $menuItem = $this->menu->getActive();
} }
else else
{ {
$menuItem = $this->menu->getItem($query['Itemid']); $menuItem = $this->menu->getItem($query['Itemid']);
} }
$mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view']; $mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
$mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id']; $mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
if (isset($query['view'])) if (isset($query['view']))
{ {
$view = $query['view']; $view = $query['view'];
if (empty($query['Itemid'])) if (empty($query['Itemid']) && !(isset($view) && isset($query['id']) && ($view === 'greeting' || $view === 'greet' || $view === 'greetings')))
{ {
$segments[] = $query['view']; $segments[] = $query['view'];
} }
unset($query['view']); unset($query['view']);
} }
// Are we dealing with a item that is attached to a menu item? // 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'])) if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id']))
{ {
unset($query['view']); unset($query['view']);
unset($query['catid']); unset($query['catid']);
unset($query['id']); unset($query['id']);
return $segments; return $segments;
} }
if (isset($view) && isset($query['id']) && ($view === 'greeting' || $view === 'greet' || $view === 'greetings')) if (isset($view) && isset($query['id']) && ($view === 'greeting' || $view === 'greet' || $view === 'greetings'))
{ {
if ($mId != (int) $query['id'] || $mView != $view) if ($mId != (int) $query['id'] || $mView != $view)
{ {
if (($view === 'greeting' || $view === 'greet' || $view === 'greetings')) if (($view === 'greeting' || $view === 'greet' || $view === 'greetings'))
{ {
$segments[] = $view; $segments[] = $view;
$id = explode(':', $query['id']); $id = explode(':', $query['id']);
if (count($id) == 2) if (count($id) == 2)
{ {
$segments[] = $id[1]; $segments[] = $id[1];
} }
else else
{ {
$segments[] = $id[0]; $segments[] = $id[0];
} }
} }
} }
unset($query['id']); unset($query['id']);
} }
$total = count($segments); $total = count($segments);
for ($i = 0; $i < $total; $i++) for ($i = 0; $i < $total; $i++)
{ {
$segments[$i] = str_replace(':', '-', $segments[$i]); $segments[$i] = str_replace(':', '-', $segments[$i]);
} }
return $segments; return $segments;
} }
/** /**
* Parse the segments of a URL. * Parse the segments of a URL.
* *
* @param array &$segments The segments of the URL to parse. * @param array &$segments The segments of the URL to parse.
* *
* @return array The URL attributes to be used by the application. * @return array The URL attributes to be used by the application.
* *
* @since 3.3 * @since 3.3
*/ */
public function parse(&$segments) public function parse(&$segments)
{ {
$count = count($segments); $count = count($segments);
$vars = array(); $vars = array();
//Handle View and Identifier // Handle View and Identifier
switch($segments[0]) switch($segments[0])
{ {
case 'greeting': case 'greeting':
$vars['view'] = 'greeting'; $vars['view'] = 'greeting';
@ -162,98 +162,98 @@ class Hello_worldRouter extends JComponentRouterBase
$vars['id'] = $id; $vars['id'] = $id;
} }
} }
break; break;
} }
return $vars; return $vars;
} }
protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = 'hello_world') protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = 'hello_world')
{ {
if(!$where || !$what || !$whereString) if(!$where || !$what || !$whereString)
{ {
return false; return false;
} }
// Get a db connection. // Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// Create a new query object. // Create a new query object.
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select($db->quoteName(array($what))); $query->select($db->quoteName(array($what)));
if ('categories' == $table || 'category' == $table || $category) if ('categories' == $table || 'category' == $table || $category)
{ {
$getTable = '#__categories'; $getTable = '#__categories';
$query->from($db->quoteName($getTable)); $query->from($db->quoteName($getTable));
// we need this to target the components categories (TODO will keep an eye on this) // 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 . '%')); $query->where($db->quoteName('extension') . ' LIKE '. $db->quote((string)'com_' . $main . '%'));
} }
else else
{ {
// we must check if the table exist (TODO not ideal) // we must check if the table exist (TODO not ideal)
$tables = $db->getTableList(); $tables = $db->getTableList();
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$prefix = $app->get('dbprefix'); $prefix = $app->get('dbprefix');
$check = $prefix.$main.'_'.$table; $check = $prefix.$main.'_'.$table;
if (in_array($check, $tables)) if (in_array($check, $tables))
{ {
$getTable = '#__'.$main.'_'.$table; $getTable = '#__'.$main.'_'.$table;
$query->from($db->quoteName($getTable)); $query->from($db->quoteName($getTable));
} }
else else
{ {
return false; return false;
} }
} }
if (is_numeric($where)) if (is_numeric($where))
{ {
return false; return false;
} }
elseif ($this->checkString($where)) elseif ($this->checkString($where))
{ {
// we must first check if this table has the column // we must first check if this table has the column
$columns = $db->getTableColumns($getTable); $columns = $db->getTableColumns($getTable);
if (isset($columns[$whereString])) if (isset($columns[$whereString]))
{ {
$query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where));
} }
else else
{ {
return false; return false;
} }
} }
else else
{ {
return false; return false;
} }
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
return $db->loadResult(); return $db->loadResult();
} }
return false; return false;
} }
protected function checkString($string) protected function checkString($string)
{ {
if (isset($string) && is_string($string) && strlen($string) > 0) if (isset($string) && is_string($string) && strlen($string) > 0)
{ {
return true; return true;
} }
return false; return false;
} }
} }
function Hello_worldBuildRoute(&$query) function Hello_worldBuildRoute(&$query)
{ {
$router = new Hello_worldRouter; $router = new Hello_worldRouter;
return $router->build($query); return $router->build($query);
} }
function Hello_worldParseRoute($segments) function Hello_worldParseRoute($segments)
{ {
$router = new Hello_worldRouter; $router = new Hello_worldRouter;
return $router->parse($segments); return $router->parse($segments);
} }

View File

@ -1,27 +1,27 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default.php @subpackage default.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<?php echo $this->toolbar->render(); ?> <?php echo $this->toolbar->render(); ?>
<h2><?php echo $this->item->greeting; ?></h2> <h2><?php echo $this->item->greeting; ?></h2>

View File

@ -1,39 +1,39 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/** /**
* Hello_world View class for the Greet * Hello_world View class for the Greet
*/ */
class Hello_worldViewGreet extends JViewLegacy class Hello_worldViewGreet extends JViewLegacy
{ {
// Overwriting JView display method // Overwriting JView display method
function display($tpl = null) function display($tpl = null)
{ {
// get combined params of both component and menu // get combined params of both component and menu
$this->app = JFactory::getApplication(); $this->app = JFactory::getApplication();
$this->params = $this->app->getParams(); $this->params = $this->app->getParams();
$this->menu = $this->app->getMenu()->getActive(); $this->menu = $this->app->getMenu()->getActive();
// get the user object // get the user object
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Initialise variables. // Initialise variables.
$this->item = $this->get('Item'); $this->item = $this->get('Item');
@ -50,13 +50,13 @@ class Hello_worldViewGreet extends JViewLegacy
throw new Exception(implode(PHP_EOL, $errors), 500); throw new Exception(implode(PHP_EOL, $errors), 500);
} }
parent::display($tpl); parent::display($tpl);
} }
/** /**
* Prepares the document * Prepares the document
*/ */
protected function _prepareDocument() protected function _prepareDocument()
{ {
// always make sure jquery is loaded. // always make sure jquery is loaded.
@ -126,37 +126,37 @@ class Hello_worldViewGreet extends JViewLegacy
$this->document->setMetadata($k, $v); $this->document->setMetadata($k, $v);
} }
} }
} }
// add the document default css file // add the document default css file
$this->document->addStyleSheet(JURI::root(true) .'/components/com_hello_world/assets/css/greet.css', (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); $this->document->addStyleSheet(JURI::root(true) .'/components/com_hello_world/assets/css/greet.css', (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
} }
/** /**
* Setting the toolbar * Setting the toolbar
*/ */
protected function addToolBar() protected function addToolBar()
{ {
// set help url for this view if found // set help url for this view if found
$help_url = Hello_worldHelper::getHelpUrl('greet'); $this->help_url = Hello_worldHelper::getHelpUrl('greet');
if (Hello_worldHelper::checkString($help_url)) if (Hello_worldHelper::checkString($this->help_url))
{ {
JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $help_url); JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $this->help_url);
} }
// now initiate the toolbar // now initiate the toolbar
$this->toolbar = JToolbar::getInstance(); $this->toolbar = JToolbar::getInstance();
} }
/** /**
* Escapes a value for output in a view script. * Escapes a value for output in a view script.
* *
* @param mixed $var The output to escape. * @param mixed $var The output to escape.
* *
* @return mixed The escaped value. * @return mixed The escaped value.
*/ */
public function escape($var, $sorten = false, $length = 40) public function escape($var, $sorten = false, $length = 40)
{ {
// use the helper htmlEscape method instead. // use the helper htmlEscape method instead.
return Hello_worldHelper::htmlEscape($var, $this->_charset, $sorten, $length); return Hello_worldHelper::htmlEscape($var, $this->_charset, $sorten, $length);
} }
} }

View File

@ -1,34 +1,34 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage submitbutton.js @subpackage submitbutton.js
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
Joomla.submitbutton = function(task) Joomla.submitbutton = function(task)
{ {
if (task == ''){ if (task == ''){
return false; return false;
} else { } else {
var action = task.split('.'); var action = task.split('.');
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
Joomla.submitform(task, document.getElementById("adminForm")); Joomla.submitform(task, document.getElementById("adminForm"));
return true; return true;
} else { } else {
alert(Joomla.JText._('greeting, some values are not acceptable.','Some values are unacceptable')); alert(Joomla.JText._('greeting, some values are not acceptable.','Some values are unacceptable'));
return false; return false;
} }
} }
} }

View File

@ -1,37 +1,34 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage edit.php @subpackage edit.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidator');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive'); JHtml::_('behavior.keepalive');
JHtml::_('behavior.tabstate'); ?>
JHtml::_('behavior.calendar'); <div class="hello_world-greeting">
?> <?php echo $this->toolbar->render(); ?>
<div class="hello_world-greeting"> <form action="<?php echo JRoute::_('index.php?option=com_hello_world&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<?php echo $this->toolbar->render(); ?>
<form action="<?php echo JRoute::_('index.php?option=com_hello_world&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div class="form-horizontal"> <div class="form-horizontal">
@ -87,6 +84,6 @@ JHtml::_('behavior.calendar');
<input type="hidden" name="task" value="greeting.edit" /> <input type="hidden" name="task" value="greeting.edit" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</div> </div>
</div> </div>
</form> </form>
</div> </div>

View File

@ -1,91 +1,91 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/** /**
* Greeting View class * Greeting View class
*/ */
class Hello_worldViewGreeting extends JViewLegacy class Hello_worldViewGreeting extends JViewLegacy
{ {
/** /**
* display method of View * display method of View
* @return void * @return void
*/ */
public function display($tpl = null) public function display($tpl = null)
{ {
// set params // set params
$this->params = JComponentHelper::getParams('com_hello_world'); $this->params = JComponentHelper::getParams('com_hello_world');
// Assign the variables // Assign the variables
$this->form = $this->get('Form'); $this->form = $this->get('Form');
$this->item = $this->get('Item'); $this->item = $this->get('Item');
$this->script = $this->get('Script'); $this->script = $this->get('Script');
$this->state = $this->get('State'); $this->state = $this->get('State');
// get action permissions // get action permissions
$this->canDo = Hello_worldHelper::getActions('greeting', $this->item); $this->canDo = Hello_worldHelper::getActions('greeting', $this->item);
// get input // get input
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word'); $this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int'); $this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64'); $return = $jinput->get('return', null, 'base64');
// set the referral string // set the referral string
$this->referral = ''; $this->referral = '';
if ($this->refid && $this->ref) if ($this->refid && $this->ref)
{ {
// return to the item that referred to this item // return to the item that referred to this item
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
} }
elseif($this->ref) elseif($this->ref)
{ {
// return to the list view that referred to this item // return to the list view that referred to this item
$this->referral = '&ref=' . (string)$this->ref; $this->referral = '&ref=' . (string)$this->ref;
} }
// check return value // check return value
if (!is_null($return)) if (!is_null($return))
{ {
// add the return value // add the return value
$this->referral .= '&return=' . (string)$return; $this->referral .= '&return=' . (string)$return;
} }
// Set the toolbar // Set the toolbar
$this->addToolBar(); $this->addToolBar();
// Check for errors. // Check for errors.
if (count($errors = $this->get('Errors'))) if (count($errors = $this->get('Errors')))
{ {
throw new Exception(implode("\n", $errors), 500); throw new Exception(implode("\n", $errors), 500);
} }
// Display the template // Display the template
parent::display($tpl); parent::display($tpl);
// Set the document // Set the document
$this->setDocument(); $this->setDocument();
} }
/** /**
* Setting the toolbar * Setting the toolbar
*/ */
protected function addToolBar() protected function addToolBar()
{JFactory::getApplication()->input->set('hidemainmenu', true); {JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser(); $user = JFactory::getUser();
$userId = $user->id; $userId = $user->id;
@ -157,61 +157,61 @@ class Hello_worldViewGreeting extends JViewLegacy
} }
JToolbarHelper::divider(); JToolbarHelper::divider();
// set help url for this view if found // set help url for this view if found
$help_url = Hello_worldHelper::getHelpUrl('greeting'); $this->help_url = Hello_worldHelper::getHelpUrl('greeting');
if (Hello_worldHelper::checkString($help_url)) if (Hello_worldHelper::checkString($this->help_url))
{ {
JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $help_url); JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $this->help_url);
} }
// now initiate the toolbar // now initiate the toolbar
$this->toolbar = JToolbar::getInstance(); $this->toolbar = JToolbar::getInstance();
} }
/** /**
* Escapes a value for output in a view script. * Escapes a value for output in a view script.
* *
* @param mixed $var The output to escape. * @param mixed $var The output to escape.
* *
* @return mixed The escaped value. * @return mixed The escaped value.
*/ */
public function escape($var) public function escape($var)
{ {
if(strlen($var) > 30) if(strlen($var) > 30)
{ {
// use the helper htmlEscape method instead and shorten the string // use the helper htmlEscape method instead and shorten the string
return Hello_worldHelper::htmlEscape($var, $this->_charset, true, 30); return Hello_worldHelper::htmlEscape($var, $this->_charset, true, 30);
} }
// use the helper htmlEscape method instead. // use the helper htmlEscape method instead.
return Hello_worldHelper::htmlEscape($var, $this->_charset); return Hello_worldHelper::htmlEscape($var, $this->_charset);
} }
/** /**
* Method to set up the document properties * Method to set up the document properties
* *
* @return void * @return void
*/ */
protected function setDocument() protected function setDocument()
{ {
$isNew = ($this->item->id < 1); $isNew = ($this->item->id < 1);
if (!isset($this->document)) if (!isset($this->document))
{ {
$this->document = JFactory::getDocument(); $this->document = JFactory::getDocument();
} }
$this->document->setTitle(JText::_($isNew ? 'COM_HELLO_WORLD_GREETING_NEW' : 'COM_HELLO_WORLD_GREETING_EDIT')); $this->document->setTitle(JText::_($isNew ? 'COM_HELLO_WORLD_GREETING_NEW' : 'COM_HELLO_WORLD_GREETING_EDIT'));
// only add the ISIS template css & js if needed (default is 1 = true) // only add the ISIS template css & js if needed (default is 1 = true)
// you can override this in the global component options // you can override this in the global component options
// just add a (radio yes/no field) with a name called add_isis_template // just add a (radio yes/no field) with a name called add_isis_template
// to your components config area // to your components config area
if ($this->params->get('add_isis_template', 1)) if ($this->params->get('add_isis_template', 1))
{ {
// we need this to fix the form display (TODO) // we need this to fix the form display (TODO)
$this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); $this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
} }
// the default style of this view // the default style of this view
$this->document->addStyleSheet(JURI::root()."components/com_hello_world/assets/css/greeting.css", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); $this->document->addStyleSheet(JURI::root()."components/com_hello_world/assets/css/greeting.css", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
// default javascript of this view // default javascript of this view
$this->document->addScript(JURI::root(). $this->script, (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root(). $this->script, (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root(). "components/com_hello_world/views/greeting/submitbutton.js", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root(). "components/com_hello_world/views/greeting/submitbutton.js", (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -1,33 +1,33 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage default.php @subpackage default.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_hello_world&view=greetings&task=greeting.edit";
?> $edit = "index.php?option=com_hello_world&view=greetings&task=greeting.edit";
?>
<?php echo $this->toolbar->render(); ?> <?php echo $this->toolbar->render(); ?>
<ul class="uk-list uk-list-striped"> <ul class="uk-list uk-list-striped">
<?php foreach ($this->items as $item): ?> <?php foreach ($this->items as $item): ?>
<li><?php echo JText::_('COM_HELLO_WORLD_GREETING'); ?>: <a href="<?php echo JRoute::_(Hello_worldHelperRoute::getGreetRoute($item->slug)); ?>"><?php echo $item->greeting; ?></a> <a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo JText::_('COM_HELLO_WORLD_EDIT'); ?></a></li> <li><?php echo JText::_('COM_HELLO_WORLD_GREETING'); ?>: <a href="<?php echo JRoute::_(Hello_worldHelperRoute::getGreetRoute($item->slug)); ?>"><?php echo $item->greeting; ?></a> <a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo JText::_('COM_HELLO_WORLD_EDIT'); ?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>

View File

@ -1,39 +1,39 @@
<?php <?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/ /*----------------------------------------------------------------------------------| www.vdm.io |----/
VDM VDM
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.1 @version 1.0.1
@build 4th January, 2021 @build 3rd March, 2022
@created 20th September, 2017 @created 20th September, 2017
@package Hello World @package Hello World
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn <https://www.vdm.io> @author Llewellyn <https://www.vdm.io>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/ /------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
/** /**
* Hello_world View class for the Greetings * Hello_world View class for the Greetings
*/ */
class Hello_worldViewGreetings extends JViewLegacy class Hello_worldViewGreetings extends JViewLegacy
{ {
// Overwriting JView display method // Overwriting JView display method
function display($tpl = null) function display($tpl = null)
{ {
// get combined params of both component and menu // get combined params of both component and menu
$this->app = JFactory::getApplication(); $this->app = JFactory::getApplication();
$this->params = $this->app->getParams(); $this->params = $this->app->getParams();
$this->menu = $this->app->getMenu()->getActive(); $this->menu = $this->app->getMenu()->getActive();
// get the user object // get the user object
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Initialise variables. // Initialise variables.
$this->items = $this->get('Items'); $this->items = $this->get('Items');
@ -50,13 +50,13 @@ class Hello_worldViewGreetings extends JViewLegacy
throw new Exception(implode(PHP_EOL, $errors), 500); throw new Exception(implode(PHP_EOL, $errors), 500);
} }
parent::display($tpl); parent::display($tpl);
} }
/** /**
* Prepares the document * Prepares the document
*/ */
protected function _prepareDocument() protected function _prepareDocument()
{ {
// always make sure jquery is loaded. // always make sure jquery is loaded.
@ -97,37 +97,37 @@ class Hello_worldViewGreetings extends JViewLegacy
if ($this->params->get('robots')) if ($this->params->get('robots'))
{ {
$this->document->setMetadata('robots', $this->params->get('robots')); $this->document->setMetadata('robots', $this->params->get('robots'));
} }
// add the document default css file // add the document default css file
$this->document->addStyleSheet(JURI::root(true) .'/components/com_hello_world/assets/css/greetings.css', (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); $this->document->addStyleSheet(JURI::root(true) .'/components/com_hello_world/assets/css/greetings.css', (Hello_worldHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
} }
/** /**
* Setting the toolbar * Setting the toolbar
*/ */
protected function addToolBar() protected function addToolBar()
{ {
// set help url for this view if found // set help url for this view if found
$help_url = Hello_worldHelper::getHelpUrl('greetings'); $this->help_url = Hello_worldHelper::getHelpUrl('greetings');
if (Hello_worldHelper::checkString($help_url)) if (Hello_worldHelper::checkString($this->help_url))
{ {
JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $help_url); JToolbarHelper::help('COM_HELLO_WORLD_HELP_MANAGER', false, $this->help_url);
} }
// now initiate the toolbar // now initiate the toolbar
$this->toolbar = JToolbar::getInstance(); $this->toolbar = JToolbar::getInstance();
} }
/** /**
* Escapes a value for output in a view script. * Escapes a value for output in a view script.
* *
* @param mixed $var The output to escape. * @param mixed $var The output to escape.
* *
* @return mixed The escaped value. * @return mixed The escaped value.
*/ */
public function escape($var, $sorten = false, $length = 40) public function escape($var, $sorten = false, $length = 40)
{ {
// use the helper htmlEscape method instead. // use the helper htmlEscape method instead.
return Hello_worldHelper::htmlEscape($var, $this->_charset, $sorten, $length); return Hello_worldHelper::htmlEscape($var, $this->_charset, $sorten, $length);
} }
} }