Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
8b522f44d9 | |||
63b1bac955 | |||
3c610acb31 | |||
cfd9b33b30 | |||
952d26f1f8 | |||
b0ad2ddffc | |||
7534aed01d | |||
28198e9b9e | |||
3953df845c | |||
30e37dcfde | |||
bc9e5495d7 | |||
4d47f8292f | |||
a1ff74f157 | |||
dc1217e6d1 | |||
f2e4df6ecb | |||
a197f503a9 | |||
79ab3164a6 | |||
290a51dd5a |
14
README.md
14
README.md
@ -1,4 +1,4 @@
|
||||
# Component Builder (2.3.2)
|
||||
# Component Builder (2.3.8)
|
||||
|
||||
This is a [Joomla 3.x](http://www.joomla.org/) component.
|
||||
|
||||
@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc
|
||||
|
||||
Whether you're a seasoned [Joomla](http://www.joomla.org/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.2) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.8) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
Once installed upgrades are quick and easy via the default Joomla upgrade area.
|
||||
|
||||
@ -104,13 +104,13 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 11th February, 2017
|
||||
+ *Version*: 2.3.2
|
||||
+ *Last Build*: 27th March, 2017
|
||||
+ *Version*: 2.3.8
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
+ *Line count*: **91443**
|
||||
+ *File count*: **592**
|
||||
+ *Folder count*: **105**
|
||||
+ *Line count*: **95888**
|
||||
+ *File count*: **609**
|
||||
+ *Folder count*: **107**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Component Builder (2.3.2)
|
||||
# Component Builder (2.3.8)
|
||||
|
||||
This is a [Joomla 3.x](http://www.joomla.org/) component.
|
||||
|
||||
@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc
|
||||
|
||||
Whether you're a seasoned [Joomla](http://www.joomla.org/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.2) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.8) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
Once installed upgrades are quick and easy via the default Joomla upgrade area.
|
||||
|
||||
@ -104,13 +104,13 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 11th February, 2017
|
||||
+ *Version*: 2.3.2
|
||||
+ *Last Build*: 27th March, 2017
|
||||
+ *Version*: 2.3.8
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
+ *Line count*: **91443**
|
||||
+ *File count*: **592**
|
||||
+ *Folder count*: **105**
|
||||
+ *Line count*: **95888**
|
||||
+ *File count*: **609**
|
||||
+ *Folder count*: **107**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -101,6 +101,18 @@
|
||||
<action name="help_document.export" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT_DESC" />
|
||||
<action name="help_document.import" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT_DESC" />
|
||||
<action name="help_document.submenu" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU_DESC" />
|
||||
<action name="joomla_component.export_components" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.import_components" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_component.access" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS_DESC" />
|
||||
<action name="joomla_component.batch" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC" />
|
||||
<action name="joomla_component.dashboard_add" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD_DESC" />
|
||||
<action name="joomla_component.dashboard_list" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST_DESC" />
|
||||
<action name="joomla_component.edit.add_license" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE_DESC" />
|
||||
<action name="joomla_component.edit.license_type" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE_DESC" />
|
||||
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
|
||||
<action name="joomla_component.export" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT_DESC" />
|
||||
<action name="joomla_component.import" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT_DESC" />
|
||||
<action name="joomla_component.submenu" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC" />
|
||||
<action name="layout.access" title="COM_COMPONENTBUILDER_LAYOUTS_ACCESS" description="COM_COMPONENTBUILDER_LAYOUTS_ACCESS_DESC" />
|
||||
<action name="layout.batch" title="COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE" description="COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE_DESC" />
|
||||
<action name="layout.dashboard_add" title="COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_ADD_DESC" />
|
||||
@ -134,6 +146,11 @@
|
||||
<action name="template.import" title="COM_COMPONENTBUILDER_TEMPLATES_IMPORT" description="COM_COMPONENTBUILDER_TEMPLATES_IMPORT_DESC" />
|
||||
<action name="template.submenu" title="COM_COMPONENTBUILDER_TEMPLATES_SUBMENU" description="COM_COMPONENTBUILDER_TEMPLATES_SUBMENU_DESC" />
|
||||
</section>
|
||||
<section name="joomla_component">
|
||||
<action name="joomla_component.edit.add_license" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE_DESC" />
|
||||
<action name="joomla_component.edit.license_type" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE_DESC" />
|
||||
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="admin_view">
|
||||
<action name="core.edit" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_DESC" />
|
||||
<action name="core.edit.state" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE_DESC" />
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 95 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 108 of this MVC
|
||||
@build 24th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_view.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 95 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 108 of this MVC
|
||||
@build 24th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_views.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 11 of this MVC
|
||||
@build 2nd February, 2017
|
||||
@version @update number 47 of this MVC
|
||||
@build 21st March, 2017
|
||||
@created 1st February, 2017
|
||||
@package Component Builder
|
||||
@subpackage compiler.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st March, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_view.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st March, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_views.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 35 of this MVC
|
||||
@build 10th February, 2017
|
||||
@version @update number 81 of this MVC
|
||||
@build 1st March, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_code.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 35 of this MVC
|
||||
@build 10th February, 2017
|
||||
@version @update number 81 of this MVC
|
||||
@build 1st March, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_codes.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dashboard.css
|
||||
|
@ -9,11 +9,11 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 182 of this MVC
|
||||
@build 27th March, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage component.css
|
||||
@subpackage joomla_component.css
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
@ -9,11 +9,11 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 182 of this MVC
|
||||
@build 27th March, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage components.css
|
||||
@subpackage joomla_components.css
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 66 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 67 of this MVC
|
||||
@build 22nd February, 2017
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layout.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 66 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 67 of this MVC
|
||||
@build 22nd February, 2017
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layouts.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 48 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 51 of this MVC
|
||||
@build 6th March, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_view.css
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 48 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 51 of this MVC
|
||||
@build 6th March, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_views.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 40 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 22nd February, 2017
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage template.css
|
||||
|
@ -10,7 +10,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 40 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 22nd February, 2017
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage templates.css
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@ -146,13 +146,18 @@ abstract class ###Component###Helper
|
||||
|
||||
if (self::checkArray($where))
|
||||
{
|
||||
// prep main <-- why? well if $main='' is empty then $table can be categories or users
|
||||
if (self::checkString($main))
|
||||
{
|
||||
$main = '_'.ltrim($main, '_');
|
||||
}
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select($db->quoteName(array($what)));
|
||||
$query->from($db->quoteName('#__'.$main.'_'.$table));
|
||||
$query->from($db->quoteName('#_'.$main.'_'.$table));
|
||||
$query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
@ -681,57 +686,86 @@ abstract class ###Component###Helper
|
||||
return $string;
|
||||
}
|
||||
|
||||
public static function safeString($string, $type = 'L', $spacer = '_')
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to a thousand)
|
||||
if ($replaceNumbers === true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to millions)
|
||||
$string = self::replaceNumbers($string);
|
||||
|
||||
}
|
||||
// 0nly continue if we have a string
|
||||
if (self::checkString($string))
|
||||
{
|
||||
// create file name without the extention that is safe
|
||||
if ($type === 'filename')
|
||||
{
|
||||
// make sure VDM is not in the string
|
||||
$string = str_replace('VDM', 'vDm', $string);
|
||||
// Remove anything which isn't a word, whitespace, number
|
||||
// or any of the following caracters -_()
|
||||
// If you don't need to handle multi-byte characters
|
||||
// you can use preg_replace rather than mb_ereg_replace
|
||||
// Thanks @Łukasz Rysiak!
|
||||
$string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string);
|
||||
// http://stackoverflow.com/a/2021729/1429677
|
||||
return preg_replace('/\s+/', ' ', $string);
|
||||
}
|
||||
// remove all other characters
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
if ($type == 'W')
|
||||
{
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'w')
|
||||
{
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type == 'Ww')
|
||||
{
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'WW')
|
||||
{
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type == 'U')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type == 'F')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'L')
|
||||
// select final adaptations
|
||||
if ($type === 'L' || $type === 'strtolower')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// default is to return lower
|
||||
return strtolower($string);
|
||||
}
|
||||
|
||||
elseif ($type === 'W')
|
||||
{
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'w' || $type === 'word')
|
||||
{
|
||||
// return a string with all lowercase(no undersocre)
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type === 'Ww' || $type === 'Word')
|
||||
{
|
||||
// return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre)
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'WW' || $type === 'WORD')
|
||||
{
|
||||
// return a string with all the uppercase(no undersocre)
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type === 'U' || $type === 'strtoupper')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type === 'F' || $type === 'ucfirst')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase')
|
||||
{
|
||||
// convert all words to first letter uppercase
|
||||
$string = ucwords(strtolower($string));
|
||||
// remove white space
|
||||
$string = preg_replace('/\s+/', '', $string);
|
||||
// now return first letter lowercase
|
||||
return lcfirst($string);
|
||||
}
|
||||
// return string
|
||||
return $string;
|
||||
}
|
||||
|
35
admin/compiler/joomla_3/Helper_category.php
Normal file
35
admin/compiler/joomla_3/Helper_category.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder>
|
||||
@my wife Roline van der Merwe <http://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* ###Component### Component Category Tree
|
||||
*/
|
||||
###CATEGORY_CLASS_TREES###
|
50
admin/compiler/joomla_3/Helper_category_view.php
Normal file
50
admin/compiler/joomla_3/Helper_category_view.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder>
|
||||
@my wife Roline van der Merwe <http://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
?>
|
||||
###BOM###
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* ###Component### ###View### Component Category Tree
|
||||
*/
|
||||
class ###Component######Views###Categories extends JCategories
|
||||
{
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param array $options Array of options
|
||||
*
|
||||
*/
|
||||
public function __construct($options = array())
|
||||
{
|
||||
$options['table'] = '#__###component###_###view###';
|
||||
$options['extension'] = 'com_###component###.###views###';
|
||||
|
||||
parent::__construct($options);
|
||||
}
|
||||
}
|
@ -320,13 +320,18 @@ abstract class ###Component###Helper
|
||||
|
||||
if (self::checkArray($where))
|
||||
{
|
||||
// prep main <-- why? well if $main='' is empty then $table can be categories or users
|
||||
if (self::checkString($main))
|
||||
{
|
||||
$main = '_'.ltrim($main, '_');
|
||||
}
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select($db->quoteName(array($what)));
|
||||
$query->from($db->quoteName('#__'.$main.'_'.$table));
|
||||
$query->from($db->quoteName('#_'.$main.'_'.$table));
|
||||
$query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
@ -673,57 +678,86 @@ abstract class ###Component###Helper
|
||||
return $string;
|
||||
}
|
||||
|
||||
public static function safeString($string, $type = 'L', $spacer = '_')
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to a thousand)
|
||||
if ($replaceNumbers === true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to millions)
|
||||
$string = self::replaceNumbers($string);
|
||||
|
||||
}
|
||||
// 0nly continue if we have a string
|
||||
if (self::checkString($string))
|
||||
{
|
||||
// create file name without the extention that is safe
|
||||
if ($type === 'filename')
|
||||
{
|
||||
// make sure VDM is not in the string
|
||||
$string = str_replace('VDM', 'vDm', $string);
|
||||
// Remove anything which isn't a word, whitespace, number
|
||||
// or any of the following caracters -_()
|
||||
// If you don't need to handle multi-byte characters
|
||||
// you can use preg_replace rather than mb_ereg_replace
|
||||
// Thanks @Łukasz Rysiak!
|
||||
$string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string);
|
||||
// http://stackoverflow.com/a/2021729/1429677
|
||||
return preg_replace('/\s+/', ' ', $string);
|
||||
}
|
||||
// remove all other characters
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
if ($type == 'W')
|
||||
{
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'w')
|
||||
{
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type == 'Ww')
|
||||
{
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'WW')
|
||||
{
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type == 'U')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type == 'F')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'L')
|
||||
// select final adaptations
|
||||
if ($type === 'L' || $type === 'strtolower')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// default is to return lower
|
||||
return strtolower($string);
|
||||
}
|
||||
|
||||
elseif ($type === 'W')
|
||||
{
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'w' || $type === 'word')
|
||||
{
|
||||
// return a string with all lowercase(no undersocre)
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type === 'Ww' || $type === 'Word')
|
||||
{
|
||||
// return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre)
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'WW' || $type === 'WORD')
|
||||
{
|
||||
// return a string with all the uppercase(no undersocre)
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type === 'U' || $type === 'strtoupper')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type === 'F' || $type === 'ucfirst')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase')
|
||||
{
|
||||
// convert all words to first letter uppercase
|
||||
$string = ucwords(strtolower($string));
|
||||
// remove white space
|
||||
$string = preg_replace('/\s+/', '', $string);
|
||||
// now return first letter lowercase
|
||||
return lcfirst($string);
|
||||
}
|
||||
// return string
|
||||
return $string;
|
||||
}
|
||||
|
@ -47,5 +47,5 @@ class ###Component###Controller###Views### extends JControllerAdmin
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
|
||||
return $model;
|
||||
}###CONTROLLEREXIMPORTMETHOD### ###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER###
|
||||
}###CONTROLLEREXIMPORTMETHOD### ###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER### ###ADMIN_CUSTOM_BUTTONS_CONTROLLER_LIST###
|
||||
}
|
||||
|
@ -34,6 +34,11 @@ defined('_JEXEC') or die('Restricted access');
|
||||
*/
|
||||
class ###Component###ModelImport extends JModelLegacy
|
||||
{
|
||||
// set uploading values
|
||||
protected $use_streams = false;
|
||||
protected $allow_unsafe = false;
|
||||
protected $safeFileOptions = array();
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
@ -75,10 +80,6 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
// Recall the 'Import from Directory' path.
|
||||
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
|
||||
$this->setState('import.directory', $path);
|
||||
// set uploading values
|
||||
$this->use_streams = false;
|
||||
$this->allow_unsafe = false;
|
||||
$this->safeFileOptions = array();
|
||||
parent::populateState();
|
||||
}
|
||||
|
||||
@ -285,16 +286,11 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
}
|
||||
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($p_dir, PATHINFO_EXTENSION))){
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!$this->checkExtension($p_dir))
|
||||
{
|
||||
// set error message
|
||||
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
$package['packagename'] = null;
|
||||
@ -357,18 +353,12 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
$archivename = JPath::clean($archivename);
|
||||
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($archivename, PATHINFO_EXTENSION))){
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!$this->checkExtension($archivename))
|
||||
{
|
||||
// Cleanup the import files
|
||||
$this->remove($archivename);
|
||||
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
$config = JFactory::getConfig();
|
||||
@ -384,6 +374,28 @@ class ###Component###ModelImport extends JModelLegacy
|
||||
return $check;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the extension
|
||||
*
|
||||
* @param string $file Name of the uploaded file
|
||||
*
|
||||
* @return boolean True on success
|
||||
*
|
||||
*/
|
||||
protected function checkExtension($file)
|
||||
{
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($file, PATHINFO_EXTENSION)))
|
||||
{
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up temporary uploaded spreadsheet
|
||||
*
|
||||
|
@ -34,6 +34,11 @@ defined('_JEXEC') or die('Restricted access');
|
||||
*/
|
||||
class ###Component###Model###View### extends JModelLegacy
|
||||
{
|
||||
// set uploading values
|
||||
protected $use_streams = false;
|
||||
protected $allow_unsafe = false;
|
||||
protected $safeFileOptions = array();
|
||||
|
||||
/**
|
||||
* @var object JTable object
|
||||
*/
|
||||
@ -75,10 +80,6 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
// Recall the 'Import from Directory' path.
|
||||
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
|
||||
$this->setState('import.directory', $path);
|
||||
// set uploading values
|
||||
$this->use_streams = false;
|
||||
$this->allow_unsafe = false;
|
||||
$this->safeFileOptions = array();
|
||||
parent::populateState();
|
||||
}
|
||||
###IMPORT_METHOD_CUSTOM###
|
||||
@ -175,16 +176,11 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
}
|
||||
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($p_dir, PATHINFO_EXTENSION))){
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!$this->checkExtension($p_dir))
|
||||
{
|
||||
// set error message
|
||||
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
$package['packagename'] = null;
|
||||
@ -247,18 +243,12 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
$archivename = JPath::clean($archivename);
|
||||
|
||||
// check the extention
|
||||
switch(strtolower(pathinfo($archivename, PATHINFO_EXTENSION))){
|
||||
case 'xls':
|
||||
case 'ods':
|
||||
case 'csv':
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!$this->checkExtension($archivename))
|
||||
{
|
||||
// Cleanup the import files
|
||||
$this->remove($archivename);
|
||||
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
$config = JFactory::getConfig();
|
||||
@ -273,6 +263,7 @@ class ###Component###Model###View### extends JModelLegacy
|
||||
|
||||
return $check;
|
||||
}
|
||||
###IMPORT_EXT_METHOD_CUSTOM###
|
||||
|
||||
/**
|
||||
* Clean up temporary uploaded spreadsheet
|
||||
|
@ -47,7 +47,7 @@ class ###Component###Model###Views### extends JModelList
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
}###ADMIN_CUSTOM_BUTTONS_METHOD_LIST###
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
|
@ -52,7 +52,8 @@ class ###Component###ViewImport extends JViewLegacy
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors'))){
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode('<br />', $errors));
|
||||
return false;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}###CUSTOM_ADMIN_DYNAMIC_BUTTONS###
|
||||
}###CUSTOM_ADMIN_DYNAMIC_BUTTONS### ###ADMIN_CUSTOM_BUTTONS_LIST###
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
|
@ -1,6 +1,11 @@
|
||||
###INSTALL###
|
||||
|
||||
--
|
||||
-- Always insure this column is large enough for all the access control values.
|
||||
-- Always insure this column rules is large enough for all the access control values.
|
||||
--
|
||||
ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control.';
|
||||
|
||||
--
|
||||
-- Always insure this column name is large enough for long component and view names.
|
||||
--
|
||||
ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.';
|
||||
|
@ -157,6 +157,13 @@
|
||||
"rename": "Helper_site",
|
||||
"type": "file"
|
||||
},
|
||||
"Helper_category.php": {
|
||||
"naam":"Helper_category.php",
|
||||
"path": "c0mp0n3nt/site/helpers",
|
||||
"rename": "new",
|
||||
"newName": "category.php",
|
||||
"type": "file"
|
||||
},
|
||||
"script.php": {
|
||||
"naam":"script.php",
|
||||
"path": "c0mp0n3nt/",
|
||||
@ -677,6 +684,11 @@
|
||||
"rename": "new",
|
||||
"newName": "submitbutton.js",
|
||||
"type": "custom_form"
|
||||
},
|
||||
"Helper_category_view.php": {
|
||||
"path": "c0mp0n3nt/site/helpers",
|
||||
"rename": "Helper_category_view",
|
||||
"type": "category"
|
||||
}
|
||||
},
|
||||
"custom_admin": {
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage controller.php
|
||||
@ -88,7 +88,7 @@ class ComponentbuilderController extends JControllerLegacy
|
||||
if (ComponentbuilderHelper::checkString($view))
|
||||
{
|
||||
$views = array(
|
||||
'component' => 'components',
|
||||
'joomla_component' => 'joomla_components',
|
||||
'admin_view' => 'admin_views',
|
||||
'custom_admin_view' => 'custom_admin_views',
|
||||
'site_view' => 'site_views',
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 95 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 108 of this MVC
|
||||
@build 24th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_view.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 95 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 108 of this MVC
|
||||
@build 24th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_views.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ajax.json.php
|
||||
@ -44,6 +44,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
// load the tasks
|
||||
$this->registerTask('isNew', 'ajax');
|
||||
$this->registerTask('isRead', 'ajax');
|
||||
$this->registerTask('getComponentDetails', 'ajax');
|
||||
$this->registerTask('tableColumns', 'ajax');
|
||||
$this->registerTask('fieldSelectOptions', 'ajax');
|
||||
$this->registerTask('getImportScripts', 'ajax');
|
||||
@ -54,6 +55,8 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
$this->registerTask('dynamicFormDetails', 'ajax');
|
||||
$this->registerTask('dbTableColumns', 'ajax');
|
||||
$this->registerTask('viewTableColumns', 'ajax');
|
||||
$this->registerTask('checkFunctionName', 'ajax');
|
||||
$this->registerTask('usedin', 'ajax');
|
||||
$this->registerTask('fieldOptions', 'ajax');
|
||||
}
|
||||
|
||||
@ -145,6 +148,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'getComponentDetails':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$idValue = $jinput->get('id', NULL, 'INT');
|
||||
if($idValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->getComponentDetails($idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'tableColumns':
|
||||
try
|
||||
{
|
||||
@ -530,6 +571,85 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'checkFunctionName':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$functioNameValue = $jinput->get('functioName', NULL, 'STRING');
|
||||
$idValue = $jinput->get('id', NULL, 'INT');
|
||||
if($functioNameValue && $idValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->checkFunctionName($functioNameValue, $idValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'usedin':
|
||||
try
|
||||
{
|
||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||
$functioNameValue = $jinput->get('functioName', NULL, 'WORD');
|
||||
$idValue = $jinput->get('id', NULL, 'INT');
|
||||
$targetValue = $jinput->get('target', NULL, 'WORD');
|
||||
if($functioNameValue && $idValue && $targetValue && $user->id != 0)
|
||||
{
|
||||
$result = $this->getModel('ajax')->usedin($functioNameValue, $idValue, $targetValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
}
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback . "(".json_encode($result).");";
|
||||
}
|
||||
elseif($returnRaw)
|
||||
{
|
||||
echo json_encode($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($result).");";
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
echo $callback."(".json_encode($e).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "(".json_encode($e).");";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'fieldOptions':
|
||||
try
|
||||
{
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 11 of this MVC
|
||||
@build 2nd February, 2017
|
||||
@version @update number 47 of this MVC
|
||||
@build 21st March, 2017
|
||||
@created 1st February, 2017
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
@ -71,10 +71,12 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
|
||||
$version = $jinput->post->get('version', 0, 'INT');
|
||||
$addBackup = $jinput->post->get('backup', 0, 'INT');
|
||||
$addGit = $jinput->post->get('git', 0, 'INT');
|
||||
$addPlaceholders = $jinput->post->get('placeholders', 2, 'INT');
|
||||
$debugLinenr = $jinput->post->get('debuglinenr', 2, 'INT');
|
||||
// include component compiler
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php';
|
||||
$model = $this->getModel('compiler');
|
||||
if ($model->builder($version,$componentId,$addBackup,$addGit))
|
||||
if ($model->builder($version,$componentId,$addBackup,$addGit,$addPlaceholders,$debugLinenr))
|
||||
{
|
||||
$cache = JFactory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
@ -91,61 +93,37 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
|
||||
if (empty($redirect_url) && $componentId > 0)
|
||||
{
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
// setup the unrealistic numbers
|
||||
$counter = $model->getCount();
|
||||
$folders = $counter['folders'] * 5;
|
||||
$files = $counter['files'] * 5;
|
||||
$lines = $counter['lines'] * 10;
|
||||
$seconds = $folders + $files + $lines;
|
||||
$totalHours = round($seconds / 3600);
|
||||
$totalDays = round($totalHours / 8);
|
||||
// setup the more realistic numbers
|
||||
$debugging = $seconds / 4;
|
||||
$planning = $seconds / 7;
|
||||
$mapping = $seconds / 10;
|
||||
$office = $seconds / 6;
|
||||
$seconds = $folders + $files + $lines + $debugging + $planning + $mapping + $office;
|
||||
$actualTotalHours = round($seconds / 3600);
|
||||
$actualTotalDays = round($actualTotalHours / 8);
|
||||
$debuggingHours = round($debugging / 3600);
|
||||
$planningHours = round($planning / 3600);
|
||||
$mappingHours = round($mapping / 3600);
|
||||
$officeHours = round($office / 3600);
|
||||
// the actual time spent
|
||||
$actualHoursSpent = $actualTotalHours - $totalHours;
|
||||
$actualDaysSpent = $actualTotalDays - $totalDays;
|
||||
// calculate the projects actual time frame of completion
|
||||
$projectWeekTime = round($actualTotalDays / 5,1);
|
||||
$projectMonthTime = round($actualTotalDays / 24,1);
|
||||
if (($pos = strpos($counter['filePath'], "/tmp/")) !== FALSE)
|
||||
if (($pos = strpos($model->compiler->filepath, "/tmp/")) !== FALSE)
|
||||
{
|
||||
$url = JURI::root() . substr($counter['filePath'], $pos + 1);
|
||||
$url = JURI::root() . substr($model->compiler->filepath, $pos + 1);
|
||||
}
|
||||
// Message of successful build
|
||||
$message = '<h1>The ('.$counter['filename'].') Was Successfully Compiled!</h1>';
|
||||
$message = '<h1>The ('.$model->compiler->componentFolderName.') Was Successfully Compiled!</h1>';
|
||||
$message .= '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installExtention\')">';
|
||||
$message .= 'Install '.$counter['filename'].' on this <span class="icon-joomla icon-white"></span>Joomla website.</button></p>';
|
||||
$message .= 'Install '.$model->compiler->componentFolderName.' on this <span class="icon-joomla icon-white"></span>Joomla website.</button></p>';
|
||||
$message .= '<h2>Total time saved</h2>';
|
||||
$message .= '<ul>';
|
||||
$message .= '<li>Total folders created: <b>'.$counter['folders'].'</b></li>';
|
||||
$message .= '<li>Total files created: <b>'.$counter['files'].'</b></li>';
|
||||
$message .= '<li>Total lines written: <b>'.$counter['lines'].'</b></li>';
|
||||
$message .= '<li>Total folders created: <b>'.$model->compiler->folderCount.'</b></li>';
|
||||
$message .= '<li>Total files created: <b>'.$model->compiler->fileCount.'</b></li>';
|
||||
$message .= '<li>Total lines written: <b>'.$model->compiler->lineCount.'</b></li>';
|
||||
$message .= '<li>A4 Book of: <b>'.$model->compiler->pageCount.' pages</b></li>';
|
||||
$message .= '</ul>';
|
||||
$message .= '<p><b>'.$totalHours.' Hours</b> or <b>'.$totalDays.' Eight Hour Days</b> <em>(actual time you saved)</em><br />';
|
||||
$message .= '<p><b>'.$model->compiler->totalHours.' Hours</b> or <b>'.$model->compiler->totalDays.' Eight Hour Days</b> <em>(actual time you saved)</em><br />';
|
||||
$message .= '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, never making one mistake or taking any coffee break.)</small><br />';
|
||||
$message .= '<b>'.$actualHoursSpent.' Hours</b> or <b>'.$actualDaysSpent.' Eight Hour Days</b> <em>(the actual time you spent)</em><br />';
|
||||
$message .= '<small>(with the following break down: <b>debugging @'.$debuggingHours.'hours</b> = codingtime / 4; <b>planning @'.$planningHours.'hours</b> = codingtime / 7; <b>mapping @'.$mappingHours.'hours</b> = codingtime / 10; <b>office @'.$officeHours.'hours</b> = codingtime / 6;)</small></p>';
|
||||
$message .= '<p><b>'.$actualTotalHours.' Hours</b> or <b>'.$actualTotalDays.' Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
|
||||
$message .= '<b>'.$model->compiler->actualHoursSpent.' Hours</b> or <b>'.$model->compiler->actualDaysSpent.' Eight Hour Days</b> <em>(the actual time you spent)</em><br />';
|
||||
$message .= '<small>(with the following break down: <b>debugging @'.$model->compiler->debuggingHours.'hours</b> = codingtime / 4; <b>planning @'.$model->compiler->planningHours.'hours</b> = codingtime / 7; <b>mapping @'.$model->compiler->mappingHours.'hours</b> = codingtime / 10; <b>office @'.$model->compiler->officeHours.'hours</b> = codingtime / 6;)</small></p>';
|
||||
$message .= '<p><b>'.$model->compiler->actualTotalHours.' Hours</b> or <b>'.$model->compiler->actualTotalDays.' Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
|
||||
$message .= '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)</small></p>';
|
||||
$message .= '<p>Project duration: <b>'.$projectWeekTime. ' weeks</b> or <b>'.$projectMonthTime.' months</b></p>';
|
||||
$message .= '<p>Project duration: <b>'.$model->compiler->projectWeekTime. ' weeks</b> or <b>'.$model->compiler->projectMonthTime.' months</b></p>';
|
||||
$message .= '<h2>Path to Zip File</h2>';
|
||||
$message .= '<p><b>Path:</b> <code>'.$counter['filePath'].'</code><br />';
|
||||
$message .= '<p><b>Path:</b> <code>'.$model->compiler->filepath.'</code><br />';
|
||||
$message .= '<b>URL:</b> <code>'.$url.'</code><br /><br />';
|
||||
$message .= '<small>Hey! you can also download the file right now!</small><br /><a class="btn btn-success" href="'.$url.'" ><span class="icon-download icon-white"></span>Download</a></p>';
|
||||
$message .= '<p><small><b>Remember!</b> This file is in your tmp folder and therefore publicly accessible untill you click [Clear tmp]!</small> </p>';
|
||||
$message .= '<p><small>Compilation took <b>'.$model->compiler->secondsCompiled.'</b> seconds to complete.</small> </p>';
|
||||
// set redirect
|
||||
$this->setRedirect($redirect_url,$message,'message');
|
||||
$app->setUserState('com_componentbuilder.extension_name', $counter['filename']);
|
||||
$app->setUserState('com_componentbuilder.extension_name', $model->compiler->componentFolderName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
|
@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage components.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controlleradmin library
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
/**
|
||||
* Components Controller
|
||||
*/
|
||||
class ComponentbuilderControllerComponents extends JControllerAdmin
|
||||
{
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS';
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
* @since 2.5
|
||||
*/
|
||||
public function getModel($name = 'Component', $prefix = 'ComponentbuilderModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('component.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
JArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Components');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (ComponentbuilderHelper::checkArray($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = JFactory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Components_'.$date->format('jS_F_Y'),'Components exported ('.$date->format('jS F, Y').')','components');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Components');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ComponentbuilderHelper::checkObject($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = JFactory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('component_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'components');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'component');
|
||||
// Redirect to import view.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_COMPONENTS');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st March, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_view.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 1st March, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_views.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 35 of this MVC
|
||||
@build 10th February, 2017
|
||||
@version @update number 81 of this MVC
|
||||
@build 1st March, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_code.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 35 of this MVC
|
||||
@build 10th February, 2017
|
||||
@version @update number 81 of this MVC
|
||||
@build 1st March, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_codes.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage help.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage import.php
|
||||
|
67
admin/controllers/import_joomla_components.php
Normal file
67
admin/controllers/import_joomla_components.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage import_joomla_components.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Componentbuilder Import_joomla_components Controller
|
||||
*/
|
||||
class ComponentbuilderControllerImport_joomla_components extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Import an spreadsheet.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('Import_joomla_components');
|
||||
if ($model->import())
|
||||
{
|
||||
$cache = JFactory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
// TODO: Reset the users acl here as well to kill off any missing bits
|
||||
}
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$redirect_url = $app->getUserState('com_componentbuilder.redirect_url');
|
||||
if (empty($redirect_url))
|
||||
{
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// wipe out the user state when we're going to redirect
|
||||
$app->setUserState('com_componentbuilder.redirect_url', '');
|
||||
$app->setUserState('com_componentbuilder.message', '');
|
||||
$app->setUserState('com_componentbuilder.extension_message', '');
|
||||
}
|
||||
$this->setRedirect($redirect_url);
|
||||
}
|
||||
}
|
@ -10,11 +10,11 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 81 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 182 of this MVC
|
||||
@build 27th March, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage component.php
|
||||
@subpackage joomla_component.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
@ -30,9 +30,9 @@ defined('_JEXEC') or die('Restricted access');
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
/**
|
||||
* Component Controller
|
||||
* Joomla_component Controller
|
||||
*/
|
||||
class ComponentbuilderControllerComponent extends JControllerForm
|
||||
class ComponentbuilderControllerJoomla_component extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
@ -45,7 +45,7 @@ class ComponentbuilderControllerComponent extends JControllerForm
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Components'; // safeguard for setting the return view listing to the main view.
|
||||
$this->view_list = 'Joomla_components'; // safeguard for setting the return view listing to the main view.
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
@ -59,7 +59,14 @@ class ComponentbuilderControllerComponent extends JControllerForm
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{ // In the absense of better information, revert to the component permissions.
|
||||
{
|
||||
// Access check.
|
||||
$access = JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return parent::allowAdd($data);
|
||||
}
|
||||
|
||||
@ -84,10 +91,10 @@ class ComponentbuilderControllerComponent extends JControllerForm
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('core.edit', 'com_componentbuilder.component.' . (int) $recordId);
|
||||
$permission = $user->authorise('core.edit', 'com_componentbuilder.joomla_component.' . (int) $recordId);
|
||||
if (!$permission)
|
||||
{
|
||||
if ($user->authorise('core.edit.own', 'com_componentbuilder.component.' . $recordId))
|
||||
if ($user->authorise('core.edit.own', 'com_componentbuilder.joomla_component.' . $recordId))
|
||||
{
|
||||
// Now test the owner is the user.
|
||||
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
|
||||
@ -182,10 +189,10 @@ class ComponentbuilderControllerComponent extends JControllerForm
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Component', '', array());
|
||||
$model = $this->getModel('Joomla_component', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components' . $this->getRedirectToListAppend(), false));
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
188
admin/controllers/joomla_components.php
Normal file
188
admin/controllers/joomla_components.php
Normal file
@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 182 of this MVC
|
||||
@build 27th March, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage joomla_components.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controlleradmin library
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
/**
|
||||
* Joomla_components Controller
|
||||
*/
|
||||
class ComponentbuilderControllerJoomla_components extends JControllerAdmin
|
||||
{
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_COMPONENTS';
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
* @since 2.5
|
||||
*/
|
||||
public function getModel($name = 'Joomla_component', $prefix = 'ComponentbuilderModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('joomla_component.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
JArrayHelper::toInteger($pks);
|
||||
// Get the model
|
||||
$model = $this->getModel('Joomla_components');
|
||||
// get the data to export
|
||||
$data = $model->getExportData($pks);
|
||||
if (ComponentbuilderHelper::checkArray($data))
|
||||
{
|
||||
// now set the data to the spreadsheet
|
||||
$date = JFactory::getDate();
|
||||
ComponentbuilderHelper::xls($data,'Joomla_components_'.$date->format('jS_F_Y'),'Joomla components exported ('.$date->format('jS F, Y').')','joomla components');
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public function importData()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the import model
|
||||
$model = $this->getModel('Joomla_components');
|
||||
// get the headers to import
|
||||
$headers = $model->getExImPortHeaders();
|
||||
if (ComponentbuilderHelper::checkObject($headers))
|
||||
{
|
||||
// Load headers to session.
|
||||
$session = JFactory::getSession();
|
||||
$headers = json_encode($headers);
|
||||
$session->set('joomla_component_VDM_IMPORTHEADERS', $headers);
|
||||
$session->set('backto_VDM_IMPORT', 'joomla_components');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'joomla_component');
|
||||
// Redirect to import view.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_JOOMLA_COMPONENTS');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function smartImport()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
$session = JFactory::getSession();
|
||||
$session->set('backto_VDM_IMPORT', 'joomla_components');
|
||||
$session->set('dataType_VDM_IMPORTINTO', 'smart_package');
|
||||
// Redirect to import view.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LIKE_TO_IMPORTBR_SMALLPLEASE_NOTE_THAT_SMART_COMPONENT_IMPORT_ONLY_WORKS_WITH_THE_FOLLOWING_FORMAT_BZIPBSMALL');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', false), $message);
|
||||
return;
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function smartExport()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if export is allowed for this user.
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('joomla_component.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
JArrayHelper::toInteger($pks);
|
||||
// check if there is any selections
|
||||
if (!ComponentbuilderHelper::checkArray($pks))
|
||||
{
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
// Get the model
|
||||
$model = $this->getModel('Joomla_components');
|
||||
// set auto loader
|
||||
ComponentbuilderHelper::autoLoader('smart');
|
||||
// get the data to export
|
||||
if ($model->getSmartExport($pks))
|
||||
{
|
||||
// Redirect to the list screen with success.
|
||||
$message = array();
|
||||
$message[] = '<h1>' . JText::_('COM_COMPONENTBUILDER_EXPORT_COMPLETED') . '</h1>';
|
||||
$message[] = '<p>' . JText::sprintf('COM_COMPONENTBUILDER_PATH_TO_THE_ZIPPED_PACKAGE_IS_CODESCODE', $model->zipPath) . '</p>';
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode('', $message), 'Success');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (componentbuilderHelper::checkString($model->packagePath))
|
||||
{
|
||||
// clear all if not successful
|
||||
ComponentbuilderHelper::removeFolder($model->packagePath);
|
||||
}
|
||||
if (componentbuilderHelper::checkString($model->zipPath))
|
||||
{
|
||||
// clear all if not successful
|
||||
JFile::delete($model->zipPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED_PLEASE_TRY_AGAIN_LATTER');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 66 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 67 of this MVC
|
||||
@build 22nd February, 2017
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layout.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 66 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 67 of this MVC
|
||||
@build 22nd February, 2017
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layouts.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 48 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 51 of this MVC
|
||||
@build 6th March, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_view.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 48 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@version @update number 51 of this MVC
|
||||
@build 6th March, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_views.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 40 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 22nd February, 2017
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage template.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 40 of this MVC
|
||||
@build 3rd February, 2017
|
||||
@build 22nd February, 2017
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage templates.php
|
||||
|
@ -41,6 +41,15 @@ class Compiler extends Infusion
|
||||
*/
|
||||
private $tempPath;
|
||||
|
||||
/*
|
||||
* The timer
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $time_start;
|
||||
private $time_end;
|
||||
public $secondsCompiled;
|
||||
|
||||
public $filepath = '';
|
||||
// fixed pathes
|
||||
protected $dynamicIntegration = false;
|
||||
@ -53,7 +62,8 @@ class Compiler extends Infusion
|
||||
*/
|
||||
public function __construct($config = array ())
|
||||
{
|
||||
// $time_start = microtime(true);
|
||||
// to check the compiler speed
|
||||
$this->time_start = microtime(true);
|
||||
// first we run the perent constructor
|
||||
if (parent::__construct($config))
|
||||
{
|
||||
@ -88,46 +98,29 @@ class Compiler extends Infusion
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// we can remove all undeeded data
|
||||
$this->freeMemory();
|
||||
// check if this component is install on the current website
|
||||
if ($paths = $this->getLocalInstallPaths())
|
||||
{
|
||||
// start Automatic import of custom code
|
||||
$userId = JFactory::getUser()->id;
|
||||
$today = JFactory::getDate()->toSql();
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// get the custom code from installed files
|
||||
$this->customCodeFactory($paths, $db, $userId, $today);
|
||||
}
|
||||
// now add the other custom code by placeholder
|
||||
if (ComponentbuilderHelper::checkArray($this->addCustomCodeAt))
|
||||
{
|
||||
// load error messages incase code can not be added
|
||||
$app = JFactory::getApplication();
|
||||
$this->addCustomCodeViaPlaceholders($app);
|
||||
}
|
||||
// check if we have custom code to add
|
||||
$this->getCustomCode();
|
||||
// now insert into the new files
|
||||
if (ComponentbuilderHelper::checkArray($this->customCode))
|
||||
if ($this->getCustomCode())
|
||||
{
|
||||
// load error messages incase code can not be added
|
||||
$app = JFactory::getApplication();
|
||||
$this->addCustomCode($app);
|
||||
$this->addCustomCode();
|
||||
}
|
||||
// set the lang data now
|
||||
$this->setLangFileData();
|
||||
// move the update server into place
|
||||
$this->setUpdateServer();
|
||||
// set the global counters
|
||||
$this->setCountingStuff();
|
||||
// build read me
|
||||
$this->buildReadMe();
|
||||
// zip the component
|
||||
if (!$this->zipComponent())
|
||||
{
|
||||
// done
|
||||
// done with error
|
||||
return false;
|
||||
}
|
||||
// $time_end = microtime(true);
|
||||
// $time = $time_end - $time_start;
|
||||
// var_dump("Did Test in ($time seconds)");die;
|
||||
// end the timer here
|
||||
$this->time_end = microtime(true);
|
||||
$this->secondsCompiled = $this->time_end - $this->time_start;
|
||||
// completed the compilation
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -160,6 +153,8 @@ class Compiler extends Infusion
|
||||
{
|
||||
if (isset($this->newFiles['static']) && ComponentbuilderHelper::checkArray($this->newFiles['static']) && isset($this->newFiles['dynamic']) && ComponentbuilderHelper::checkArray($this->newFiles['dynamic']))
|
||||
{
|
||||
// we don't update lang now since we will still posible add custom code
|
||||
$langCheck = 'en-GB.com_'.$this->fileContentStatic['###component###'].'.';
|
||||
// get the bom file
|
||||
$bom = JFile::read($this->bomPath);
|
||||
// first we do the static files
|
||||
@ -167,6 +162,12 @@ class Compiler extends Infusion
|
||||
{
|
||||
if (JFile::exists($static['path']))
|
||||
{
|
||||
// skip lang files and store for later
|
||||
if (strpos($static['path'], $langCheck))
|
||||
{
|
||||
$this->langFiles[] = $static;
|
||||
continue;
|
||||
}
|
||||
$this->fileContentStatic['###FILENAME###'] = $static['name'];
|
||||
$php = '';
|
||||
if (ComponentbuilderHelper::checkFileType($static['name'],'php'))
|
||||
@ -179,16 +180,12 @@ class Compiler extends Infusion
|
||||
list($wast,$code) = explode('###BOM###',$string);
|
||||
$string = $php.$bom.$code;
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
|
||||
// add custom Code by placeholder if found
|
||||
$this->getPlaceHolderKeys($static['path'], $answer);
|
||||
// add to zip array
|
||||
$this->writeFile($static['path'],$answer);
|
||||
}
|
||||
else
|
||||
{
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
|
||||
// add custom Code by placeholder if found
|
||||
$this->getPlaceHolderKeys($static['path'], $answer);
|
||||
// add to zip array
|
||||
$this->writeFile($static['path'],$answer);
|
||||
}
|
||||
@ -221,8 +218,6 @@ class Compiler extends Infusion
|
||||
$string = $php.$bom.$code;
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
|
||||
$answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3);
|
||||
// add custom Code by placeholder if found
|
||||
$this->getPlaceHolderKeys($file['path'], $answer, $view);
|
||||
// add to zip array
|
||||
$this->writeFile($file['path'],$answer);
|
||||
}
|
||||
@ -230,8 +225,6 @@ class Compiler extends Infusion
|
||||
{
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
|
||||
$answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3);
|
||||
// add custom Code by placeholder if found
|
||||
$this->getPlaceHolderKeys($file['path'], $answer, $view);
|
||||
// add to zip array
|
||||
$this->writeFile($file['path'],$answer);
|
||||
}
|
||||
@ -245,156 +238,11 @@ class Compiler extends Infusion
|
||||
}
|
||||
// free up some memory
|
||||
unset($this->newFiles['dynamic']);
|
||||
// do a final run to update the readme file
|
||||
$two = 0;
|
||||
foreach ($this->newFiles['static'] as $static)
|
||||
{
|
||||
if (('README.md' === $static['name'] || 'README.txt' === $static['name']) && $this->componentData->addreadme && JFile::exists($static['path']))
|
||||
{
|
||||
$this->buildReadMe($static['path']);
|
||||
$two++;
|
||||
}
|
||||
if ($two == 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getPlaceHolderKeys(&$file, &$content, &$view = '')
|
||||
{
|
||||
// check if line has custom code place holder
|
||||
if (strpos($content, '[CUSTO'.'MCODE=') !== false)
|
||||
{
|
||||
if (!isset($this->addCustomCodeAt[$file]))
|
||||
{
|
||||
$this->addCustomCodeAt[$file] = array();
|
||||
$this->addCustomCodeAt[$file]['ids'] = array();
|
||||
$this->addCustomCodeAt[$file]['args'] = array();
|
||||
$this->addCustomCodeAt[$file]['view'] = $view;
|
||||
}
|
||||
$found = ComponentbuilderHelper::getAllBetween($content, '[CUSTO'.'MCODE=', ']');
|
||||
if (ComponentbuilderHelper::checkArray($found))
|
||||
{
|
||||
foreach ($found as $key)
|
||||
{
|
||||
// check if we have args
|
||||
if (is_numeric($key))
|
||||
{
|
||||
$id = (int) $key;
|
||||
}
|
||||
elseif (strpos($key, '+') !== false)
|
||||
{
|
||||
$array = explode('+', $key);
|
||||
// set ID
|
||||
$id = (int) $array[0];
|
||||
// load args for this ID
|
||||
if (isset($array[1]))
|
||||
{
|
||||
if (!isset($this->addCustomCodeAt[$file]['args'][$id]))
|
||||
{
|
||||
$this->addCustomCodeAt[$file]['args'][$id] = array();
|
||||
}
|
||||
// only load if not already loaded
|
||||
if (!isset($this->addCustomCodeAt[$file]['args'][$id][$key]))
|
||||
{
|
||||
if (strpos($array[1], ',') !== false)
|
||||
{
|
||||
$this->addCustomCodeAt[$file]['args'][$id][$key] = array_map('trim', explode(',', $array[1]));
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkString($array[1]))
|
||||
{
|
||||
$this->addCustomCodeAt[$file]['args'][$id][$key] = array();
|
||||
$this->addCustomCodeAt[$file]['args'][$id][$key][] = trim($array[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$this->addCustomCodeAt[$file]['ids'][$id] = $id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function freeMemory()
|
||||
{
|
||||
// free up some memory
|
||||
unset($this->newFiles['static']);
|
||||
unset($this->customScriptBuilder);
|
||||
unset($this->permissionCore);
|
||||
unset($this->permissionDashboard);
|
||||
unset($this->componentData->admin_views);
|
||||
unset($this->componentData->site_views);
|
||||
unset($this->componentData->custom_admin_views);
|
||||
unset($this->componentData->config);
|
||||
unset($this->joomlaVersionData);
|
||||
// unset($this->langContent);
|
||||
unset($this->dbKeys);
|
||||
unset($this->permissionBuilder);
|
||||
unset($this->layoutBuilder);
|
||||
unset($this->historyBuilder);
|
||||
unset($this->aliasBuilder);
|
||||
unset($this->titleBuilder);
|
||||
unset($this->customBuilderList);
|
||||
unset($this->hiddenFieldsBuilder);
|
||||
unset($this->intFieldsBuilder);
|
||||
unset($this->dynamicfieldsBuilder);
|
||||
unset($this->maintextBuilder);
|
||||
unset($this->customFieldLinksBuilder);
|
||||
unset($this->setScriptUserSwitch);
|
||||
unset($this->categoryBuilder);
|
||||
unset($this->catCodeBuilder);
|
||||
unset($this->checkboxBuilder);
|
||||
unset($this->jsonItemBuilder);
|
||||
unset($this->base64Builder);
|
||||
unset($this->basicEncryptionBuilder);
|
||||
unset($this->advancedEncryptionBuilder);
|
||||
unset($this->getItemsMethodListStringFixBuilder);
|
||||
unset($this->getItemsMethodEximportStringFixBuilder);
|
||||
unset($this->selectionTranslationFixBuilder);
|
||||
unset($this->listBuilder);
|
||||
unset($this->customBuilder);
|
||||
unset($this->editBodyViewScriptBuilder);
|
||||
unset($this->queryBuilder);
|
||||
unset($this->sortBuilder);
|
||||
unset($this->searchBuilder);
|
||||
unset($this->filterBuilder);
|
||||
unset($this->fieldsNames);
|
||||
unset($this->siteFields);
|
||||
unset($this->siteFieldData);
|
||||
unset($this->customFieldScript);
|
||||
unset($this->configFieldSets);
|
||||
unset($this->jsonStringBuilder);
|
||||
unset($this->importCustomScripts);
|
||||
unset($this->eximportView);
|
||||
unset($this->uninstallBuilder);
|
||||
unset($this->listColnrBuilder);
|
||||
unset($this->customFieldBuilder);
|
||||
unset($this->permissionFields);
|
||||
unset($this->getAsLookup);
|
||||
unset($this->secondRunAdmin);
|
||||
unset($this->uninstallScriptBuilder);
|
||||
unset($this->buildCategories);
|
||||
unset($this->iconBuilder);
|
||||
unset($this->validationFixBuilder);
|
||||
unset($this->targetRelationControl);
|
||||
unset($this->targetControlsScriptChecker);
|
||||
unset($this->accessBuilder);
|
||||
unset($this->tabCounter);
|
||||
unset($this->linkedAdminViews);
|
||||
unset($this->uniquekeys);
|
||||
unset($this->uniquecodes);
|
||||
$this->unsetNow('_adminViewData');
|
||||
$this->unsetNow('_fieldData');
|
||||
}
|
||||
|
||||
/**
|
||||
* move the local update server xml file to a remote ftp server
|
||||
*
|
||||
@ -457,7 +305,58 @@ class Compiler extends Infusion
|
||||
$this->fileContentStatic['###VERSION###'] = $this->fileContentStatic['###VERSION###GLOBAL'];
|
||||
}
|
||||
|
||||
private function buildReadMe($path)
|
||||
// set all global numbers
|
||||
protected function setCountingStuff()
|
||||
{
|
||||
// what is the size in terms of an A4 book
|
||||
$this->pageCount = round($this->lineCount / 56);
|
||||
// setup the unrealistic numbers
|
||||
$this->folderSeconds = $this->folderCount * 5;
|
||||
$this->fileSeconds = $this->fileCount * 5;
|
||||
$this->lineSeconds = $this->lineCount * 10;
|
||||
$this->seconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds;
|
||||
$this->totalHours = round($this->seconds / 3600);
|
||||
$this->totalDays = round($this->totalHours / 8);
|
||||
// setup the more realistic numbers
|
||||
$this->secondsDebugging = $this->seconds / 4;
|
||||
$this->secondsPlanning = $this->seconds / 7;
|
||||
$this->secondsMapping = $this->seconds / 10;
|
||||
$this->secondsOffice = $this->seconds / 6;
|
||||
$this->actualSeconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds + $this->secondsDebugging + $this->secondsPlanning + $this->secondsMapping + $this->secondsOffice;
|
||||
$this->actualTotalHours = round($this->actualSeconds / 3600);
|
||||
$this->actualTotalDays = round($this->actualTotalHours / 8);
|
||||
$this->debuggingHours = round($this->secondsDebugging / 3600);
|
||||
$this->planningHours = round($this->secondsPlanning / 3600);
|
||||
$this->mappingHours = round($this->secondsMapping / 3600);
|
||||
$this->officeHours = round($this->secondsOffice / 3600);
|
||||
// the actual time spent
|
||||
$this->actualHoursSpent = $this->actualTotalHours - $this->totalHours;
|
||||
$this->actualDaysSpent = $this->actualTotalDays - $this->totalDays;
|
||||
// calculate the projects actual time frame of completion
|
||||
$this->projectWeekTime = round($this->actualTotalDays / 5,1);
|
||||
$this->projectMonthTime = round($this->actualTotalDays / 24,1);
|
||||
}
|
||||
|
||||
private function buildReadMe()
|
||||
{
|
||||
// do a final run to update the readme file
|
||||
$two = 0;
|
||||
foreach ($this->newFiles['static'] as $static)
|
||||
{
|
||||
if (('README.md' === $static['name'] || 'README.txt' === $static['name']) && $this->componentData->addreadme && JFile::exists($static['path']))
|
||||
{
|
||||
$this->setReadMe($static['path']);
|
||||
$two++;
|
||||
}
|
||||
if ($two == 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($this->newFiles['static']);
|
||||
}
|
||||
|
||||
private function setReadMe($path)
|
||||
{
|
||||
// set readme data if not set already
|
||||
if (!isset($this->fileContentStatic['###LINE_COUNT###']) || $this->fileContentStatic['###LINE_COUNT###'] != $this->lineCount)
|
||||
@ -474,55 +373,39 @@ class Compiler extends Infusion
|
||||
|
||||
private function buildReadMeData()
|
||||
{
|
||||
// setup the unrealistic numbers
|
||||
$folders = $this->folderCount * 5;
|
||||
$files = $this->fileCount * 5;
|
||||
$lines = $this->lineCount * 10;
|
||||
$seconds = $folders + $files + $lines;
|
||||
$totalHours = round($seconds / 3600);
|
||||
$totalDays = round($totalHours / 8);
|
||||
// setup the more realistic numbers
|
||||
$debugging = $seconds / 4;
|
||||
$planning = $seconds / 7;
|
||||
$mapping = $seconds / 10;
|
||||
$office = $seconds / 6;
|
||||
$seconds = $folders + $files + $lines + $debugging + $planning + $mapping + $office;
|
||||
$actualTotalHours = round($seconds / 3600);
|
||||
$actualTotalDays = round($actualTotalHours / 8);
|
||||
$debuggingHours = round($debugging / 3600);
|
||||
$planningHours = round($planning / 3600);
|
||||
$mappingHours = round($mapping / 3600);
|
||||
$officeHours = round($office / 3600);
|
||||
// the actual time spent
|
||||
$actualHoursSpent = $actualTotalHours - $totalHours;
|
||||
$actualDaysSpent = $actualTotalDays - $totalDays;
|
||||
// calculate the projects actual time frame of completion
|
||||
$projectWeekTime = round($actualTotalDays / 5,1);
|
||||
$projectMonthTime = round($actualTotalDays / 24,1);
|
||||
// set some defaults
|
||||
$this->fileContentStatic['###LINE_COUNT###'] = $this->lineCount;
|
||||
$this->fileContentStatic['###FILE_COUNT###'] = $this->fileCount;
|
||||
$this->fileContentStatic['###FOLDER_COUNT###'] = $this->folderCount;
|
||||
$this->fileContentStatic['###folders###'] = $folders;
|
||||
$this->fileContentStatic['###files###'] = $files;
|
||||
$this->fileContentStatic['###lines###'] = $lines;
|
||||
$this->fileContentStatic['###seconds###'] = $seconds;
|
||||
$this->fileContentStatic['###totalHours###'] = $totalHours;
|
||||
$this->fileContentStatic['###totalDays###'] = $totalDays;
|
||||
$this->fileContentStatic['###debugging###'] = $debugging;
|
||||
$this->fileContentStatic['###planning###'] = $planning;
|
||||
$this->fileContentStatic['###mapping###'] = $mapping;
|
||||
$this->fileContentStatic['###office###'] = $office;
|
||||
$this->fileContentStatic['###actualTotalHours###'] = $actualTotalHours;
|
||||
$this->fileContentStatic['###actualTotalDays###'] = $actualTotalDays;
|
||||
$this->fileContentStatic['###debuggingHours###'] = $debuggingHours;
|
||||
$this->fileContentStatic['###planningHours###'] = $planningHours;
|
||||
$this->fileContentStatic['###mappingHours###'] = $mappingHours;
|
||||
$this->fileContentStatic['###officeHours###'] = $officeHours;
|
||||
$this->fileContentStatic['###actualHoursSpent###'] = $actualHoursSpent;
|
||||
$this->fileContentStatic['###actualDaysSpent###'] = $actualDaysSpent;
|
||||
$this->fileContentStatic['###projectWeekTime###'] = $projectWeekTime;
|
||||
$this->fileContentStatic['###projectMonthTime###'] = $projectMonthTime;
|
||||
$this->fileContentStatic['###PAGE_COUNT###'] = $this->pageCount;
|
||||
$this->fileContentStatic['###folders###'] = $this->folderSeconds;
|
||||
$this->fileContentStatic['###foldersSeconds###'] = $this->folderSeconds;
|
||||
$this->fileContentStatic['###files###'] = $this->fileSeconds;
|
||||
$this->fileContentStatic['###filesSeconds###'] = $this->fileSeconds;
|
||||
$this->fileContentStatic['###lines###'] = $this->lineSeconds;
|
||||
$this->fileContentStatic['###linesSeconds###'] = $this->lineSeconds;
|
||||
$this->fileContentStatic['###seconds###'] = $this->actualSeconds;
|
||||
$this->fileContentStatic['###actualSeconds###'] = $this->actualSeconds;
|
||||
$this->fileContentStatic['###totalHours###'] = $this->totalHours;
|
||||
$this->fileContentStatic['###totalDays###'] = $this->totalDays;
|
||||
$this->fileContentStatic['###debugging###'] = $this->secondsDebugging;
|
||||
$this->fileContentStatic['###secondsDebugging###'] = $this->secondsDebugging;
|
||||
$this->fileContentStatic['###planning###'] = $this->secondsPlanning;
|
||||
$this->fileContentStatic['###secondsPlanning###'] = $this->secondsPlanning;
|
||||
$this->fileContentStatic['###mapping###'] = $this->secondsMapping;
|
||||
$this->fileContentStatic['###secondsMapping###'] = $this->secondsMapping;
|
||||
$this->fileContentStatic['###office###'] = $this->secondsOffice;
|
||||
$this->fileContentStatic['###secondsOffice###'] = $this->secondsOffice;
|
||||
$this->fileContentStatic['###actualTotalHours###'] = $this->actualTotalHours;
|
||||
$this->fileContentStatic['###actualTotalDays###'] = $this->actualTotalDays;
|
||||
$this->fileContentStatic['###debuggingHours###'] = $this->debuggingHours;
|
||||
$this->fileContentStatic['###planningHours###'] = $this->planningHours;
|
||||
$this->fileContentStatic['###mappingHours###'] = $this->mappingHours;
|
||||
$this->fileContentStatic['###officeHours###'] = $this->officeHours;
|
||||
$this->fileContentStatic['###actualHoursSpent###'] = $this->actualHoursSpent;
|
||||
$this->fileContentStatic['###actualDaysSpent###'] = $this->actualDaysSpent;
|
||||
$this->fileContentStatic['###projectWeekTime###'] = $this->projectWeekTime;
|
||||
$this->fileContentStatic['###projectMonthTime###'] = $this->projectMonthTime;
|
||||
}
|
||||
|
||||
private function zipComponent()
|
||||
@ -539,39 +422,9 @@ class Compiler extends Infusion
|
||||
}
|
||||
// the name of the zip file to create
|
||||
$this->filepath = $this->tempPath.'/'.$this->componentFolderName.'.zip';
|
||||
// store the current joomla working directory
|
||||
$joomla = getcwd();
|
||||
|
||||
// we are changing the working directory to the componet temp folder
|
||||
chdir($this->componentPath);
|
||||
|
||||
// the full file path of the zip file
|
||||
$this->filepath = JPath::clean($this->filepath);
|
||||
|
||||
// delete an existing zip file (or use an exclusion parameter in JFolder::files()
|
||||
JFile::delete($this->filepath);
|
||||
|
||||
// get a list of files in the current directory tree
|
||||
$files = JFolder::files('.', '', true, true);
|
||||
$zipArray = array();
|
||||
// setup the zip array
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$tmp = array();
|
||||
$tmp['name'] = str_replace('./', '', $file);
|
||||
$tmp['data'] = JFile::read($file);
|
||||
$tmp['time'] = filemtime($file);
|
||||
$zipArray[] = $tmp;
|
||||
}
|
||||
|
||||
// change back to joomla working directory
|
||||
chdir($joomla);
|
||||
|
||||
// get the zip adapter
|
||||
$zip = JArchive::getAdapter('zip');
|
||||
|
||||
//create the zip file
|
||||
if ($zip->create($this->filepath, $zipArray))
|
||||
if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath))
|
||||
{
|
||||
// now move to backup if zip was made and backup is requered
|
||||
if ($this->backupPath && $this->dynamicIntegration)
|
||||
@ -672,98 +525,10 @@ class Compiler extends Infusion
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function addCustomCodeViaPlaceholders($app)
|
||||
{
|
||||
// reset all these
|
||||
$this->clearFromPlaceHolders('view');
|
||||
foreach ($this->addCustomCodeAt as $path => $item)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkString($item['view']))
|
||||
{
|
||||
$this->placeholders['[[[view]]]'] = $item['view'];
|
||||
}
|
||||
elseif (isset($this->placeholders['[[[view]]]']))
|
||||
{
|
||||
unset($this->placeholders['[[[view]]]']);
|
||||
}
|
||||
if ($this->getCustomCode($item['ids']))
|
||||
{
|
||||
$code = array();
|
||||
foreach($this->customCode as $dbitem)
|
||||
{
|
||||
$this->buildCustomCodeForPlaceholders($item, $dbitem, $code);
|
||||
}
|
||||
// now update the file
|
||||
$string = JFile::read($path);
|
||||
$answer = $this->setPlaceholders($string, $code);
|
||||
$this->writeFile($path,$answer);
|
||||
}
|
||||
else
|
||||
{
|
||||
$app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> <br />Since there where no publish code returned from the database.', $path), 'warning');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function buildCustomCodeForPlaceholders(&$at, &$item, &$code)
|
||||
{
|
||||
// check if there is args for this code
|
||||
if (isset($at['args'][$item['id']]) && ComponentbuilderHelper::checkArray($at['args'][$item['id']]))
|
||||
{
|
||||
// since we have args we cant update this code via editor (TODO)
|
||||
$placeholder = $this->getPlaceHolder(3, null);
|
||||
// we have args and so need to load each
|
||||
foreach ($at['args'][$item['id']] as $key => $args)
|
||||
{
|
||||
$this->setThesePlaceHolders('arg', $args);
|
||||
$code['[CUSTOM'.'CODE='.$key.']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders). $placeholder['end'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// check what type of place holders we should load here (if view is being updated then we can't use inserted)
|
||||
$placeholderType = 2;
|
||||
if (strpos($item['code'], '[[[view]]]') !== false)
|
||||
{
|
||||
// since we have views we can't update this code via editor (TODO)
|
||||
$placeholderType = 3;
|
||||
}
|
||||
// if now ars were found, clear it
|
||||
$this->clearFromPlaceHolders('arg');
|
||||
// load args for this code
|
||||
$placeholder = $this->getPlaceHolder($placeholderType, $item['id']);
|
||||
$code['[CUSTOM'.'CODE='.$item['id'].']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders). $placeholder['end'];
|
||||
}
|
||||
}
|
||||
|
||||
protected function setThesePlaceHolders($key, $values)
|
||||
{
|
||||
// aways fist reset these
|
||||
$this->clearFromPlaceHolders($key);
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
$number = 0;
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$this->placeholders['[[['.$key.$number.']]]'] = $value;
|
||||
$number++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function clearFromPlaceHolders($like)
|
||||
{
|
||||
foreach ($this->placeholders as $something => $value)
|
||||
{
|
||||
if (stripos($something, $like) !== false)
|
||||
{
|
||||
unset($this->placeholders[$something]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function addCustomCode($app)
|
||||
protected function addCustomCode()
|
||||
{
|
||||
// load error messages incase code can not be added
|
||||
$app = JFactory::getApplication();
|
||||
// reset all these
|
||||
$this->clearFromPlaceHolders('view');
|
||||
$this->clearFromPlaceHolders('arg');
|
||||
@ -860,8 +625,8 @@ class Compiler extends Infusion
|
||||
}
|
||||
if ($found)
|
||||
{
|
||||
$placeholder = $this->getPlaceHolder($target['type'], $target['id']);
|
||||
$data = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($target['code'], $this->placeholders). $placeholder['end'];
|
||||
$placeholder = $this->getPlaceHolder((int) $target['comment_type'].$target['type'], $target['id']);
|
||||
$data = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($target['code'], $this->placeholders). $placeholder['end'] . PHP_EOL;
|
||||
if ($target['type'] == 2)
|
||||
{
|
||||
// found it now add code from the next line
|
||||
@ -870,7 +635,7 @@ class Compiler extends Infusion
|
||||
elseif ($target['type'] == 1 && $foundEnd)
|
||||
{
|
||||
// found it now add code from the next line
|
||||
$this->addDataToFile($file, $data . PHP_EOL, $bites, (int) array_sum($replace));
|
||||
$this->addDataToFile($file, $data, $bites, (int) array_sum($replace));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -901,7 +666,7 @@ class Compiler extends Infusion
|
||||
$code = explode(PHP_EOL, $target['code']);
|
||||
$code = PHP_EOL."// " .implode(PHP_EOL."// ",$code). PHP_EOL;
|
||||
// get place holders
|
||||
$placeholder = $this->getPlaceHolder($target['type'], $target['id']);
|
||||
$placeholder = $this->getPlaceHolder((int) $target['comment_type'].$target['type'], $target['id']);
|
||||
// build the data
|
||||
$data = $placeholder['start'] . $code . $placeholder['end']. PHP_EOL;
|
||||
// get the bites before insertion
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -45,6 +45,13 @@ class Structure extends Get
|
||||
*/
|
||||
public $fileCount = 0;
|
||||
|
||||
/**
|
||||
* The page counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $pageCount = 0;
|
||||
|
||||
/**
|
||||
* The line counter
|
||||
*
|
||||
@ -52,6 +59,153 @@ class Structure extends Get
|
||||
*/
|
||||
public $lineCount = 0;
|
||||
|
||||
/**
|
||||
* The seconds counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $seconds = 0;
|
||||
|
||||
/**
|
||||
* The actual seconds counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $actualSeconds = 0;
|
||||
|
||||
/**
|
||||
* The folder seconds counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $folderSeconds = 0;
|
||||
|
||||
/**
|
||||
* The file seconds counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $fileSeconds = 0;
|
||||
|
||||
/**
|
||||
* The line seconds counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $lineSeconds = 0;
|
||||
|
||||
/**
|
||||
* The seconds debugging counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $secondsDebugging = 0;
|
||||
|
||||
/**
|
||||
* The seconds planning counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $secondsPlanning = 0;
|
||||
|
||||
/**
|
||||
* The seconds mapping counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $secondsMapping = 0;
|
||||
|
||||
/**
|
||||
* The seconds office counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $secondsOffice = 0;
|
||||
|
||||
/**
|
||||
* The total hours counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $totalHours = 0;
|
||||
|
||||
/**
|
||||
* The debugging hours counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $debuggingHours = 0;
|
||||
|
||||
/**
|
||||
* The planning hours counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $planningHours = 0;
|
||||
|
||||
/**
|
||||
* The mapping hours counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $mappingHours = 0;
|
||||
|
||||
/**
|
||||
* The office hours counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $officeHours = 0;
|
||||
|
||||
/**
|
||||
* The actual Total Hours counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $actualTotalHours = 0;
|
||||
|
||||
/**
|
||||
* The actual hours spent counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $actualHoursSpent = 0;
|
||||
|
||||
/**
|
||||
* The actual days spent counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $actualDaysSpent = 0;
|
||||
|
||||
/**
|
||||
* The total days counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $totalDays = 0;
|
||||
|
||||
/**
|
||||
* The actual Total Days counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $actualTotalDays = 0;
|
||||
|
||||
/**
|
||||
* The project week time counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $projectWeekTime = 0;
|
||||
|
||||
/**
|
||||
* The project month time counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $projectMonthTime = 0;
|
||||
|
||||
/**
|
||||
* The Joomla Version
|
||||
*
|
||||
@ -939,68 +1093,11 @@ class Structure extends Get
|
||||
* @param string $dir The path to folder to remove
|
||||
* @param boolean $git if there is a git folder in that must not be removed
|
||||
*
|
||||
* @return boolean True in all is removed
|
||||
* @return boolean True if all is removed
|
||||
*
|
||||
*/
|
||||
protected function removeFolder($dir, $git = false)
|
||||
{
|
||||
if (JFolder::exists($dir))
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir);
|
||||
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
foreach ($it as $file)
|
||||
{
|
||||
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
|
||||
if ($file->isDir())
|
||||
{
|
||||
if ($git && strpos($file->getPathname(), $dir.'/.git') !== false) continue;
|
||||
JFolder::delete($file->getPathname());
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($git && strpos($file->getPathname(), $dir.'/.git') !== false) continue;
|
||||
JFile::delete($file->getPathname());
|
||||
}
|
||||
}
|
||||
if (!$git && JFolder::delete($dir))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the local installed path of this component
|
||||
*
|
||||
* @return array of paths on success
|
||||
*
|
||||
*/
|
||||
public function getLocalInstallPaths()
|
||||
{
|
||||
// set the local paths to search
|
||||
$localPaths = array();
|
||||
// the admin path
|
||||
$localPaths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'. $this->componentCodeName;
|
||||
// only check for site path if the component has a site area!
|
||||
if (!$this->removeSiteFolder)
|
||||
{
|
||||
$localPaths['site'] = JPATH_ROOT . '/components/com_'. $this->componentCodeName;
|
||||
}
|
||||
// TODO later to include the JS and CSS
|
||||
// $localPaths['media'] = JPATH_ROOT . '/media/com_'. $this->fileContentStatic['###component###'];
|
||||
// check if the local install is found
|
||||
foreach ($localPaths as $key => $localPath)
|
||||
{
|
||||
if (!JFolder::exists($localPath))
|
||||
{
|
||||
unset($localPaths[$key]);
|
||||
}
|
||||
}
|
||||
if (ComponentbuilderHelper::checkArray($localPaths))
|
||||
{
|
||||
return $localPaths;
|
||||
}
|
||||
return false;
|
||||
return ComponentbuilderHelper::removeFolder($dir, $git);
|
||||
}
|
||||
}
|
||||
|
@ -313,6 +313,13 @@ class Fields extends Structure
|
||||
*/
|
||||
public $fieldsNames = array();
|
||||
|
||||
/**
|
||||
* Set unique Names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $uniqueNames = array();
|
||||
|
||||
/**
|
||||
* Default Fields
|
||||
*
|
||||
@ -368,6 +375,19 @@ class Fields extends Structure
|
||||
// setup the list view and single view name
|
||||
$listViewName = ComponentbuilderHelper::safeString($view['settings']->name_list);
|
||||
$viewName = ComponentbuilderHelper::safeString($view['settings']->name_single);
|
||||
// set some place holder for this view
|
||||
$this->placeholders['###view###'] = $viewName;
|
||||
$this->placeholders['###VIEW###'] = strtoupper($viewName);
|
||||
$this->placeholders['###View###'] = ucfirst($viewName);
|
||||
$this->placeholders['[[[view]]]'] = $this->placeholders['###view###'];
|
||||
$this->placeholders['[[[VIEW]]]'] = $this->placeholders['###VIEW###'];
|
||||
$this->placeholders['[[[View]]]'] = $this->placeholders['###View###'];
|
||||
$this->placeholders['###views###'] = $listViewName;
|
||||
$this->placeholders['###VIEWS###'] = strtoupper($listViewName);
|
||||
$this->placeholders['###Views###'] = ucfirst($listViewName);
|
||||
$this->placeholders['[[[views]]]'] = $this->placeholders['###views###'];
|
||||
$this->placeholders['[[[VIEWS]]]'] = $this->placeholders['###VIEWS###'];
|
||||
$this->placeholders['[[[Views]]]'] = $this->placeholders['###Views###'];
|
||||
// add metadata to the view
|
||||
if ($view['metadata'])
|
||||
{
|
||||
@ -385,12 +405,12 @@ class Fields extends Structure
|
||||
$readOnly = "\t\t\t" . 'readonly="true"' . PHP_EOL."\t\t\t" . 'disabled="true"';
|
||||
}
|
||||
// main lang prefix
|
||||
$langView = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($view['settings']->name_single, 'U');
|
||||
$langViews = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($view['settings']->name_list, 'U');
|
||||
$langView = $this->langPrefix . '_' . $this->placeholders['###VIEW###'];
|
||||
$langViews = $this->langPrefix . '_' . $this->placeholders['###VIEWS###'];
|
||||
// set default lang
|
||||
$this->langContent[$this->lang][$langView] = $view['settings']->name_single;
|
||||
$this->langContent[$this->lang][$langViews] = $view['settings']->name_list;
|
||||
// set the singel name
|
||||
// set the single name
|
||||
$viewSingleName = ComponentbuilderHelper::safeString($view['settings']->name_single, 'W');
|
||||
// set global item strings
|
||||
$this->langContent[$this->lang][$langViews . '_N_ITEMS_ARCHIVED'] = "%s " . $view['settings']->name_list . " archived.";
|
||||
@ -427,20 +447,21 @@ class Fields extends Structure
|
||||
$this->langContent[$this->lang][$langView . '_VERSION_DESC'] = "A count of the number of times this " . $view['settings']->name_single . " has been revised.";
|
||||
$this->langContent[$this->lang][$langView . '_SAVE_WARNING'] = "Alias already existed so a number was added at the end. You can re-edit the " . $view['settings']->name_single . " to customise the alias.";
|
||||
|
||||
// check if the same field is added multiple times
|
||||
foreach ($view['settings']->fields as $field)
|
||||
{
|
||||
$name = ComponentbuilderHelper::safeString($field['settings']->name);
|
||||
$this->setUniqueNameKeeper($field, $view['settings']->type, $name, $viewName);
|
||||
}
|
||||
// start adding dynamc fields
|
||||
$dynamcfields = '';
|
||||
// place holders
|
||||
$placeholders = array(
|
||||
'###component###' => $component,
|
||||
'###view###' => $viewName,
|
||||
'###views###' => $listViewName);
|
||||
$spacerCounter = 'a';
|
||||
// set the custom table key
|
||||
$dbkey = 'g';
|
||||
// TODO we should add the global and local view switch if field for front end
|
||||
foreach ($view['settings']->fields as $field)
|
||||
{
|
||||
$dynamcfields .= $this->setDynamicField($field, $view, $view['settings']->type, $langView, $viewName, $listViewName, $spacerCounter, $placeholders, $dbkey, true);
|
||||
$dynamcfields .= $this->setDynamicField($field, $view, $view['settings']->type, $langView, $viewName, $listViewName, $spacerCounter, $this->placeholders, $dbkey, true);
|
||||
}
|
||||
|
||||
// set the defautl fields
|
||||
@ -633,6 +654,8 @@ class Fields extends Structure
|
||||
$fieldSet[] = "\t\t</fieldset>";
|
||||
$fieldSet[] = "\t</fields>";
|
||||
}
|
||||
// just to be safe, lets clear the view placeholders
|
||||
$this->clearFromPlaceHolders('view');
|
||||
// retunr the set
|
||||
return implode(PHP_EOL, $fieldSet);
|
||||
}
|
||||
@ -1219,7 +1242,7 @@ class Fields extends Structure
|
||||
{
|
||||
// quick check if this is a category linked to view page
|
||||
$requeSt_id = ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"');
|
||||
if (strpos($requeSt_id, '_request_id') !== false)
|
||||
if (strpos($requeSt_id, '_request_id') !== false || strpos($requeSt_id, '_request_catid') !== false)
|
||||
{
|
||||
// keep it then, don't change
|
||||
$xmlValue = $requeSt_id;
|
||||
@ -1264,12 +1287,16 @@ class Fields extends Structure
|
||||
// use field core name only if not found in xml
|
||||
if (!ComponentbuilderHelper::checkString($xmlValue))
|
||||
{
|
||||
// make sure the XML name is uniqe, so we can add one field multiple times
|
||||
$name = $this->uniqueName($name, $viewName);
|
||||
$xmlValue = $name;
|
||||
}
|
||||
// set the name if found
|
||||
else
|
||||
{
|
||||
$name = $xmlValue;
|
||||
// make sure the XML name is uniqe, so we can add one field multiple times
|
||||
$xmlValue = $this->uniqueName($xmlValue, $viewName);
|
||||
$name = $this->setPlaceholders($xmlValue, $placeholders);
|
||||
}
|
||||
}
|
||||
elseif ($property['name'] === 'extension' || $property['name'] === 'directory')
|
||||
@ -1381,6 +1408,14 @@ class Fields extends Structure
|
||||
// check if translatable
|
||||
if (ComponentbuilderHelper::checkString($xmlValue) && $property['translatable'] == 1)
|
||||
{
|
||||
// update lable if field use multiple times
|
||||
if ($property['name'] === 'label')
|
||||
{
|
||||
if (isset($fieldAttributes['name']) && isset($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']]))
|
||||
{
|
||||
$xmlValue .= ' (' . ComponentbuilderHelper::safeString($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']]) . ')';
|
||||
}
|
||||
}
|
||||
// replace placeholders
|
||||
$xmlValue = $this->setPlaceholders($xmlValue, $placeholders);
|
||||
// insure custom lables dont get messed up
|
||||
@ -1432,18 +1467,17 @@ class Fields extends Structure
|
||||
$xmlValue = $property['example'];
|
||||
}
|
||||
}
|
||||
|
||||
$fieldAttributes[$property['name']] = $xmlValue;
|
||||
|
||||
// load to langBuilder down the line
|
||||
if ($property['name'] === 'label')
|
||||
{
|
||||
$langLabel = $xmlValue;
|
||||
if ($setCustom)
|
||||
{
|
||||
$fieldAttributes['custom']['label'] = $customLabel;
|
||||
}
|
||||
$langLabel = $xmlValue;
|
||||
}
|
||||
// now set the value
|
||||
$fieldAttributes[$property['name']] = $xmlValue;
|
||||
}
|
||||
}
|
||||
// do some nice twigs beyond the default
|
||||
@ -1460,6 +1494,123 @@ class Fields extends Structure
|
||||
return $fieldAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep track of the field names, to see if it used multiple times
|
||||
*
|
||||
* @param array $field The field data
|
||||
* @param string $typeName The field type
|
||||
* @param string $name The field name
|
||||
* @param string $viewName The singel view name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function setUniqueNameKeeper(&$field, &$typeName, &$name, $viewName)
|
||||
{
|
||||
// setup a default field
|
||||
if (ComponentbuilderHelper::checkArray($field['settings']->properties))
|
||||
{
|
||||
foreach ($field['settings']->properties as $property)
|
||||
{
|
||||
// reset
|
||||
$xmlValue = '';
|
||||
if ($property['name'] === 'name')
|
||||
{
|
||||
// if category then name must be catid (only one per view)
|
||||
if ($typeName === 'category')
|
||||
{
|
||||
// only one allowed
|
||||
return;
|
||||
}
|
||||
// if tag is set then enable all tag options for this view (only one per view)
|
||||
elseif ($typeName === 'tag')
|
||||
{
|
||||
// only one allowed
|
||||
return;
|
||||
}
|
||||
// if the field is set as alias it must be called alias
|
||||
elseif (isset($field['alias']) && $field['alias'])
|
||||
{
|
||||
// only one allowed
|
||||
return;
|
||||
}
|
||||
elseif ($typeName === 'spacer')
|
||||
{
|
||||
// not needed here
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"'));
|
||||
}
|
||||
|
||||
// use field core name only if not found in xml
|
||||
if (!ComponentbuilderHelper::checkString($xmlValue))
|
||||
{
|
||||
$xmlValue = $name;
|
||||
}
|
||||
// make sure the XML name is uniqe, so we can add one field multiple times
|
||||
return $this->setUniqueNameCounter($xmlValue, $viewName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Count how many times the same field is used per view
|
||||
*
|
||||
* @param string $name The name of the field
|
||||
* @param string $view The name of the view
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function setUniqueNameCounter($name, $view)
|
||||
{
|
||||
if (!isset($this->uniqueNames[$view]))
|
||||
{
|
||||
$this->uniqueNames[$view] = array();
|
||||
$this->uniqueNames[$view]['counter'] = array();
|
||||
$this->uniqueNames[$view]['names'] = array();
|
||||
}
|
||||
if (!isset($this->uniqueNames[$view]['counter'][$name]))
|
||||
{
|
||||
$this->uniqueNames[$view]['counter'][$name] = 1;
|
||||
return;
|
||||
}
|
||||
// count how many times the field is used
|
||||
$this->uniqueNames[$view]['counter'][$name]++;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Naming each field with an unique name
|
||||
*
|
||||
* @param string $name The name of the field
|
||||
* @param string $view The name of the view
|
||||
*
|
||||
* @return string the name
|
||||
*
|
||||
*/
|
||||
protected function uniqueName($name, $view)
|
||||
{
|
||||
// only increment if the field name is used multiple times
|
||||
if (isset($this->uniqueNames[$view]['counter'][$name]) && $this->uniqueNames[$view]['counter'][$name] > 1)
|
||||
{
|
||||
$counter = $this->uniqueNames[$view]['counter'][$name];
|
||||
$uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter);
|
||||
while (isset($this->uniqueNames[$view]['names'][$uniqueName]))
|
||||
{
|
||||
$counter--;
|
||||
$uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter);
|
||||
}
|
||||
// set the new name
|
||||
$this->uniqueNames[$view]['names'][$uniqueName] = $counter;
|
||||
return $uniqueName;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set Builders
|
||||
|
@ -31,15 +31,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
*/
|
||||
class Interpretation extends Fields
|
||||
{
|
||||
/*
|
||||
* The line numbers Switch
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $loadLineNr = false;
|
||||
|
||||
public $theContributors = '';
|
||||
public $placeholders = array();
|
||||
public $uninstallBuilder = array();
|
||||
public $listColnrBuilder = array();
|
||||
public $permissionBuilder = array();
|
||||
@ -57,6 +49,9 @@ class Interpretation extends Fields
|
||||
public $DashboardGetCustomData = array();
|
||||
public $customAdminAdded = array();
|
||||
|
||||
protected $hasCatIdRequest = array();
|
||||
protected $hasIdRequest = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -65,8 +60,6 @@ class Interpretation extends Fields
|
||||
// first we run the perent constructor
|
||||
if (parent::__construct($config))
|
||||
{
|
||||
// set if line numbers should be added to comments
|
||||
$this->loadLineNr = ($this->componentData->debug_linenr) ? true:false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1083,15 +1076,27 @@ class Interpretation extends Fields
|
||||
$xml .= PHP_EOL."\t\t\t".'<![CDATA['.$lang.'_DESC]]>';
|
||||
$xml .= PHP_EOL."\t\t".'</message>';
|
||||
$xml .= PHP_EOL."\t".'</layout>';
|
||||
if (isset($this->hasIdRequest[$view['settings']->code]))
|
||||
if (isset($this->hasIdRequest[$view['settings']->code]) || isset($this->hasCatIdRequest[$view['settings']->code]))
|
||||
{
|
||||
$requestField = str_replace($view['settings']->code.'_request_id', 'id', $this->hasIdRequest[$view['settings']->code]);
|
||||
|
||||
$xml .= PHP_EOL."\t".'<!--'.$this->setLine(__LINE__).' Add fields to the request variables for the layout. -->';
|
||||
$xml .= PHP_EOL."\t".'<fields name="request">';
|
||||
$xml .= PHP_EOL."\t\t".'<fieldset name="request"';
|
||||
$xml .= PHP_EOL."\t\t\t".'addfieldpath="/administrator/components/com_'.$this->fileContentStatic['###component###'].'/models/fields">';
|
||||
$xml .= PHP_EOL."\t\t\t".$requestField;
|
||||
if (isset($this->hasIdRequest[$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->hasIdRequest[$view['settings']->code]))
|
||||
{
|
||||
foreach($this->hasIdRequest[$view['settings']->code] as $requestFieldXML)
|
||||
{
|
||||
$xml .= PHP_EOL."\t\t\t".$requestFieldXML;
|
||||
}
|
||||
}
|
||||
if (isset($this->hasCatIdRequest[$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->hasCatIdRequest[$view['settings']->code]))
|
||||
{
|
||||
foreach($this->hasCatIdRequest[$view['settings']->code] as $requestFieldXML)
|
||||
{
|
||||
$xml .= PHP_EOL."\t\t\t".$requestFieldXML;
|
||||
}
|
||||
}
|
||||
$xml .= PHP_EOL."\t\t".'</fieldset>';
|
||||
$xml .= PHP_EOL."\t".'</fields>';
|
||||
}
|
||||
@ -1479,15 +1484,15 @@ class Interpretation extends Fields
|
||||
break;
|
||||
case 5:
|
||||
// COM_COMPONENTBUILDER_DYNAMIC_GET_CATEGORIES
|
||||
$string = "";
|
||||
$string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." (TODO) The dynamic category filter is not ready.";
|
||||
break;
|
||||
case 6:
|
||||
// COM_COMPONENTBUILDER_DYNAMIC_GET_TAGS
|
||||
$string = "";
|
||||
$string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." (TODO) The dynamic tags filter is not ready.";
|
||||
break;
|
||||
case 7:
|
||||
// COM_COMPONENTBUILDER_DYNAMIC_GET_DATE
|
||||
$string = "";
|
||||
$string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." (TODO) The dynamic date filter is not ready.";
|
||||
break;
|
||||
case 8:
|
||||
// COM_COMPONENTBUILDER_DYNAMIC_GET_FUNCTIONVAR
|
||||
@ -2737,6 +2742,10 @@ class Interpretation extends Fields
|
||||
}
|
||||
|
||||
public function setCustomButtons(&$view, $type = 1, $tab = '')
|
||||
{
|
||||
// ensure correct target is set
|
||||
$TARGET = ComponentbuilderHelper::safeString($this->target,'U');
|
||||
if (1 == $type || 2 == $type)
|
||||
{
|
||||
if (1 == $type)
|
||||
{
|
||||
@ -2746,12 +2755,21 @@ class Interpretation extends Fields
|
||||
{
|
||||
$viewName = ComponentbuilderHelper::safeString($view['settings']->name_single);
|
||||
}
|
||||
// ensure correct target is set
|
||||
$TARGET = ComponentbuilderHelper::safeString($this->target,'U');
|
||||
// set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER###
|
||||
$this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER###'] = '';
|
||||
// set the custom buttons ###CUSTOM_BUTTONS_METHOD###
|
||||
$this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD###'] = '';
|
||||
}
|
||||
elseif (3 == $type)
|
||||
{
|
||||
// set the names
|
||||
$viewName = ComponentbuilderHelper::safeString($view['settings']->name_single);
|
||||
$viewsName = ComponentbuilderHelper::safeString($view['settings']->name_list);
|
||||
// set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER_LIST###
|
||||
$this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER_LIST###'] = '';
|
||||
// set the custom buttons ###CUSTOM_BUTTONS_METHOD_LIST###
|
||||
$this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD_LIST###'] = '';
|
||||
}
|
||||
// if site add buttons to view
|
||||
if ($this->target === 'site')
|
||||
{
|
||||
@ -2787,6 +2805,68 @@ class Interpretation extends Fields
|
||||
}
|
||||
// check if custom button should be added
|
||||
if (isset($view['settings']->add_custom_button) && $view['settings']->add_custom_button == 1)
|
||||
{
|
||||
$buttons = array();
|
||||
$functionNames = array();
|
||||
if (isset($view['settings']->custom_buttons) && ComponentbuilderHelper::checkArray($view['settings']->custom_buttons))
|
||||
{
|
||||
foreach ($view['settings']->custom_buttons as $custom_button)
|
||||
{
|
||||
if ($custom_button['target'] != 2 || $this->target === 'site')
|
||||
{
|
||||
// Load to lang
|
||||
$keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U');
|
||||
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
|
||||
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
|
||||
// add cpanel button TODO does not work well on site with permissions
|
||||
if ($custom_button['target'] == 2)
|
||||
{
|
||||
$buttons[] = "\t".$tab."\tif (\$this->user->authorise('".$viewName.".".$keyCode."'))";
|
||||
}
|
||||
else
|
||||
{
|
||||
$buttons[] = "\t".$tab."\tif (\$this->canDo->get('".$viewName.".".$keyCode."'))";
|
||||
}
|
||||
$buttons[] = "\t".$tab."\t{";
|
||||
$buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
|
||||
$buttons[] = "\t".$tab."\t\tJToolBarHelper::custom('".$viewName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
|
||||
$buttons[] = "\t".$tab."\t}";
|
||||
}
|
||||
// load the list button
|
||||
elseif (3 == $type && ($custom_button['target'] == 2 || $custom_button['target'] == 3))
|
||||
{
|
||||
// Load to lang
|
||||
$keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U');
|
||||
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
|
||||
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
|
||||
// add cpanel button TODO does not work well on site with permissions
|
||||
$buttons[] = "\t".$tab."\tif (\$this->user->authorise('".$viewName.".".$keyCode."'))";
|
||||
$buttons[] = "\t".$tab."\t{";
|
||||
$buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
|
||||
$buttons[] = "\t".$tab."\t\tJToolBarHelper::custom('".$viewsName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
|
||||
$buttons[] = "\t".$tab."\t}";
|
||||
}
|
||||
}
|
||||
}
|
||||
// load the model and controller
|
||||
if (3 == $type)
|
||||
{
|
||||
// insure the controller and model strings are added
|
||||
if (isset($view['settings']->php_controller_list) && ComponentbuilderHelper::checkString($view['settings']->php_controller_list) && $view['settings']->php_controller_list != '//')
|
||||
{
|
||||
// set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER###
|
||||
$this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER_LIST###'] =
|
||||
PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_controller_list, $this->placeholders);
|
||||
}
|
||||
// load the model
|
||||
if (isset($view['settings']->php_model_list) && ComponentbuilderHelper::checkString($view['settings']->php_model_list) && $view['settings']->php_model_list != '//')
|
||||
{
|
||||
// set the custom buttons ###CUSTOM_BUTTONS_METHOD###
|
||||
$this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD_LIST###'] =
|
||||
PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_model_list, $this->placeholders);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// insure the controller and model strings are added
|
||||
if (ComponentbuilderHelper::checkString($view['settings']->php_controller) && $view['settings']->php_controller != '//')
|
||||
@ -2803,37 +2883,20 @@ class Interpretation extends Fields
|
||||
###GET_FORM_CUSTOM###
|
||||
}
|
||||
}
|
||||
// load the model
|
||||
if (ComponentbuilderHelper::checkString($view['settings']->php_model) && $view['settings']->php_model != '//')
|
||||
{
|
||||
// set the custom buttons ###CUSTOM_BUTTONS_METHOD###
|
||||
$this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD###'] =
|
||||
PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_model, $this->placeholders);
|
||||
}
|
||||
if (isset($view['settings']->custom_buttons) && ComponentbuilderHelper::checkArray($view['settings']->custom_buttons))
|
||||
{
|
||||
$buttons = array();
|
||||
foreach ($view['settings']->custom_buttons as $custom_button)
|
||||
{
|
||||
if ($custom_button['target'] != 2 || $this->target === 'site')
|
||||
{
|
||||
// Load to lang
|
||||
$keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U');
|
||||
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
|
||||
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
|
||||
// add cpanel button TODO does not work well on site with permissions
|
||||
$buttons[] = "\t".$tab."\tif (\$this->canDo->get('".$viewName.".".$keyCode."'))";
|
||||
$buttons[] = "\t".$tab."\t{";
|
||||
$buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
|
||||
$buttons[] = "\t".$tab."\t\tJToolBarHelper::custom('".$viewName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
|
||||
$buttons[] = "\t".$tab."\t}";
|
||||
}
|
||||
}
|
||||
// return buttons if they were build
|
||||
if (ComponentbuilderHelper::checkArray($buttons))
|
||||
{
|
||||
return PHP_EOL.implode(PHP_EOL,$buttons);
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -3365,22 +3428,9 @@ class Interpretation extends Fields
|
||||
}
|
||||
}
|
||||
|
||||
public function writeFile($path,$data)
|
||||
public function writeFile($path, $data)
|
||||
{
|
||||
$fh = fopen($path, "w");
|
||||
if (!is_resource($fh))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (fwrite($fh, $data))
|
||||
{
|
||||
// close file.
|
||||
fclose($fh);
|
||||
return true;
|
||||
}
|
||||
// close file.
|
||||
fclose($fh);
|
||||
return false;
|
||||
return ComponentbuilderHelper::writeFile($path, $data);
|
||||
}
|
||||
|
||||
public function setMethodGetItem(&$view)
|
||||
@ -3628,7 +3678,7 @@ class Interpretation extends Fields
|
||||
$checkViews = (isset($this->catCodeBuilder[$view]['views']) && ComponentbuilderHelper::checkString($this->catCodeBuilder[$view]['views'])) ? $this->catCodeBuilder[$view]['views'] : $views;
|
||||
if (ComponentbuilderHelper::checkArray($dbStuff[$view]) && array_key_exists($view, $this->catCodeBuilder) && ($checkViews == $views))
|
||||
{
|
||||
$dbStuff[$view.' catagory'] = $this->getCategoryContentType($view, $views, $component);
|
||||
$dbStuff[$view.' category'] = $this->getCategoryContentType($view, $views, $component);
|
||||
}
|
||||
elseif(!isset($dbStuff[$view]) || !ComponentbuilderHelper::checkArray($dbStuff[$view]))
|
||||
{
|
||||
@ -4780,7 +4830,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
$db .= PHP_EOL."\t`id` INT(11) NOT NULL AUTO_INCREMENT,";
|
||||
}
|
||||
$db .= PHP_EOL."\t`asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0',";
|
||||
$db .= PHP_EOL."\t`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',";
|
||||
ksort($fields);
|
||||
foreach ($fields as $field => $data)
|
||||
{
|
||||
@ -4826,22 +4876,22 @@ class Interpretation extends Fields
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['params']))
|
||||
{
|
||||
$db .= PHP_EOL."\t`params` TEXT NOT NULL,";
|
||||
$db .= PHP_EOL."\t`params` text NOT NULL DEFAULT '',";
|
||||
}
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['published']))
|
||||
{
|
||||
$db .= PHP_EOL."\t`published` TINYINT(1) NOT NULL DEFAULT '1',";
|
||||
$db .= PHP_EOL."\t`published` TINYINT(3) NOT NULL DEFAULT 1,";
|
||||
}
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['created_by']))
|
||||
{
|
||||
$db .= PHP_EOL."\t`created_by` INT(11) NOT NULL DEFAULT '0',";
|
||||
$db .= PHP_EOL."\t`created_by` INT(10) unsigned NOT NULL DEFAULT 0,";
|
||||
}
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['modified_by']))
|
||||
{
|
||||
$db .= PHP_EOL."\t`modified_by` INT(11) NOT NULL DEFAULT '0',";
|
||||
$db .= PHP_EOL."\t`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,";
|
||||
}
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['created']))
|
||||
@ -4856,7 +4906,7 @@ class Interpretation extends Fields
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['checked_out']))
|
||||
{
|
||||
$db .= PHP_EOL."\t`checked_out` INT(11) NOT NULL,";
|
||||
$db .= PHP_EOL."\t`checked_out` int(11) unsigned NOT NULL DEFAULT 0,";
|
||||
}
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['checked_out_time']))
|
||||
@ -4866,22 +4916,22 @@ class Interpretation extends Fields
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['version']))
|
||||
{
|
||||
$db .= PHP_EOL."\t`version` INT(11) NOT NULL DEFAULT '1',";
|
||||
$db .= PHP_EOL."\t`version` INT(10) unsigned NOT NULL DEFAULT 1,";
|
||||
}
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['hits']))
|
||||
{
|
||||
$db .= PHP_EOL."\t`hits` INT(11) NOT NULL DEFAULT '0',";
|
||||
$db .= PHP_EOL."\t`hits` INT(10) unsigned NOT NULL DEFAULT 0,";
|
||||
}
|
||||
// check if view has access
|
||||
if (isset($this->accessBuilder[$view]) && ComponentbuilderHelper::checkString($this->accessBuilder[$view]))
|
||||
{
|
||||
$db .= PHP_EOL."\t`access` INT(11) DEFAULT NULL,";
|
||||
$db .= PHP_EOL."\t`access` INT(10) unsigned NOT NULL DEFAULT 0,";
|
||||
}
|
||||
// check if default field was over written
|
||||
if (!isset($this->fieldsNames[$view]['ordering']))
|
||||
{
|
||||
$db .= PHP_EOL."\t`ordering` INT(11) NOT NULL DEFAULT '0',";
|
||||
$db .= PHP_EOL."\t`ordering` INT(11) NOT NULL DEFAULT 0,";
|
||||
}
|
||||
// check if metadata is added to this view
|
||||
if (isset($this->metadataBuilder[$view]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view]))
|
||||
@ -7332,8 +7382,10 @@ class Interpretation extends Fields
|
||||
{
|
||||
// setup Ajax files
|
||||
$target = array('admin' => 'import_'.$viewName_list);
|
||||
$this->buildDynamique($target,'customimport');
|
||||
$this->buildDynamique($target, 'customimport');
|
||||
// load the custom script to the files
|
||||
// ###IMPORT_EXT_METHOD_CUSTOM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_EXT_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_ext', 'import_'.$viewName_list, PHP_EOL, null, true);
|
||||
// ###IMPORT_DISPLAY_METHOD_CUSTOM### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_DISPLAY_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_display', 'import_'.$viewName_list, PHP_EOL, null, true);
|
||||
// ###IMPORT_SETDATE_METHOD_CUSTOM### <<<DYNAMIC>>>
|
||||
@ -9167,6 +9219,31 @@ class Interpretation extends Fields
|
||||
$otherViews = $viewName_list;
|
||||
$otherView = $viewName_single;
|
||||
}
|
||||
// load the category helper details in not already loaded
|
||||
if (!isset($this->fileContentDynamic['category'.$otherViews]['###view###']))
|
||||
{
|
||||
// lets also set the category helper for this view
|
||||
$target = array('site' => 'category'.$viewName_list);
|
||||
$this->buildDynamique($target, 'category');
|
||||
// insure the file gets updated
|
||||
$this->fileContentDynamic['category'.$otherViews]['###view###'] = $otherView;
|
||||
$this->fileContentDynamic['category'.$otherViews]['###View###'] = ucfirst($otherView);
|
||||
$this->fileContentDynamic['category'.$otherViews]['###views###'] = $otherViews;
|
||||
$this->fileContentDynamic['category'.$otherViews]['###Views###'] = ucfirst($otherViews);
|
||||
// set script to global helper file
|
||||
$includeHelper = array();
|
||||
$includeHelper[] = "\n//".$this->setLine(__LINE__)."Insure this view category file is loaded.";
|
||||
$includeHelper[] = "\$classname = '".$this->fileContentStatic['###component###'] . ucfirst($viewName_list) . "Categories';";
|
||||
$includeHelper[] = "if (!class_exists(\$classname))";
|
||||
$includeHelper[] = "{";
|
||||
$includeHelper[] = "\t\$path = JPATH_SITE . '/components/com_".$this->fileContentStatic['###component###']."/helpers/category" . $viewName_list . ".php';";
|
||||
$includeHelper[] = "\tif (is_file(\$path))";
|
||||
$includeHelper[] = "\t{";
|
||||
$includeHelper[] = "\t\tinclude_once \$path;";
|
||||
$includeHelper[] = "\t}";
|
||||
$includeHelper[] = "}";
|
||||
$this->fileContentStatic['###CATEGORY_CLASS_TREES###'] .= implode("\n",$includeHelper);
|
||||
}
|
||||
// return category view string
|
||||
if (isset($this->fileContentStatic['###ROUTER_CATEGORY_VIEWS###']) && ComponentbuilderHelper::checkString($this->fileContentStatic['###ROUTER_CATEGORY_VIEWS###']))
|
||||
{
|
||||
@ -9543,7 +9620,7 @@ class Interpretation extends Fields
|
||||
$allow[] = PHP_EOL."\t\t\t\$catid = 0;";
|
||||
$allow[] = "\t\t\tif (isset(\$this->getItem(\$id)->catid))";
|
||||
$allow[] = "\t\t\t{";
|
||||
$allow[] = "\t\t\t\t//".$this->setLine(__LINE__)." set catagory id";
|
||||
$allow[] = "\t\t\t\t//".$this->setLine(__LINE__)." set category id";
|
||||
$allow[] = "\t\t\t\t\$catid = \$this->getItem(\$id)->catid;";
|
||||
$allow[] = PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Existing record. Can only edit in selected categories.";
|
||||
$allow[] = "\t\t\t\t\$form->setFieldAttribute('catid', 'action', 'core.edit');";
|
||||
@ -11060,7 +11137,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
$otherViews = $name_list;
|
||||
// build lang
|
||||
$langName = 'Catagory For<br />'.ComponentbuilderHelper::safeString($otherViews, 'W');
|
||||
$langName = 'Category For<br />'.ComponentbuilderHelper::safeString($otherViews, 'W');
|
||||
}
|
||||
if(!in_array($otherViews,$catArray))
|
||||
{
|
||||
@ -11817,25 +11894,43 @@ class Interpretation extends Fields
|
||||
$tabCode = ComponentbuilderHelper::safeString($tab).'_custom_config';
|
||||
$tabUpper = ComponentbuilderHelper::safeString($tab,'U');
|
||||
$tabLower = ComponentbuilderHelper::safeString($tab);
|
||||
// load the regust id setters for menu views
|
||||
$viewRequest = 'name="'.$tabLower.'_request_id"';
|
||||
// load the request id setters for menu views
|
||||
$viewRequest = 'name="'.$tabLower.'_request_id';
|
||||
foreach($tabFields as $et => $id_field)
|
||||
{
|
||||
if(strpos($id_field,$viewRequest) !== false)
|
||||
{
|
||||
// set the values needed to insure route is done correclty
|
||||
$this->hasIdRequest[$tabLower] = $id_field;
|
||||
$this->setRequestValues($tabLower, $id_field, $viewRequest, 'id', 'hasIdRequest');
|
||||
unset($tabFields[$et]);
|
||||
}
|
||||
elseif (strpos($id_field,'_request_id"') !== false)
|
||||
elseif (strpos($id_field,'_request_id') !== false)
|
||||
{
|
||||
// not loaded to a tab "view" name
|
||||
$_viewRequest = ComponentbuilderHelper::getBetween($id_field,'name="','_request_id"');
|
||||
// set the values needed to insure route is done correclty
|
||||
$this->hasIdRequest[$_viewRequest] = $id_field;
|
||||
$_viewRequest = ComponentbuilderHelper::getBetween($id_field,'name="','_request_id');
|
||||
$searchIdKe = 'name="'.$_viewRequest.'_request_id';
|
||||
$this->setRequestValues($_viewRequest, $id_field, $searchIdKe, 'id', 'hasIdRequest');
|
||||
unset($tabFields[$et]);
|
||||
}
|
||||
}
|
||||
// load the request catid setters for menu views
|
||||
$viewRequestC = 'name="'.$tabLower.'_request_catid';
|
||||
foreach($tabFields as $ci => $catid_field)
|
||||
{
|
||||
if(strpos($catid_field,$viewRequestC) !== false)
|
||||
{
|
||||
|
||||
$this->setRequestValues($tabLower, $catid_field, $viewRequestC, 'catid', 'hasCatIdRequest');
|
||||
unset($tabFields[$ci]);
|
||||
}
|
||||
elseif (strpos($catid_field,'_request_catid') !== false)
|
||||
{
|
||||
// not loaded to a tab "view" name
|
||||
$_viewRequestC = ComponentbuilderHelper::getBetween($catid_field,'name="','_request_catid');
|
||||
$searchCatidKe = 'name="'.$_viewRequestC.'_request_catid';
|
||||
$this->setRequestValues($_viewRequestC, $catid_field, $searchCatidKe, 'catid', 'hasCatIdRequest');
|
||||
unset($tabFields[$ci]);
|
||||
}
|
||||
}
|
||||
// load the global menu setters for single fields
|
||||
$menuSetter = $tabLower.'_menu';
|
||||
$pageSettings = array();
|
||||
@ -11867,6 +11962,29 @@ class Interpretation extends Fields
|
||||
}
|
||||
}
|
||||
|
||||
protected function setRequestValues($view, $field, $search, $target, $store)
|
||||
{
|
||||
$key = ComponentbuilderHelper::getBetween($field, $search, '"');
|
||||
if (!ComponentbuilderHelper::checkString($key))
|
||||
{
|
||||
// is not having special var
|
||||
$key = $target;
|
||||
// update field
|
||||
$field = str_replace($search . '"', 'name="'. $key . '"', $field);
|
||||
}
|
||||
else
|
||||
{
|
||||
// update field
|
||||
$field = str_replace($search . $key . '"', 'name="'. $key . '"', $field);
|
||||
}
|
||||
if (!isset($this->{$store}[$view]))
|
||||
{
|
||||
$this->{$store}[$view] = array();
|
||||
}
|
||||
// set the values needed for view requests to be made
|
||||
$this->{$store}[$view][$key] = $field;
|
||||
}
|
||||
|
||||
public function setCustomControlConfigFieldsets($lang)
|
||||
{
|
||||
// add custom new global fields set
|
||||
@ -13326,29 +13444,7 @@ function vdm_dkim() {
|
||||
$this->componentGlobal[$sortKey] = "\t\t".'<action name="site.'.$siteCode.'.access" title="'.$siteTitle.'" description="'.$siteDesc.'" />';
|
||||
}
|
||||
// add the custom permissions to use the buttons of this view
|
||||
/* if (ComponentbuilderHelper::checkArray($site_view['settings']->custom_buttons))
|
||||
{
|
||||
foreach ($site_view['settings']->custom_buttons as $custom_buttons)
|
||||
{
|
||||
$siteButtonName = $custom_buttons['name'];
|
||||
$siteButtonCode = ComponentbuilderHelper::safeString($siteButtonName);
|
||||
$siteButtonTitle = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($siteName.' '.$siteButtonName.' Button Access','U');
|
||||
$siteButtonDesc = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($siteName.' '.$siteButtonName.' Button Access','U').'_DESC';
|
||||
$sortButtonKey = ComponentbuilderHelper::safeString($siteButtonTitle);
|
||||
$this->langContent['admin'][$siteButtonTitle] = $siteName.' '.$siteButtonName.' Button Access';
|
||||
$this->langContent['admin'][$siteButtonDesc] = ' Allows the users in this group to access the '.ComponentbuilderHelper::safeString($siteButtonName,'w').' button.';
|
||||
$this->componentGlobal[$sortButtonKey] = "\t\t".'<action name="'.$siteCode.'.'.$siteButtonCode.'" title="'.$siteButtonTitle.'" description="'.$siteButtonDesc.'" />';
|
||||
}
|
||||
}
|
||||
// add menu controll view that has menus options
|
||||
foreach ($menuControllers as $menuController)
|
||||
{
|
||||
// add menu controll view that has menus options
|
||||
if ($site_view[$menuController])
|
||||
{
|
||||
// TODO for CUSTOM MENUS!!!
|
||||
}
|
||||
} */
|
||||
$this->addCustomButtonPermissions($site_view['settings'], $siteName, $siteCode);
|
||||
}
|
||||
}
|
||||
if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))
|
||||
|
@ -34,6 +34,7 @@ class Infusion extends Interpretation
|
||||
|
||||
public $eximportView = array();
|
||||
public $importCustomScripts = array();
|
||||
public $langFiles = array();
|
||||
public $removeSiteFolder = false;
|
||||
|
||||
/**
|
||||
@ -79,13 +80,13 @@ class Infusion extends Interpretation
|
||||
if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))
|
||||
{
|
||||
// ###COMPONENT###
|
||||
$this->fileContentStatic['###COMPONENT###'] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U');
|
||||
$this->fileContentStatic['###COMPONENT###'] = $this->placeholders['###COMPONENT###'];
|
||||
|
||||
// ###Component###
|
||||
$this->fileContentStatic['###Component###'] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'F');
|
||||
$this->fileContentStatic['###Component###'] = $this->placeholders['###Component###'];
|
||||
|
||||
// ###component###
|
||||
$this->fileContentStatic['###component###'] = ComponentbuilderHelper::safeString($this->componentData->name_code);
|
||||
$this->fileContentStatic['###component###'] = $this->placeholders['###component###'];
|
||||
|
||||
// ###COMPANYNAME###
|
||||
$this->fileContentStatic['###COMPANYNAME###'] = trim(JFilterOutput::cleanText($this->componentData->companyname));
|
||||
@ -132,19 +133,12 @@ class Infusion extends Interpretation
|
||||
// ###ACCESS_SECTIONS###
|
||||
$this->fileContentStatic['###ACCESS_SECTIONS###'] = $this->setAccessSections();
|
||||
|
||||
// set component place holders
|
||||
$this->placeholders = array(
|
||||
'###Component###' => $this->fileContentStatic['###Component###'],
|
||||
'###component###' => $this->fileContentStatic['###component###'],
|
||||
'###COMPONENT###' => $this->fileContentStatic['###COMPONENT###'],
|
||||
'[[[Component]]]' => $this->fileContentStatic['###Component###'],
|
||||
'[[[component]]]' => $this->fileContentStatic['###component###'],
|
||||
'[[[COMPONENT]]]' => $this->fileContentStatic['###COMPONENT###']
|
||||
);
|
||||
|
||||
// ###CONFIG_FIELDSETS###
|
||||
$keepLang = $this->lang;
|
||||
$this->lang = 'admin';
|
||||
|
||||
// start loading the category tree scripts
|
||||
$this->fileContentStatic['###CATEGORY_CLASS_TREES###'] = '';
|
||||
// run the field sets for first time
|
||||
$this->setConfigFieldsets(1);
|
||||
$this->lang = $keepLang;
|
||||
@ -215,6 +209,9 @@ class Infusion extends Interpretation
|
||||
// start dynamic build
|
||||
foreach ($this->componentData->admin_views as $view)
|
||||
{
|
||||
// just to be safe, lets clear the view placeholders
|
||||
$this->clearFromPlaceHolders('view');
|
||||
// set the target
|
||||
$this->target = 'admin';
|
||||
$this->lang = 'admin';
|
||||
// set main keys
|
||||
@ -252,11 +249,11 @@ class Infusion extends Interpretation
|
||||
|
||||
// set some place holder for the views
|
||||
$this->placeholders['###view###'] = $viewName_single;
|
||||
$this->placeholders['###VIEW###'] = $viewName_u;
|
||||
$this->placeholders['###View###'] = $viewName_f;
|
||||
$this->placeholders['###VIEW###'] = $viewName_u;
|
||||
$this->placeholders['[[[view]]]'] = $viewName_single;
|
||||
$this->placeholders['[[[VIEW]]]'] = $viewName_u;
|
||||
$this->placeholders['[[[View]]]'] = $viewName_f;
|
||||
$this->placeholders['[[[VIEW]]]'] = $viewName_u;
|
||||
|
||||
// set license per view if needed
|
||||
$this->setLockLicensePer($viewName_single, $this->target);
|
||||
@ -388,11 +385,11 @@ class Infusion extends Interpretation
|
||||
|
||||
// set some place holder for the views
|
||||
$this->placeholders['###views###'] = $viewName_list;
|
||||
$this->placeholders['###VIEWS###'] = $viewsName_u;
|
||||
$this->placeholders['###Views###'] = $viewsName_f;
|
||||
$this->placeholders['###VIEWS###'] = $viewsName_u;
|
||||
$this->placeholders['[[[views]]]'] = $viewName_list;
|
||||
$this->placeholders['[[[VIEWS]]]'] = $viewsName_u;
|
||||
$this->placeholders['[[[Views]]]'] = $viewsName_f;
|
||||
$this->placeholders['[[[VIEWS]]]'] = $viewsName_u;
|
||||
|
||||
// set the export/import option
|
||||
if ($view['port'])
|
||||
@ -425,6 +422,8 @@ class Infusion extends Interpretation
|
||||
// ###CHECKINCALL### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_list]['###CHECKINCALL###'] = '';
|
||||
}
|
||||
// ###ADMIN_CUSTOM_BUTTONS_LIST###
|
||||
$this->fileContentDynamic[$viewName_list]['###ADMIN_CUSTOM_BUTTONS_LIST###'] = $this->setCustomButtons($view, 3, "\t");
|
||||
|
||||
// ###GET_ITEMS_METHOD_STRING_FIX### <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$viewName_list]['###GET_ITEMS_METHOD_STRING_FIX###'] = $this->setGetItemsMethodStringFix($viewName_single,$this->fileContentStatic['###Component###']);
|
||||
@ -1020,18 +1019,6 @@ class Infusion extends Interpretation
|
||||
$this->removeSiteFolder = true;
|
||||
}
|
||||
|
||||
// ###LANG_ADMIN###
|
||||
$this->fileContentStatic['###LANG_ADMIN###'] = $this->setLangAdmin();
|
||||
|
||||
// ###LANG_ADMIN_SYS###
|
||||
$this->fileContentStatic['###LANG_ADMIN_SYS###'] = $this->setLangAdminSys();
|
||||
|
||||
// ###LANG_SITE###
|
||||
$this->fileContentStatic['###LANG_SITE###'] = $this->setLangSite();
|
||||
|
||||
// ###LANG_SITE_SYS###
|
||||
$this->fileContentStatic['###LANG_SITE_SYS###'] = $this->setLangSiteSys();
|
||||
|
||||
// ###PREINSTALLSCRIPT###
|
||||
$this->fileContentStatic['###PREINSTALLSCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'install', PHP_EOL, null, true);
|
||||
|
||||
@ -1073,4 +1060,40 @@ class Infusion extends Interpretation
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the lang values and insert to fiel
|
||||
*
|
||||
*
|
||||
* @return boolean on success
|
||||
*
|
||||
*/
|
||||
|
||||
public function setLangFileData()
|
||||
{
|
||||
// First we build the strings
|
||||
$lang = array();
|
||||
// ###LANG_ADMIN###
|
||||
$lang['###LANG_ADMIN###'] = $this->setLangAdmin();
|
||||
// ###LANG_ADMIN_SYS###
|
||||
$lang['###LANG_ADMIN_SYS###'] = $this->setLangAdminSys();
|
||||
// ###LANG_SITE###
|
||||
$lang['###LANG_SITE###'] = $this->setLangSite();
|
||||
// ###LANG_SITE_SYS###
|
||||
$lang['###LANG_SITE_SYS###'] = $this->setLangSiteSys();
|
||||
// now we insert the values into the files
|
||||
if (ComponentbuilderHelper::checkArray($this->langFiles))
|
||||
{
|
||||
foreach ($this->langFiles as $file)
|
||||
{
|
||||
$string = JFile::read($file['path']);
|
||||
// load the data
|
||||
$answer = $this->setPlaceholders($string, $lang, 3);
|
||||
// add to zip array
|
||||
$this->writeFile($file['path'],$answer);
|
||||
// set the line counter
|
||||
$this->lineCount = $this->lineCount + substr_count($answer, PHP_EOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
@ -37,13 +37,16 @@ abstract class ComponentbuilderHelper
|
||||
*/
|
||||
public static function autoLoader($type = 'compiler')
|
||||
{
|
||||
// load the compiler classes
|
||||
// load the type classes
|
||||
if ('smart' !== $type)
|
||||
{
|
||||
foreach (glob(JPATH_ADMINISTRATOR."/components/com_componentbuilder/helpers/".$type."/*.php") as $autoFile)
|
||||
{
|
||||
require_once $autoFile;
|
||||
}
|
||||
}
|
||||
// load only if compiler
|
||||
if ('compiler' == $type)
|
||||
if ('compiler' === $type)
|
||||
{
|
||||
// import the Joomla librarys
|
||||
jimport('joomla.filesystem.file');
|
||||
@ -53,6 +56,15 @@ abstract class ComponentbuilderHelper
|
||||
// include class to minify js
|
||||
require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/js.php';
|
||||
}
|
||||
// load only if smart
|
||||
if ('smart' === $type)
|
||||
{
|
||||
// import the Joomla libraries
|
||||
jimport('joomla.filesystem.file');
|
||||
jimport('joomla.filesystem.folder');
|
||||
jimport('joomla.filesystem.archive');
|
||||
jimport('joomla.application.component.modellist');
|
||||
}
|
||||
// load this for all
|
||||
jimport('joomla.application');
|
||||
}
|
||||
@ -66,6 +78,108 @@ abstract class ComponentbuilderHelper
|
||||
$extruder = new Extrusion($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* The zipper method
|
||||
**/
|
||||
public static function zip($workingDIR, &$filepath)
|
||||
{
|
||||
// store the current joomla working directory
|
||||
$joomla = getcwd();
|
||||
|
||||
// we are changing the working directory to the component temp folder
|
||||
chdir($workingDIR);
|
||||
|
||||
// the full file path of the zip file
|
||||
$filepath = JPath::clean($filepath);
|
||||
|
||||
// delete an existing zip file (or use an exclusion parameter in JFolder::files()
|
||||
JFile::delete($filepath);
|
||||
|
||||
// get a list of files in the current directory tree
|
||||
$files = JFolder::files('.', '', true, true);
|
||||
$zipArray = array();
|
||||
// setup the zip array
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$tmp = array();
|
||||
$tmp['name'] = str_replace('./', '', $file);
|
||||
$tmp['data'] = JFile::read($file);
|
||||
$tmp['time'] = filemtime($file);
|
||||
$zipArray[] = $tmp;
|
||||
}
|
||||
|
||||
// change back to joomla working directory
|
||||
chdir($joomla);
|
||||
|
||||
// get the zip adapter
|
||||
$zip = JArchive::getAdapter('zip');
|
||||
|
||||
//create the zip file
|
||||
if ($zip->create($filepath, $zipArray))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove folders with files
|
||||
*
|
||||
* @param string $dir The path to folder to remove
|
||||
* @param boolean $git if there is a git folder in that must not be removed
|
||||
*
|
||||
* @return boolean True in all is removed
|
||||
*
|
||||
*/
|
||||
public static function removeFolder($dir, $git = false)
|
||||
{
|
||||
if (JFolder::exists($dir))
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir);
|
||||
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
foreach ($it as $file)
|
||||
{
|
||||
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
|
||||
if ($file->isDir())
|
||||
{
|
||||
if ($git && strpos($file->getPathname(), $dir.'/.git') !== false) continue;
|
||||
JFolder::delete($file->getPathname());
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($git && strpos($file->getPathname(), $dir.'/.git') !== false) continue;
|
||||
JFile::delete($file->getPathname());
|
||||
}
|
||||
}
|
||||
if (!$git && JFolder::delete($dir))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create file and write data to the file
|
||||
**/
|
||||
public static function writeFile($path, $data)
|
||||
{
|
||||
$fh = fopen($path, "w");
|
||||
if (!is_resource($fh))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (fwrite($fh, $data))
|
||||
{
|
||||
// close file.
|
||||
fclose($fh);
|
||||
return true;
|
||||
}
|
||||
// close file.
|
||||
fclose($fh);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The user notice info File Name
|
||||
**/
|
||||
@ -279,6 +393,679 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getImportScripts($type, $fieldName = false)
|
||||
{
|
||||
// if field name is pased the convert to type
|
||||
if ($fieldName)
|
||||
{
|
||||
$fieldNames = array(
|
||||
'php_import_display' => 'display',
|
||||
'php_import_setdata' => 'setdata',
|
||||
'php_import_save' => 'save',
|
||||
'html_import_view' => 'view',
|
||||
'php_import' => 'import',
|
||||
'php_import_ext' => 'ext'
|
||||
);
|
||||
// first check if the field name is found
|
||||
if (isset($fieldNames[$type]))
|
||||
{
|
||||
$type = $fieldNames[$type];
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
$script = array();
|
||||
if ('display' === $type)
|
||||
{
|
||||
// set the display script
|
||||
$script['display'][] = "\tprotected \$headerList;";
|
||||
$script['display'][] = "\tprotected \$hasPackage = false;";
|
||||
$script['display'][] = "\tprotected \$headers;";
|
||||
$script['display'][] = "\tprotected \$hasHeader = 0;";
|
||||
$script['display'][] = "\tprotected \$dataType;";
|
||||
$script['display'][] = "\n\tpublic function display(\$tpl = null)";
|
||||
$script['display'][] = "\t{";
|
||||
$script['display'][] = "\t\tif (\$this->getLayout() !== 'modal')";
|
||||
$script['display'][] = "\t\t{";
|
||||
$script['display'][] = "\t\t\t// Include helper submenu";
|
||||
$script['display'][] = "\t\t\t###-#-#-Component###Helper::addSubmenu('import');";
|
||||
$script['display'][] = "\t\t}";
|
||||
$script['display'][] = "\n\t\t// Check for errors.";
|
||||
$script['display'][] = "\t\tif (count(\$errors = \$this->get('Errors'))){";
|
||||
$script['display'][] = "\t\t\tJError::raiseError(500, implode('<br />', \$errors));";
|
||||
$script['display'][] = "\t\t\treturn false;";
|
||||
$script['display'][] = "\t\t}";
|
||||
$script['display'][] = "\n\t\t\$paths = new stdClass;";
|
||||
$script['display'][] = "\t\t\$paths->first = '';";
|
||||
$script['display'][] = "\t\t\$state = \$this->get('state');";
|
||||
$script['display'][] = "\n\t\t\$this->paths = &\$paths;";
|
||||
$script['display'][] = "\t\t\$this->state = &\$state;";
|
||||
$script['display'][] = "\t\t// get global action permissions";
|
||||
$script['display'][] = "\t\t\$this->canDo = ###-#-#-Component###Helper::getActions('import');";
|
||||
$script['display'][] = "\n\t\t// We don't need toolbar in the modal window.";
|
||||
$script['display'][] = "\t\tif (\$this->getLayout() !== 'modal')";
|
||||
$script['display'][] = "\t\t{";
|
||||
$script['display'][] = "\t\t\t\$this->addToolbar();";
|
||||
$script['display'][] = "\t\t\t\$this->sidebar = JHtmlSidebar::render();";
|
||||
$script['display'][] = "\t\t}";
|
||||
$script['display'][] = "\n\t\t// get the session object";
|
||||
$script['display'][] = "\t\t\$session = JFactory::getSession();";
|
||||
$script['display'][] = "\t\t// check if it has package";
|
||||
$script['display'][] = "\t\t\$this->hasPackage \t= \$session->get('hasPackage', false);";
|
||||
$script['display'][] = "\t\t\$this->dataType \t= \$session->get('dataType', false);";
|
||||
$script['display'][] = "\t\tif(\$this->hasPackage && \$this->dataType)";
|
||||
$script['display'][] = "\t\t{";
|
||||
$script['display'][] = "\t\t\t\$this->headerList \t= json_decode(\$session->get(\$this->dataType.'_VDM_IMPORTHEADERS', false),true);";
|
||||
$script['display'][] = "\t\t\t\$this->headers \t\t= ###-#-#-Component###Helper::getFileHeaders(\$this->dataType);";
|
||||
$script['display'][] = "\t\t\t// clear the data type";
|
||||
$script['display'][] = "\t\t\t\$session->clear('dataType');";
|
||||
$script['display'][] = "\t\t}";
|
||||
$script['display'][] = "\n\t\t// Display the template";
|
||||
$script['display'][] = "\t\tparent::display(\$tpl);";
|
||||
$script['display'][] = "\t}";
|
||||
}
|
||||
elseif ('setdata' === $type)
|
||||
{
|
||||
// set the setdata script
|
||||
$script['setdata'] = array();
|
||||
$script['setdata'][] = "\t/**";
|
||||
$script['setdata'][] = "\t* Set the data from the spreadsheet to the database";
|
||||
$script['setdata'][] = "\t*";
|
||||
$script['setdata'][] = "\t* @param string \$package Paths to the uploaded package file";
|
||||
$script['setdata'][] = "\t*";
|
||||
$script['setdata'][] = "\t* @return boolean false on failure";
|
||||
$script['setdata'][] = "\t*";
|
||||
$script['setdata'][] = "\t**/";
|
||||
$script['setdata'][] = "\tprotected function setData(\$package,\$table,\$target_headers)";
|
||||
$script['setdata'][] = "\t{";
|
||||
$script['setdata'][] = "\t\tif (###-#-#-Component###Helper::checkArray(\$target_headers))";
|
||||
$script['setdata'][] = "\t\t{";
|
||||
$script['setdata'][] = "\t\t\t// make sure the file is loaded\t\t";
|
||||
$script['setdata'][] = "\t\t\tJLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');";
|
||||
$script['setdata'][] = "\t\t\t\$jinput = JFactory::getApplication()->input;";
|
||||
$script['setdata'][] = "\t\t\tforeach(\$target_headers as \$header)";
|
||||
$script['setdata'][] = "\t\t\t{";
|
||||
$script['setdata'][] = "\t\t\t\t\$data['target_headers'][\$header] = \$jinput->getString(\$header, null);";
|
||||
$script['setdata'][] = "\t\t\t}";
|
||||
$script['setdata'][] = "\t\t\t// set the data";
|
||||
$script['setdata'][] = "\t\t\tif(isset(\$package['dir']))";
|
||||
$script['setdata'][] = "\t\t\t{";
|
||||
$script['setdata'][] = "\t\t\t\t\$inputFileType = PHPExcel_IOFactory::identify(\$package['dir']);";
|
||||
$script['setdata'][] = "\t\t\t\t\$excelReader = PHPExcel_IOFactory::createReader(\$inputFileType);";
|
||||
$script['setdata'][] = "\t\t\t\t\$excelReader->setReadDataOnly(true);";
|
||||
$script['setdata'][] = "\t\t\t\t\$excelObj = \$excelReader->load(\$package['dir']);";
|
||||
$script['setdata'][] = "\t\t\t\t\$data['array'] = \$excelObj->getActiveSheet()->toArray(null, true,true,true);";
|
||||
$script['setdata'][] = "\t\t\t\t\$excelObj->disconnectWorksheets();";
|
||||
$script['setdata'][] = "\t\t\t\tunset(\$excelObj);";
|
||||
$script['setdata'][] = "\t\t\t\treturn \$this->save(\$data,\$table);";
|
||||
$script['setdata'][] = "\t\t\t}";
|
||||
$script['setdata'][] = "\t\t}";
|
||||
$script['setdata'][] = "\t\treturn false;";
|
||||
$script['setdata'][] = "\t}";
|
||||
}
|
||||
elseif ('save' === $type)
|
||||
{
|
||||
$script['save'] = array();
|
||||
$script['save'][] = "\t/**";
|
||||
$script['save'][] = "\t* Save the data from the file to the database";
|
||||
$script['save'][] = "\t*";
|
||||
$script['save'][] = "\t* @param string \$package Paths to the uploaded package file";
|
||||
$script['save'][] = "\t*";
|
||||
$script['save'][] = "\t* @return boolean false on failure";
|
||||
$script['save'][] = "\t*";
|
||||
$script['save'][] = "\t**/";
|
||||
$script['save'][] = "\tprotected function save(\$data,\$table)";
|
||||
$script['save'][] = "\t{";
|
||||
$script['save'][] = "\t\t// import the data if there is any";
|
||||
$script['save'][] = "\t\tif(###-#-#-Component###Helper::checkArray(\$data['array']))";
|
||||
$script['save'][] = "\t\t{";
|
||||
$script['save'][] = "\t\t\t// get user object";
|
||||
$script['save'][] = "\t\t\t\$user \t\t= JFactory::getUser();";
|
||||
$script['save'][] = "\t\t\t// remove header if it has headers";
|
||||
$script['save'][] = "\t\t\t\$id_key \t= \$data['target_headers']['id'];";
|
||||
$script['save'][] = "\t\t\t\$published_key \t= \$data['target_headers']['published'];";
|
||||
$script['save'][] = "\t\t\t\$ordering_key \t= \$data['target_headers']['ordering'];";
|
||||
$script['save'][] = "\t\t\t// get the first array set";
|
||||
$script['save'][] = "\t\t\t\$firstSet = reset(\$data['array']);";
|
||||
$script['save'][] = "";
|
||||
$script['save'][] = "\t\t\t// check if first array is a header array and remove if true";
|
||||
$script['save'][] = "\t\t\tif(\$firstSet[\$id_key] == 'id' || \$firstSet[\$published_key] == 'published' || \$firstSet[\$ordering_key] == 'ordering')";
|
||||
$script['save'][] = "\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\tarray_shift(\$data['array']);";
|
||||
$script['save'][] = "\t\t\t}";
|
||||
$script['save'][] = "\t\t\t";
|
||||
$script['save'][] = "\t\t\t// make sure there is still values in array and that it was not only headers";
|
||||
$script['save'][] = "\t\t\tif(###-#-#-Component###Helper::checkArray(\$data['array']) && \$user->authorise(\$table.'.import', 'com_###-#-#-component###') && \$user->authorise('core.import', 'com_###-#-#-component###'))";
|
||||
$script['save'][] = "\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t// set target.";
|
||||
$script['save'][] = "\t\t\t\t\$target\t= array_flip(\$data['target_headers']);";
|
||||
$script['save'][] = "\t\t\t\t// Get a db connection.";
|
||||
$script['save'][] = "\t\t\t\t\$db = JFactory::getDbo();";
|
||||
$script['save'][] = "\t\t\t\t// set some defaults";
|
||||
$script['save'][] = "\t\t\t\t\$todayDate\t\t= JFactory::getDate()->toSql();";
|
||||
$script['save'][] = "\t\t\t\t// get global action permissions";
|
||||
$script['save'][] = "\t\t\t\t\$canDo\t\t\t= ###-#-#-Component###Helper::getActions(\$table);";
|
||||
$script['save'][] = "\t\t\t\t\$canEdit\t\t= \$canDo->get('core.edit');";
|
||||
$script['save'][] = "\t\t\t\t\$canState\t\t= \$canDo->get('core.edit.state');";
|
||||
$script['save'][] = "\t\t\t\t\$canCreate\t\t= \$canDo->get('core.create');";
|
||||
$script['save'][] = "\t\t\t\t\$hasAlias\t\t= \$this->getAliasesUsed(\$table);";
|
||||
$script['save'][] = "\t\t\t\t// prosses the data";
|
||||
$script['save'][] = "\t\t\t\tforeach(\$data['array'] as \$row)";
|
||||
$script['save'][] = "\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\$found = false;";
|
||||
$script['save'][] = "\t\t\t\t\tif (isset(\$row[\$id_key]) && is_numeric(\$row[\$id_key]) && \$row[\$id_key] > 0)";
|
||||
$script['save'][] = "\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t// raw items import & update!";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$query = \$db->getQuery(true);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$query";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t->select('version')";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t->from(\$db->quoteName('#__###-#-#-component###_'.\$table))";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t->where(\$db->quoteName('id') . ' = '. \$db->quote(\$row[\$id_key]));";
|
||||
$script['save'][] = "\t\t\t\t\t\t// Reset the query using our newly populated query object.";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$db->setQuery(\$query);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$db->execute();";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$found = \$db->getNumRows();";
|
||||
$script['save'][] = "\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t";
|
||||
$script['save'][] = "\t\t\t\t\tif(\$found && \$canEdit)";
|
||||
$script['save'][] = "\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t// update item";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$id \t\t= \$row[\$id_key];";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$version\t= \$db->loadResult();";
|
||||
$script['save'][] = "\t\t\t\t\t\t// reset all buckets";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$query \t\t= \$db->getQuery(true);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$fields \t= array();";
|
||||
$script['save'][] = "\t\t\t\t\t\t// Fields to update.";
|
||||
$script['save'][] = "\t\t\t\t\t\tforeach(\$row as \$key => \$cell)";
|
||||
$script['save'][] = "\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// ignore column";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('IGNORE' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\tcontinue;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// update modified";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('modified_by' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\tcontinue;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// update modified";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('modified' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\tcontinue;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// update version";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('version' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$cell = (int) \$version + 1;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// verify publish authority";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('published' == \$target[\$key] && !\$canState)";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\tcontinue;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// set to update array";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif(in_array(\$key, \$data['target_headers']) && is_numeric(\$cell))";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$fields[] = \$db->quoteName(\$target[\$key]) . ' = ' . \$cell;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\telseif(in_array(\$key, \$data['target_headers']) && is_string(\$cell))";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$fields[] = \$db->quoteName(\$target[\$key]) . ' = ' . \$db->quote(\$cell);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\telseif(in_array(\$key, \$data['target_headers']) && is_null(\$cell))";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t// if import data is null then set empty";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$fields[] = \$db->quoteName(\$target[\$key]) . \" = ''\";";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t// load the defaults";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$fields[]\t= \$db->quoteName('modified_by') . ' = ' . \$db->quote(\$user->id);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$fields[]\t= \$db->quoteName('modified') . ' = ' . \$db->quote(\$todayDate);";
|
||||
$script['save'][] = "\t\t\t\t\t\t// Conditions for which records should be updated.";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$conditions = array(";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\$db->quoteName('id') . ' = ' . \$id";
|
||||
$script['save'][] = "\t\t\t\t\t\t);";
|
||||
$script['save'][] = "\t\t\t\t\t\t";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$query->update(\$db->quoteName('#__###-#-#-component###_'.\$table))->set(\$fields)->where(\$conditions);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$db->setQuery(\$query);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$db->execute();";
|
||||
$script['save'][] = "\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\telseif (\$canCreate)";
|
||||
$script['save'][] = "\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t// insert item";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$query = \$db->getQuery(true);";
|
||||
$script['save'][] = "\t\t\t\t\t\t// reset all buckets";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$columns \t= array();";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$values \t= array();";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$version\t= false;";
|
||||
$script['save'][] = "\t\t\t\t\t\t// Insert columns. Insert values.";
|
||||
$script['save'][] = "\t\t\t\t\t\tforeach(\$row as \$key => \$cell)";
|
||||
$script['save'][] = "\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// ignore column";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('IGNORE' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\tcontinue;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// remove id";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('id' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\tcontinue;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// update created";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('created_by' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\tcontinue;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// update created";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('created' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\tcontinue;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// Make sure the alias is incremented";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('alias' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$cell = \$this->getAlias(\$cell,\$table);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// update version";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif ('version' == \$target[\$key])";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$cell = 1;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$version = true;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// set to insert array";
|
||||
$script['save'][] = "\t\t\t\t\t\t\tif(in_array(\$key, \$data['target_headers']) && is_numeric(\$cell))";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$columns[] \t= \$target[\$key];";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$values[] \t= \$cell;";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\telseif(in_array(\$key, \$data['target_headers']) && is_string(\$cell))";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$columns[] \t= \$target[\$key];";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$values[] \t= \$db->quote(\$cell);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t\telseif(in_array(\$key, \$data['target_headers']) && is_null(\$cell))";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t// if import data is null then set empty";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$columns[] \t= \$target[\$key];";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\t\$values[] \t= \"''\";";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t// load the defaults";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$columns[] \t= 'created_by';";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$values[] \t= \$db->quote(\$user->id);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$columns[] \t= 'created';";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$values[] \t= \$db->quote(\$todayDate);";
|
||||
$script['save'][] = "\t\t\t\t\t\tif (!\$version)";
|
||||
$script['save'][] = "\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\$columns[] \t= 'version';";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\$values[] \t= 1;";
|
||||
$script['save'][] = "\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t\t// Prepare the insert query.";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$query";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t->insert(\$db->quoteName('#__###-#-#-component###_'.\$table))";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t->columns(\$db->quoteName(\$columns))";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t->values(implode(',', \$values));";
|
||||
$script['save'][] = "\t\t\t\t\t\t// Set the query using our newly populated query object and execute it.";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$db->setQuery(\$query);";
|
||||
$script['save'][] = "\t\t\t\t\t\t\$done = \$db->execute();";
|
||||
$script['save'][] = "\t\t\t\t\t\tif (\$done)";
|
||||
$script['save'][] = "\t\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t\$aId = \$db->insertid();";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t// make sure the access of asset is set";
|
||||
$script['save'][] = "\t\t\t\t\t\t\t###-#-#-Component###Helper::setAsset(\$aId,\$table);";
|
||||
$script['save'][] = "\t\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t\telse";
|
||||
$script['save'][] = "\t\t\t\t\t{";
|
||||
$script['save'][] = "\t\t\t\t\t\treturn false;";
|
||||
$script['save'][] = "\t\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\t}";
|
||||
$script['save'][] = "\t\t\t\treturn true;";
|
||||
$script['save'][] = "\t\t\t}";
|
||||
$script['save'][] = "\t\t}";
|
||||
$script['save'][] = "\t\treturn false;";
|
||||
$script['save'][] = "\t}";
|
||||
}
|
||||
elseif ('view' === $type)
|
||||
{
|
||||
$script['view'] = array();
|
||||
$script['view'][] = "<script type=\"text/javascript\">";
|
||||
$script['view'][] = "<?php if (\$this->hasPackage && ###-#-#-Component###Helper::checkArray(\$this->headerList)) : ?>";
|
||||
$script['view'][] = "\tJoomla.continueImport = function()";
|
||||
$script['view'][] = "\t{";
|
||||
$script['view'][] = "\t\tvar form = document.getElementById('adminForm');";
|
||||
$script['view'][] = "\t\tvar error = false;";
|
||||
$script['view'][] = "\t\tvar therequired = [<?php \$i = 0; foreach(\$this->headerList as \$name => \$title) { echo (\$i != 0)? ', \"vdm_'.\$name.'\"':'\"vdm_'.\$name.'\"'; \$i++; } ?>];";
|
||||
$script['view'][] = "\t\tfor(i = 0; i < therequired.length; i++)";
|
||||
$script['view'][] = "\t\t{";
|
||||
$script['view'][] = "\t\t\tif(jQuery('#'+therequired[i]).val() == \"\" )";
|
||||
$script['view'][] = "\t\t\t{";
|
||||
$script['view'][] = "\t\t\t\terror = true;";
|
||||
$script['view'][] = "\t\t\t\tbreak;";
|
||||
$script['view'][] = "\t\t\t}";
|
||||
$script['view'][] = "\t\t}";
|
||||
$script['view'][] = "\t\t// do field validation";
|
||||
$script['view'][] = "\t\tif (error)";
|
||||
$script['view'][] = "\t\t{";
|
||||
$script['view'][] = "\t\t\talert(\"<?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS', true); ?>\");";
|
||||
$script['view'][] = "\t\t}";
|
||||
$script['view'][] = "\t\telse";
|
||||
$script['view'][] = "\t\t{";
|
||||
$script['view'][] = "\t\t\tjQuery('#loading').css('display', 'block');";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t\t\tform.gettype.value = 'continue';";
|
||||
$script['view'][] = "\t\t\tform.submit();";
|
||||
$script['view'][] = "\t\t}";
|
||||
$script['view'][] = "\t};";
|
||||
$script['view'][] = "<?php else: ?>";
|
||||
$script['view'][] = "\tJoomla.submitbutton = function()";
|
||||
$script['view'][] = "\t{";
|
||||
$script['view'][] = "\t\tvar form = document.getElementById('adminForm');";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t\t// do field validation";
|
||||
$script['view'][] = "\t\tif (form.import_package.value == \"\")";
|
||||
$script['view'][] = "\t\t{";
|
||||
$script['view'][] = "\t\t\talert(\"<?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_MSG_PLEASE_SELECT_A_FILE', true); ?>\");";
|
||||
$script['view'][] = "\t\t}";
|
||||
$script['view'][] = "\t\telse";
|
||||
$script['view'][] = "\t\t{";
|
||||
$script['view'][] = "\t\t\tjQuery('#loading').css('display', 'block');";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t\t\tform.gettype.value = 'upload';";
|
||||
$script['view'][] = "\t\t\tform.submit();";
|
||||
$script['view'][] = "\t\t}";
|
||||
$script['view'][] = "\t};";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\tJoomla.submitbutton3 = function()";
|
||||
$script['view'][] = "\t{";
|
||||
$script['view'][] = "\t\tvar form = document.getElementById('adminForm');";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t\t// do field validation";
|
||||
$script['view'][] = "\t\tif (form.import_directory.value == \"\"){";
|
||||
$script['view'][] = "\t\t\talert(\"<?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY', true); ?>\");";
|
||||
$script['view'][] = "\t\t}";
|
||||
$script['view'][] = "\t\telse";
|
||||
$script['view'][] = "\t\t{";
|
||||
$script['view'][] = "\t\t\tjQuery('#loading').css('display', 'block');";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t\t\tform.gettype.value = 'folder';";
|
||||
$script['view'][] = "\t\t\tform.submit();";
|
||||
$script['view'][] = "\t\t}";
|
||||
$script['view'][] = "\t};";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\tJoomla.submitbutton4 = function()";
|
||||
$script['view'][] = "\t{";
|
||||
$script['view'][] = "\t\tvar form = document.getElementById('adminForm');";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t\t// do field validation";
|
||||
$script['view'][] = "\t\tif (form.import_url.value == \"\" || form.import_url.value == \"http://\")";
|
||||
$script['view'][] = "\t\t{";
|
||||
$script['view'][] = "\t\t\talert(\"<?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_MSG_ENTER_A_URL', true); ?>\");";
|
||||
$script['view'][] = "\t\t}";
|
||||
$script['view'][] = "\t\telse";
|
||||
$script['view'][] = "\t\t{";
|
||||
$script['view'][] = "\t\t\tjQuery('#loading').css('display', 'block');";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t\t\tform.gettype.value = 'url';";
|
||||
$script['view'][] = "\t\t\tform.submit();";
|
||||
$script['view'][] = "\t\t}";
|
||||
$script['view'][] = "\t};";
|
||||
$script['view'][] = "<?php endif; ?>";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n// Add spindle-wheel for importations:";
|
||||
$script['view'][] = "jQuery(document).ready(function(\$) {";
|
||||
$script['view'][] = "\tvar outerDiv = \$('body');";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t\$('<div id=\"loading\"></div>')";
|
||||
$script['view'][] = "\t\t.css(\"background\", \"rgba(255, 255, 255, .8) url('components/com_###-#-#-component###/assets/images/import.gif') 50% 15% no-repeat\")";
|
||||
$script['view'][] = "\t\t.css(\"top\", outerDiv.position().top - \$(window).scrollTop())";
|
||||
$script['view'][] = "\t\t.css(\"left\", outerDiv.position().left - \$(window).scrollLeft())";
|
||||
$script['view'][] = "\t\t.css(\"width\", outerDiv.width())";
|
||||
$script['view'][] = "\t\t.css(\"height\", outerDiv.height())";
|
||||
$script['view'][] = "\t\t.css(\"position\", \"fixed\")";
|
||||
$script['view'][] = "\t\t.css(\"opacity\", \"0.80\")";
|
||||
$script['view'][] = "\t\t.css(\"-ms-filter\", \"progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)\")";
|
||||
$script['view'][] = "\t\t.css(\"filter\", \"alpha(opacity = 80)\")";
|
||||
$script['view'][] = "\t\t.css(\"display\", \"none\")";
|
||||
$script['view'][] = "\t\t.appendTo(outerDiv);";
|
||||
$script['view'][] = "});";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n</script>";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n<div id=\"installer-import\" class=\"clearfix\">";
|
||||
$script['view'][] = "<form enctype=\"multipart/form-data\" action=\"<?php echo JRoute::_('index.php?option=com_###-#-#-component###&view=import_###-#-#-views###');?>\" method=\"post\" name=\"adminForm\" id=\"adminForm\" class=\"form-horizontal form-validate\">";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t<?php if (!empty( \$this->sidebar)) : ?>";
|
||||
$script['view'][] = "\t\t<div id=\"j-sidebar-container\" class=\"span2\">";
|
||||
$script['view'][] = "\t\t\t<?php echo \$this->sidebar; ?>";
|
||||
$script['view'][] = "\t\t</div>";
|
||||
$script['view'][] = "\t\t<div id=\"j-main-container\" class=\"span10\">";
|
||||
$script['view'][] = "\t<?php else : ?>";
|
||||
$script['view'][] = "\t\t<div id=\"j-main-container\">";
|
||||
$script['view'][] = "\t<?php endif;?>";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t<?php if (\$this->hasPackage && ###-#-#-Component###Helper::checkArray(\$this->headerList) && ###-#-#-Component###Helper::checkArray(\$this->headers)) : ?>";
|
||||
$script['view'][] = "\t\t<fieldset class=\"uploadform\">";
|
||||
$script['view'][] = "\t\t\t<legend><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'); ?></legend>";
|
||||
$script['view'][] = "\t\t\t<div class=\"control-group\">";
|
||||
$script['view'][] = "\t\t\t\t<label class=\"control-label\" ><h4><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_TABLE_COLUMNS'); ?></h4></label>";
|
||||
$script['view'][] = "\t\t\t\t<div class=\"controls\">";
|
||||
$script['view'][] = "\t\t\t\t\t<label class=\"control-label\" ><h4><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_FILE_COLUMNS'); ?></h4></label>";
|
||||
$script['view'][] = "\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t<?php foreach(\$this->headerList as \$name => \$title): ?>";
|
||||
$script['view'][] = "\t\t\t\t<div class=\"control-group\">";
|
||||
$script['view'][] = "\t\t\t\t\t<label for=\"<?php echo \$name; ?>\" class=\"control-label\" ><?php echo \$title; ?></label>";
|
||||
$script['view'][] = "\t\t\t\t\t<div class=\"controls\">";
|
||||
$script['view'][] = "\t\t\t\t\t\t<select name=\"<?php echo \$name; ?>\" id=\"vdm_<?php echo \$name; ?>\" required class=\"required input_box\" >";
|
||||
$script['view'][] = "\t\t\t\t\t\t\t<option value=\"\"><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_PLEASE_SELECT_COLUMN'); ?></option>";
|
||||
$script['view'][] = "\t\t\t\t\t\t\t<option value=\"IGNORE\"><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_IGNORE_COLUMN'); ?></option>";
|
||||
$script['view'][] = "\t\t\t\t\t\t\t<?php foreach(\$this->headers as \$value => \$option): ?>";
|
||||
$script['view'][] = "\t\t\t\t\t\t\t\t<?php \$selected = (strtolower(\$option) == strtolower (\$title) || strtolower(\$option) == strtolower(\$name))? 'selected=\"selected\"':''; ?>";
|
||||
$script['view'][] = "\t\t\t\t\t\t\t\t<option value=\"<?php echo ###-#-#-Component###Helper::htmlEscape(\$value); ?>\" class=\"required\" <?php echo \$selected ?>><?php echo ###-#-#-Component###Helper::htmlEscape(\$option); ?></option>";
|
||||
$script['view'][] = "\t\t\t\t\t\t\t<?php endforeach; ?>";
|
||||
$script['view'][] = "\t\t\t\t\t\t</select>";
|
||||
$script['view'][] = "\t\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t<?php endforeach; ?>";
|
||||
$script['view'][] = "\t\t\t<div class=\"form-actions\">";
|
||||
$script['view'][] = "\t\t\t\t<input class=\"btn btn-primary\" type=\"button\" value=\"<?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_CONTINUE'); ?>\" onclick=\"Joomla.continueImport()\" />";
|
||||
$script['view'][] = "\t\t\t</div>";
|
||||
$script['view'][] = "\t\t</fieldset>";
|
||||
$script['view'][] = "\t\t<input type=\"hidden\" name=\"gettype\" value=\"continue\" />";
|
||||
$script['view'][] = "\t<?php else: ?>";
|
||||
$script['view'][] = "\t\t<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'upload')); ?>";
|
||||
$script['view'][] = "\t\t";
|
||||
$script['view'][] = "\t\t<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'upload', JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_FROM_UPLOAD', true)); ?>";
|
||||
$script['view'][] = "\t\t\t<fieldset class=\"uploadform\">";
|
||||
$script['view'][] = "\t\t\t\t<legend><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_UPDATE_DATA'); ?></legend>";
|
||||
$script['view'][] = "\t\t\t\t<div class=\"control-group\">";
|
||||
$script['view'][] = "\t\t\t\t\t<label for=\"import_package\" class=\"control-label\"><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_SELECT_FILE'); ?></label>";
|
||||
$script['view'][] = "\t\t\t\t\t<div class=\"controls\">";
|
||||
$script['view'][] = "\t\t\t\t\t\t<input class=\"input_box\" id=\"import_package\" name=\"import_package\" type=\"file\" size=\"57\" />";
|
||||
$script['view'][] = "\t\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t\t<div class=\"form-actions\">";
|
||||
$script['view'][] = "\t\t\t\t\t<input class=\"btn btn-primary\" type=\"button\" value=\"<?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_UPLOAD_BOTTON'); ?>\" onclick=\"Joomla.submitbutton()\" /> <small><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>";
|
||||
$script['view'][] = "\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t</fieldset>";
|
||||
$script['view'][] = "\t\t<?php echo JHtml::_('bootstrap.endTab'); ?>";
|
||||
$script['view'][] = "\t\t";
|
||||
$script['view'][] = "\t\t<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'directory', JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_FROM_DIRECTORY', true)); ?>";
|
||||
$script['view'][] = "\t\t\t<fieldset class=\"uploadform\">";
|
||||
$script['view'][] = "\t\t\t\t<legend><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_UPDATE_DATA'); ?></legend>";
|
||||
$script['view'][] = "\t\t\t\t<div class=\"control-group\">";
|
||||
$script['view'][] = "\t\t\t\t\t<label for=\"import_directory\" class=\"control-label\"><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_SELECT_FILE_DIRECTORY'); ?></label>";
|
||||
$script['view'][] = "\t\t\t\t\t<div class=\"controls\">";
|
||||
$script['view'][] = "\t\t\t\t\t\t<input type=\"text\" id=\"import_directory\" name=\"import_directory\" class=\"span5 input_box\" size=\"70\" value=\"<?php echo \$this->state->get('import.directory'); ?>\" />";
|
||||
$script['view'][] = "\t\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t\t<div class=\"form-actions\">";
|
||||
$script['view'][] = "\t\t\t\t\t<input type=\"button\" class=\"btn btn-primary\" value=\"<?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_GET_BOTTON'); ?>\" onclick=\"Joomla.submitbutton3()\" /> <small><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>";
|
||||
$script['view'][] = "\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t\t</fieldset>";
|
||||
$script['view'][] = "\t\t<?php echo JHtml::_('bootstrap.endTab'); ?>";
|
||||
$script['view'][] = "";
|
||||
$script['view'][] = "\n\t\t<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'url', JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_FROM_URL', true)); ?>";
|
||||
$script['view'][] = "\t\t\t<fieldset class=\"uploadform\">";
|
||||
$script['view'][] = "\t\t\t\t<legend><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_UPDATE_DATA'); ?></legend>";
|
||||
$script['view'][] = "\t\t\t\t<div class=\"control-group\">";
|
||||
$script['view'][] = "\t\t\t\t\t<label for=\"import_url\" class=\"control-label\"><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_SELECT_FILE_URL'); ?></label>";
|
||||
$script['view'][] = "\t\t\t\t\t<div class=\"controls\">";
|
||||
$script['view'][] = "\t\t\t\t\t\t<input type=\"text\" id=\"import_url\" name=\"import_url\" class=\"span5 input_box\" size=\"70\" value=\"http://\" />";
|
||||
$script['view'][] = "\t\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t\t<div class=\"form-actions\">";
|
||||
$script['view'][] = "\t\t\t\t\t<input type=\"button\" class=\"btn btn-primary\" value=\"<?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_GET_BOTTON'); ?>\" onclick=\"Joomla.submitbutton4()\" /> <small><?php echo JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>";
|
||||
$script['view'][] = "\t\t\t\t</div>";
|
||||
$script['view'][] = "\t\t\t</fieldset>";
|
||||
$script['view'][] = "\t\t<?php echo JHtml::_('bootstrap.endTab'); ?>";
|
||||
$script['view'][] = "\t\t<?php echo JHtml::_('bootstrap.endTabSet'); ?>";
|
||||
$script['view'][] = "\t\t<input type=\"hidden\" name=\"gettype\" value=\"upload\" />";
|
||||
$script['view'][] = "\t<?php endif; ?>";
|
||||
$script['view'][] = "\t<input type=\"hidden\" name=\"task\" value=\"import_###-#-#-views###.import\" />";
|
||||
$script['view'][] = "\t<?php echo JHtml::_('form.token'); ?>";
|
||||
$script['view'][] = "</form>";
|
||||
$script['view'][] = "</div>";
|
||||
}
|
||||
elseif ('import' === $type)
|
||||
{
|
||||
$script['import'] = array();
|
||||
$script['import'][] = "\t/**";
|
||||
$script['import'][] = "\t * Import an spreadsheet from either folder, url or upload.";
|
||||
$script['import'][] = "\t *";
|
||||
$script['import'][] = "\t * @return boolean result of import";
|
||||
$script['import'][] = "\t *";
|
||||
$script['import'][] = "\t */";
|
||||
$script['import'][] = "\tpublic function import()";
|
||||
$script['import'][] = "\t{";
|
||||
$script['import'][] = "\t\t\$this->setState('action', 'import');";
|
||||
$script['import'][] = "\t\t\$app \t\t= JFactory::getApplication();";
|
||||
$script['import'][] = "\t\t\$session \t= JFactory::getSession();";
|
||||
$script['import'][] = "\t\t\$package \t= null;";
|
||||
$script['import'][] = "\t\t\$continue\t= false;";
|
||||
$script['import'][] = "\t\t// get import type";
|
||||
$script['import'][] = "\t\t\$this->getType = \$app->input->getString('gettype', NULL);";
|
||||
$script['import'][] = "\t\t// get import type";
|
||||
$script['import'][] = "\t\t\$this->dataType\t= \$session->get('dataType_VDM_IMPORTINTO', NULL);";
|
||||
$script['import'][] = "\n\t\tif (\$package === null)";
|
||||
$script['import'][] = "\t\t{";
|
||||
$script['import'][] = "\t\t\tswitch (\$this->getType)";
|
||||
$script['import'][] = "\t\t\t{";
|
||||
$script['import'][] = "\t\t\t\tcase 'folder':";
|
||||
$script['import'][] = "\t\t\t\t\t// Remember the 'Import from Directory' path.";
|
||||
$script['import'][] = "\t\t\t\t\t\$app->getUserStateFromRequest(\$this->_context . '.import_directory', 'import_directory');";
|
||||
$script['import'][] = "\t\t\t\t\t\$package = \$this->_getPackageFromFolder();";
|
||||
$script['import'][] = "\t\t\t\t\tbreak;";
|
||||
$script['import'][] = "\n\t\t\t\tcase 'upload':";
|
||||
$script['import'][] = "\t\t\t\t\t\$package = \$this->_getPackageFromUpload();";
|
||||
$script['import'][] = "\t\t\t\t\tbreak;";
|
||||
$script['import'][] = "\n\t\t\t\tcase 'url':";
|
||||
$script['import'][] = "\t\t\t\t\t\$package = \$this->_getPackageFromUrl();";
|
||||
$script['import'][] = "\t\t\t\t\tbreak;";
|
||||
$script['import'][] = "\n\t\t\t\tcase 'continue':";
|
||||
$script['import'][] = "\t\t\t\t\t\$continue \t= true;";
|
||||
$script['import'][] = "\t\t\t\t\t\$package\t= \$session->get('package', null);";
|
||||
$script['import'][] = "\t\t\t\t\t\$package\t= json_decode(\$package, true);";
|
||||
$script['import'][] = "\t\t\t\t\t// clear session";
|
||||
$script['import'][] = "\t\t\t\t\t\$session->clear('package');";
|
||||
$script['import'][] = "\t\t\t\t\t\$session->clear('dataType');";
|
||||
$script['import'][] = "\t\t\t\t\t\$session->clear('hasPackage');";
|
||||
$script['import'][] = "\t\t\t\t\tbreak;";
|
||||
$script['import'][] = "\n\t\t\t\tdefault:";
|
||||
$script['import'][] = "\t\t\t\t\t\$app->setUserState('com_###-#-#-component###.message', JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_NO_IMPORT_TYPE_FOUND'));";
|
||||
$script['import'][] = "\n\t\t\t\t\treturn false;";
|
||||
$script['import'][] = "\t\t\t\t\tbreak;";
|
||||
$script['import'][] = "\t\t\t}";
|
||||
$script['import'][] = "\t\t}";
|
||||
$script['import'][] = "\t\t// Was the package valid?";
|
||||
$script['import'][] = "\t\tif (!\$package || !\$package['type'])";
|
||||
$script['import'][] = "\t\t{";
|
||||
$script['import'][] = "\t\t\tif (in_array(\$this->getType, array('upload', 'url')))";
|
||||
$script['import'][] = "\t\t\t{";
|
||||
$script['import'][] = "\t\t\t\t\$this->remove(\$package['packagename']);";
|
||||
$script['import'][] = "\t\t\t}";
|
||||
$script['import'][] = "\n\t\t\t\$app->setUserState('com_###-#-#-component###.message', JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE'));";
|
||||
$script['import'][] = "\t\t\treturn false;";
|
||||
$script['import'][] = "\t\t}";
|
||||
$script['import'][] = "\t\t";
|
||||
$script['import'][] = "\t\t// first link data to table headers";
|
||||
$script['import'][] = "\t\tif(!\$continue){";
|
||||
$script['import'][] = "\t\t\t\$package\t= json_encode(\$package);";
|
||||
$script['import'][] = "\t\t\t\$session->set('package', \$package);";
|
||||
$script['import'][] = "\t\t\t\$session->set('dataType', \$this->dataType);";
|
||||
$script['import'][] = "\t\t\t\$session->set('hasPackage', true);";
|
||||
$script['import'][] = "\t\t\treturn true;";
|
||||
$script['import'][] = "\t\t}";
|
||||
$script['import'][] = "\t\t// set the data";
|
||||
$script['import'][] = "\t\t\$headerList = json_decode(\$session->get(\$this->dataType.'_VDM_IMPORTHEADERS', false), true);";
|
||||
$script['import'][] = "\t\tif (!\$this->setData(\$package,\$this->dataType,\$headerList))";
|
||||
$script['import'][] = "\t\t{";
|
||||
$script['import'][] = "\t\t\t// There was an error importing the package";
|
||||
$script['import'][] = "\t\t\t\$msg = JTe-#-#-xt::_('COM_###-#-#-COMPONENT###_IMPORT_ERROR');";
|
||||
$script['import'][] = "\t\t\t\$back = \$session->get('backto_VDM_IMPORT', NULL);";
|
||||
$script['import'][] = "\t\t\tif (\$back)";
|
||||
$script['import'][] = "\t\t\t{";
|
||||
$script['import'][] = "\t\t\t\t\$app->setUserState('com_###-#-#-component###.redirect_url', 'index.php?option=com_###-#-#-component###&view='.\$back);";
|
||||
$script['import'][] = "\t\t\t\t\$session->clear('backto_VDM_IMPORT');";
|
||||
$script['import'][] = "\t\t\t}";
|
||||
$script['import'][] = "\t\t\t\$result = false;";
|
||||
$script['import'][] = "\t\t}";
|
||||
$script['import'][] = "\t\telse";
|
||||
$script['import'][] = "\t\t{";
|
||||
$script['import'][] = "\t\t\t// Package imported sucessfully";
|
||||
$script['import'][] = "\t\t\t\$msg = JTe-#-#-xt::sprintf('COM_###-#-#-COMPONENT###_IMPORT_SUCCESS', \$package['packagename']);";
|
||||
$script['import'][] = "\t\t\t\$back = \$session->get('backto_VDM_IMPORT', NULL);";
|
||||
$script['import'][] = "\t\t\tif (\$back)";
|
||||
$script['import'][] = "\t\t\t{";
|
||||
$script['import'][] = "\t\t\t \$app->setUserState('com_###-#-#-component###.redirect_url', 'index.php?option=com_###-#-#-component###&view='.\$back);";
|
||||
$script['import'][] = "\t\t\t \$session->clear('backto_VDM_IMPORT');";
|
||||
$script['import'][] = "\t\t\t}";
|
||||
$script['import'][] = "\t\t\t\$result = true;";
|
||||
$script['import'][] = "\t\t}";
|
||||
$script['import'][] = "\n\t\t// Set some model state values";
|
||||
$script['import'][] = "\t\t\$app->enqueueMessage(\$msg);";
|
||||
$script['import'][] = "\n\t\t// remove file after import";
|
||||
$script['import'][] = "\t\t\$this->remove(\$package['packagename']);";
|
||||
$script['import'][] = "\t\t\$session->clear(\$this->getType.'_VDM_IMPORTHEADERS');";
|
||||
$script['import'][] = "\t\treturn \$result;";
|
||||
$script['import'][] = "\t}";
|
||||
}
|
||||
elseif ('ext' === $type)
|
||||
{
|
||||
$script['ext'][] = "\t/**";
|
||||
$script['ext'][] = "\t * Check the extension";
|
||||
$script['ext'][] = "\t *";
|
||||
$script['ext'][] = "\t * @param string \$file Name of the uploaded file";
|
||||
$script['ext'][] = "\t *";
|
||||
$script['ext'][] = "\t * @return boolean True on success";
|
||||
$script['ext'][] = "\t *";
|
||||
$script['ext'][] = "\t */";
|
||||
$script['ext'][] = "\tprotected function checkExtention(\$file)";
|
||||
$script['ext'][] = "\t{";
|
||||
$script['ext'][] = "\t\t// check the extention";
|
||||
$script['ext'][] = "\t\tswitch(strtolower(pathinfo(\$file, PATHINFO_EXTENSION)))";
|
||||
$script['ext'][] = "\t\t{";
|
||||
$script['ext'][] = "\t\t\tcase 'xls':";
|
||||
$script['ext'][] = "\t\t\tcase 'ods':";
|
||||
$script['ext'][] = "\t\t\tcase 'csv':";
|
||||
$script['ext'][] = "\t\t\treturn true;";
|
||||
$script['ext'][] = "\t\t\tbreak;";
|
||||
$script['ext'][] = "\t\t}";
|
||||
$script['ext'][] = "\t\treturn false;";
|
||||
$script['ext'][] = "\t}";
|
||||
}
|
||||
// return the needed script
|
||||
if (isset($script[$type]))
|
||||
{
|
||||
return str_replace('-#-#-', '', implode("\n",$script[$type]));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Component xml manifest.
|
||||
**/
|
||||
@ -412,7 +1199,10 @@ abstract class ComponentbuilderHelper
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPILER'), 'index.php?option=com_componentbuilder&view=compiler', $submenu === 'compiler');
|
||||
}
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_COMPONENTS'), 'index.php?option=com_componentbuilder&view=components', $submenu === 'components');
|
||||
if ($user->authorise('joomla_component.access', 'com_componentbuilder') && $user->authorise('joomla_component.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_COMPONENTS'), 'index.php?option=com_componentbuilder&view=joomla_components', $submenu === 'joomla_components');
|
||||
}
|
||||
if ($user->authorise('admin_view.access', 'com_componentbuilder') && $user->authorise('admin_view.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_ADMIN_VIEWS'), 'index.php?option=com_componentbuilder&view=admin_views', $submenu === 'admin_views');
|
||||
@ -795,13 +1585,18 @@ abstract class ComponentbuilderHelper
|
||||
|
||||
if (self::checkArray($where))
|
||||
{
|
||||
// prep main <-- why? well if $main='' is empty then $table can be categories or users
|
||||
if (self::checkString($main))
|
||||
{
|
||||
$main = '_'.ltrim($main, '_');
|
||||
}
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select($db->quoteName(array($what)));
|
||||
$query->from($db->quoteName('#__'.$main.'_'.$table));
|
||||
$query->from($db->quoteName('#_'.$main.'_'.$table));
|
||||
$query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
@ -1330,57 +2125,86 @@ abstract class ComponentbuilderHelper
|
||||
return $string;
|
||||
}
|
||||
|
||||
public static function safeString($string, $type = 'L', $spacer = '_')
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to a thousand)
|
||||
if ($replaceNumbers === true)
|
||||
{
|
||||
// remove all numbers and replace with english text version (works well only up to millions)
|
||||
$string = self::replaceNumbers($string);
|
||||
|
||||
}
|
||||
// 0nly continue if we have a string
|
||||
if (self::checkString($string))
|
||||
{
|
||||
// create file name without the extention that is safe
|
||||
if ($type === 'filename')
|
||||
{
|
||||
// make sure VDM is not in the string
|
||||
$string = str_replace('VDM', 'vDm', $string);
|
||||
// Remove anything which isn't a word, whitespace, number
|
||||
// or any of the following caracters -_()
|
||||
// If you don't need to handle multi-byte characters
|
||||
// you can use preg_replace rather than mb_ereg_replace
|
||||
// Thanks @Łukasz Rysiak!
|
||||
$string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string);
|
||||
// http://stackoverflow.com/a/2021729/1429677
|
||||
return preg_replace('/\s+/', ' ', $string);
|
||||
}
|
||||
// remove all other characters
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
if ($type == 'W')
|
||||
{
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'w')
|
||||
{
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type == 'Ww')
|
||||
{
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'WW')
|
||||
{
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type == 'U')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type == 'F')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type == 'L')
|
||||
// select final adaptations
|
||||
if ($type === 'L' || $type === 'strtolower')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// default is to return lower
|
||||
return strtolower($string);
|
||||
}
|
||||
|
||||
elseif ($type === 'W')
|
||||
{
|
||||
// return a string with all first letter of each word uppercase(no undersocre)
|
||||
return ucwords(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'w' || $type === 'word')
|
||||
{
|
||||
// return a string with all lowercase(no undersocre)
|
||||
return strtolower($string);
|
||||
}
|
||||
elseif ($type === 'Ww' || $type === 'Word')
|
||||
{
|
||||
// return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre)
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'WW' || $type === 'WORD')
|
||||
{
|
||||
// return a string with all the uppercase(no undersocre)
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type === 'U' || $type === 'strtoupper')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return all upper
|
||||
return strtoupper($string);
|
||||
}
|
||||
elseif ($type === 'F' || $type === 'ucfirst')
|
||||
{
|
||||
// replace white space with underscore
|
||||
$string = preg_replace('/\s+/', $spacer, $string);
|
||||
// return with first caracter to upper
|
||||
return ucfirst(strtolower($string));
|
||||
}
|
||||
elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase')
|
||||
{
|
||||
// convert all words to first letter uppercase
|
||||
$string = ucwords(strtolower($string));
|
||||
// remove white space
|
||||
$string = preg_replace('/\s+/', '', $string);
|
||||
// now return first letter lowercase
|
||||
return lcfirst($string);
|
||||
}
|
||||
// return string
|
||||
return $string;
|
||||
}
|
||||
|
@ -69,12 +69,12 @@ class Mapping
|
||||
* The datatypes and it linked field types (basic)
|
||||
* (TODO) We may need to set this dynamicly
|
||||
*/
|
||||
protected $dataTypes = array( 'CHAR' => 'Text', 'VARCHAR' => 'Text',
|
||||
'TEXT' => 'Textarea', 'MEDIUMTEXT' => 'Textarea',
|
||||
'LONGTEXT' => 'Textarea', 'DATE' => 'Text', 'TIME' => 'Text',
|
||||
'DATETIME' => 'Calendar', 'INT' => 'Text', 'TINYINT' => 'Text',
|
||||
'BIGINT' => 'Text', 'FLOAT' => 'Text', 'DECIMAL' => 'Text',
|
||||
'DOUBLE' => 'Text');
|
||||
protected $dataTypes = array( 'VARCHAR' => 'Text', 'CHAR' => 'Text',
|
||||
'MEDIUMTEXT' => 'Textarea', 'LONGTEXT' => 'Textarea',
|
||||
'TEXT' => 'Textarea', 'DATETIME' => 'Calendar',
|
||||
'DATE' => 'Text', 'TIME' => 'Text', 'TINYINT' => 'Text',
|
||||
'BIGINT' => 'Text', 'INT' => 'Text', 'FLOAT' => 'Text',
|
||||
'DECIMAL' => 'Text', 'DOUBLE' => 'Text');
|
||||
|
||||
/**
|
||||
* The datasize identifiers
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage headercheck.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage batch_.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage indenter.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage js.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage minify.php
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,13 +3,13 @@ COM_COMPONENTBUILDER_CONFIGURATION="Component Builder Configuration"
|
||||
COM_COMPONENTBUILDER_MENU="» Component Builder"
|
||||
COM_COMPONENTBUILDER_MENU_ADMIN_VIEWS="Admin Views"
|
||||
COM_COMPONENTBUILDER_MENU_COMPILER="Compiler"
|
||||
COM_COMPONENTBUILDER_MENU_COMPONENTS="Components"
|
||||
COM_COMPONENTBUILDER_MENU_CUSTOM_ADMIN_VIEWS="Custom Admin Views"
|
||||
COM_COMPONENTBUILDER_MENU_CUSTOM_CODES="Custom Codes"
|
||||
COM_COMPONENTBUILDER_MENU_DYNAMIC_GETS="Dynamic Gets"
|
||||
COM_COMPONENTBUILDER_MENU_FIELDS="Fields"
|
||||
COM_COMPONENTBUILDER_MENU_FIELDTYPES="Fieldtypes"
|
||||
COM_COMPONENTBUILDER_MENU_HELP_DOCUMENTS="Help Documents"
|
||||
COM_COMPONENTBUILDER_MENU_JOOMLA_COMPONENTS="Joomla Components"
|
||||
COM_COMPONENTBUILDER_MENU_LAYOUTS="Layouts"
|
||||
COM_COMPONENTBUILDER_MENU_SITE_VIEWS="Site Views"
|
||||
COM_COMPONENTBUILDER_MENU_SNIPPETS="Snippets"
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage css_fullwidth.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_buttons_fullwidth.php
|
||||
@ -31,7 +31,9 @@ $form = $displayData->getForm();
|
||||
|
||||
$fields = $displayData->get('fields') ?: array(
|
||||
'php_controller',
|
||||
'php_model'
|
||||
'php_controller_list',
|
||||
'php_model',
|
||||
'php_model_list'
|
||||
);
|
||||
|
||||
?>
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_buttons_left.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_import_fullwidth.php
|
||||
@ -37,7 +37,8 @@ $fields = $displayData->get('fields') ?: array(
|
||||
'html_import_view',
|
||||
'php_import',
|
||||
'php_import_setdata',
|
||||
'php_import_save'
|
||||
'php_import_save',
|
||||
'php_import_ext'
|
||||
);
|
||||
|
||||
?>
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fields_fullwidth.php
|
||||
@ -28,7 +28,7 @@
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// set the defaults
|
||||
$items = $displayData->vxtfields;
|
||||
$items = $displayData->vxwfields;
|
||||
$user = JFactory::getUser();
|
||||
$id = $displayData->item->id;
|
||||
$edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit";
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage javascript_fullwidth.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage linked_components_fullwidth.php
|
||||
@ -28,40 +28,40 @@
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// set the defaults
|
||||
$items = $displayData->vxulinked_components;
|
||||
$items = $displayData->vxxlinked_components;
|
||||
$user = JFactory::getUser();
|
||||
$id = $displayData->item->id;
|
||||
$edit = "index.php?option=com_componentbuilder&view=components&task=component.edit";
|
||||
$edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit";
|
||||
|
||||
?>
|
||||
<div class="form-vertical">
|
||||
<?php if (ComponentbuilderHelper::checkArray($items)): ?>
|
||||
<table class="footable table data components" data-show-toggle="true" data-toggle-column="first" data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true">
|
||||
<table class="footable table data joomla_components" data-show-toggle="true" data-toggle-column="first" data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_SYSTEM_NAME_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SYSTEM_NAME_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_NAME_CODE_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_COMPONENT_VERSION_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPONENT_VERSION_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_SHORT_DESCRIPTION_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SHORT_DESCRIPTION_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_COMPANYNAME_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_AUTHOR_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL'); ?>
|
||||
</th>
|
||||
<th width="10" data-breakpoints="xs sm md">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_STATUS'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_STATUS'); ?>
|
||||
</th>
|
||||
<th width="5" data-type="number" data-breakpoints="xs sm md">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_ID'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ID'); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -70,14 +70,14 @@ $edit = "index.php?option=com_componentbuilder&view=components&task=component.ed
|
||||
<?php
|
||||
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0;
|
||||
$userChkOut = JFactory::getUser($item->checked_out);
|
||||
$canDo = ComponentbuilderHelper::getActions('component',$item,'components');
|
||||
$canDo = ComponentbuilderHelper::getActions('joomla_component',$item,'joomla_components');
|
||||
?>
|
||||
<tr>
|
||||
<td class="nowrap">
|
||||
<?php if ($canDo->get('core.edit')): ?>
|
||||
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>&ref=admin_view&refid=<?php echo $id; ?>"><?php echo $displayData->escape($item->system_name); ?></a>
|
||||
<?php if ($item->checked_out): ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'components.', $canCheckin); ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'joomla_components.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<div class="name"><?php echo $displayData->escape($item->system_name); ?></div>
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage mysql_fullwidth.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage mysql_left.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage php_fullwidth.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage publishing.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage publlshing.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage settings_above.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage settings_left.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage settings_right.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage settings_under.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage batchselection.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_buttons_fullwidth.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_buttons_left.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_script_fullwidth.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_above.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_fullwidth.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_left.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_right.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_rightside.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage details_under.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage linked_components_fullwidth.php
|
||||
@ -28,40 +28,40 @@
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// set the defaults
|
||||
$items = $displayData->vyelinked_components;
|
||||
$items = $displayData->vyhlinked_components;
|
||||
$user = JFactory::getUser();
|
||||
$id = $displayData->item->id;
|
||||
$edit = "index.php?option=com_componentbuilder&view=components&task=component.edit";
|
||||
$edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit";
|
||||
|
||||
?>
|
||||
<div class="form-vertical">
|
||||
<?php if (ComponentbuilderHelper::checkArray($items)): ?>
|
||||
<table class="footable table data components" data-show-toggle="true" data-toggle-column="first" data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true">
|
||||
<table class="footable table data joomla_components" data-show-toggle="true" data-toggle-column="first" data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_SYSTEM_NAME_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SYSTEM_NAME_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_NAME_CODE_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_COMPONENT_VERSION_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPONENT_VERSION_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_SHORT_DESCRIPTION_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SHORT_DESCRIPTION_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_COMPANYNAME_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_LABEL'); ?>
|
||||
</th>
|
||||
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_AUTHOR_LABEL'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL'); ?>
|
||||
</th>
|
||||
<th width="10" data-breakpoints="xs sm md">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_STATUS'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_STATUS'); ?>
|
||||
</th>
|
||||
<th width="5" data-type="number" data-breakpoints="xs sm md">
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_ID'); ?>
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ID'); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -70,14 +70,14 @@ $edit = "index.php?option=com_componentbuilder&view=components&task=component.ed
|
||||
<?php
|
||||
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0;
|
||||
$userChkOut = JFactory::getUser($item->checked_out);
|
||||
$canDo = ComponentbuilderHelper::getActions('component',$item,'components');
|
||||
$canDo = ComponentbuilderHelper::getActions('joomla_component',$item,'joomla_components');
|
||||
?>
|
||||
<tr>
|
||||
<td class="nowrap">
|
||||
<?php if ($canDo->get('core.edit')): ?>
|
||||
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>&ref=custom_admin_view&refid=<?php echo $id; ?>"><?php echo $displayData->escape($item->system_name); ?></a>
|
||||
<?php if ($item->checked_out): ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'components.', $canCheckin); ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'joomla_components.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<div class="name"><?php echo $displayData->escape($item->system_name); ?></div>
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.3.2
|
||||
@build 11th February, 2017
|
||||
@version 2.3.8
|
||||
@build 27th March, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage publishing.php
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user