diff --git a/README.md b/README.md index 5bcb0be..eac9267 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - # Recipe Manager (1.0.0) + # Recipe Manager (1.0.2) Recipe Manager allows you to collect, search, organize, and browse your recipes.. @@ -8,10 +8,10 @@ Recipe Manager allows you to collect, search, organize, and browse your recipes. + *Author*: [Oh Martin](mailto:oh.martin@vdm.io) + *Name*: [Recipe Manager](https://www.vdm.io) + *First Build*: 5th July, 2020 -+ *Last Build*: 11th December, 2020 -+ *Version*: 1.0.0 ++ *Last Build*: 14th December, 2020 ++ *Version*: 1.0.2 + *Copyright*: Copyright (C) 2020. All Rights Reserved -+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ++ *License*: GNU General Public License version 2 or later; see LICENSE.txt ## Build Time @@ -21,11 +21,11 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **15622** -+ *File count*: **149** ++ *Line count*: **15794** ++ *File count*: **151** + *Folder count*: **53** -**28 Hours** or **3 Eight Hour Days** (the actual time the author spent) +**29 Hours** or **3 Eight Hour Days** (the actual time the author spent) > (with the following break down: > **debugging @11hours** = codingtime / 4; @@ -33,7 +33,7 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com)) > **mapping @4hours** = codingtime / 10; > **office @7hours** = codingtime / 6;) -**72 Hours** or **9 Eight Hour Days** +**73 Hours** or **9 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, diff --git a/admin/README.txt b/admin/README.txt index 5bcb0be..eac9267 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ - # Recipe Manager (1.0.0) + # Recipe Manager (1.0.2) Recipe Manager allows you to collect, search, organize, and browse your recipes.. @@ -8,10 +8,10 @@ Recipe Manager allows you to collect, search, organize, and browse your recipes. + *Author*: [Oh Martin](mailto:oh.martin@vdm.io) + *Name*: [Recipe Manager](https://www.vdm.io) + *First Build*: 5th July, 2020 -+ *Last Build*: 11th December, 2020 -+ *Version*: 1.0.0 ++ *Last Build*: 14th December, 2020 ++ *Version*: 1.0.2 + *Copyright*: Copyright (C) 2020. All Rights Reserved -+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ++ *License*: GNU General Public License version 2 or later; see LICENSE.txt ## Build Time @@ -21,11 +21,11 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **15622** -+ *File count*: **149** ++ *Line count*: **15794** ++ *File count*: **151** + *Folder count*: **53** -**28 Hours** or **3 Eight Hour Days** (the actual time the author spent) +**29 Hours** or **3 Eight Hour Days** (the actual time the author spent) > (with the following break down: > **debugging @11hours** = codingtime / 4; @@ -33,7 +33,7 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com)) > **mapping @4hours** = codingtime / 10; > **office @7hours** = codingtime / 6;) -**72 Hours** or **9 Eight Hour Days** +**73 Hours** or **9 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, diff --git a/admin/access.xml b/admin/access.xml index 9bffbc4..df961ae 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -1,40 +1,40 @@ - +
- - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
- +
- +
diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 278b7b5..1c13e15 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage admin.css @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 5278ab1..37a61c9 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage dashboard.css @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/assets/css/ingredient.css b/admin/assets/css/ingredient.css index 75ca617..26ee14d 100644 --- a/admin/assets/css/ingredient.css +++ b/admin/assets/css/ingredient.css @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage ingredient.css @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/assets/css/ingredients.css b/admin/assets/css/ingredients.css index 862f670..21b265f 100644 --- a/admin/assets/css/ingredients.css +++ b/admin/assets/css/ingredients.css @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage ingredients.css @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/assets/css/recipe.css b/admin/assets/css/recipe.css index f50624d..f5f50ce 100644 --- a/admin/assets/css/recipe.css +++ b/admin/assets/css/recipe.css @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage recipe.css @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/assets/css/recipes.css b/admin/assets/css/recipes.css index cbbfabd..9ed8cae 100644 --- a/admin/assets/css/recipes.css +++ b/admin/assets/css/recipes.css @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage recipes.css @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js index 74a7f23..2dc9851 100644 --- a/admin/assets/js/admin.js +++ b/admin/assets/js/admin.js @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage admin.js @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/config.xml b/admin/config.xml index e8c7227..0eb4df5 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -1,29 +1,29 @@
+ label="COM_RECIPE_MANAGER_CONFIG_GLOBAL_LABEL" + description="COM_RECIPE_MANAGER_CONFIG_GLOBAL_DESC"> + label="COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_LABEL" + description="COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_DESC"> + value="-5 hours">COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_ONE + value="-12 hours">COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_TWO + value="-1 day">COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_THREE + value="-2 day">COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_FOUR + value="-1 week">COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_FIVE + value="0">COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_SIX
diff --git a/admin/controller.php b/admin/controller.php index a06060d..e94b450 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage controller.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -24,9 +24,9 @@ use Joomla\Utilities\ArrayHelper; /** - * General Controller of Recipemanager component + * General Controller of Recipe_manager component */ -class RecipemanagerController extends JControllerLegacy +class Recipe_managerController extends JControllerLegacy { /** * Constructor. @@ -40,7 +40,7 @@ class RecipemanagerController extends JControllerLegacy public function __construct($config = array()) { // set the default view - $config['default_view'] = 'recipemanager'; + $config['default_view'] = 'recipe_manager'; parent::__construct($config); } @@ -53,15 +53,15 @@ public function __construct($config = array()) function display($cachable = false, $urlparams = false) { // set default view if not set - $view = $this->input->getCmd('view', 'recipemanager'); + $view = $this->input->getCmd('view', 'recipe_manager'); $data = $this->getViewRelation($view); $layout = $this->input->get('layout', null, 'WORD'); $id = $this->input->getInt('id'); // Check for edit form. - if(RecipemanagerHelper::checkArray($data)) + if(Recipe_managerHelper::checkArray($data)) { - if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_recipemanager.edit.'.$data['view'], $id)) + if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_recipe_manager.edit.'.$data['view'], $id)) { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); @@ -70,21 +70,21 @@ function display($cachable = false, $urlparams = false) $ref = $this->input->getCmd('ref', 0); $refid = $this->input->getInt('refid', 0); // set redirect - if ($refid > 0 && RecipemanagerHelper::checkString($ref)) + if ($refid > 0 && Recipe_managerHelper::checkString($ref)) { // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); } - elseif (RecipemanagerHelper::checkString($ref)) + elseif (Recipe_managerHelper::checkString($ref)) { // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view='.(string)$ref, false)); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view='.(string)$ref, false)); } else { // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view='.$data['views'], false)); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view='.$data['views'], false)); } return false; @@ -97,7 +97,7 @@ function display($cachable = false, $urlparams = false) protected function getViewRelation($view) { // check the we have a value - if (RecipemanagerHelper::checkString($view)) + if (Recipe_managerHelper::checkString($view)) { // the view relationships $views = array( diff --git a/admin/controllers/import.php b/admin/controllers/import.php index 4729996..f0353a6 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage import.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -24,9 +24,9 @@ use Joomla\Utilities\ArrayHelper; /** - * Recipemanager Import Controller + * Recipe_manager Import Controller */ -class RecipemanagerControllerImport extends JControllerLegacy +class Recipe_managerControllerImport extends JControllerLegacy { /** * Import an spreadsheet. @@ -47,17 +47,17 @@ public function import() } $app = JFactory::getApplication(); - $redirect_url = $app->getUserState('com_recipemanager.redirect_url'); + $redirect_url = $app->getUserState('com_recipe_manager.redirect_url'); if (empty($redirect_url)) { - $redirect_url = JRoute::_('index.php?option=com_recipemanager&view=import', false); + $redirect_url = JRoute::_('index.php?option=com_recipe_manager&view=import', false); } else { // wipe out the user state when we're going to redirect - $app->setUserState('com_recipemanager.redirect_url', ''); - $app->setUserState('com_recipemanager.message', ''); - $app->setUserState('com_recipemanager.extension_message', ''); + $app->setUserState('com_recipe_manager.redirect_url', ''); + $app->setUserState('com_recipe_manager.message', ''); + $app->setUserState('com_recipe_manager.extension_message', ''); } $this->setRedirect($redirect_url); } diff --git a/admin/controllers/ingredient.php b/admin/controllers/ingredient.php index a782dbb..dd155b8 100644 --- a/admin/controllers/ingredient.php +++ b/admin/controllers/ingredient.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage ingredient.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -26,7 +26,7 @@ /** * Ingredient Controller */ -class RecipemanagerControllerIngredient extends JControllerForm +class Recipe_managerControllerIngredient extends JControllerForm { /** * Current or most recently performed task. @@ -61,16 +61,16 @@ public function __construct($config = array()) */ protected function allowAdd($data = array()) { - // [Interpretation 18945] Get user object. + // [Interpretation 18937] Get user object. $user = JFactory::getUser(); - // [Interpretation 18959] Access check. - $access = $user->authorise('ingredient.access', 'com_recipemanager'); + // [Interpretation 18951] Access check. + $access = $user->authorise('ingredient.access', 'com_recipe_manager'); if (!$access) { return false; } - // [Interpretation 18990] In the absense of better information, revert to the component permissions. + // [Interpretation 18982] In the absense of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -86,25 +86,25 @@ protected function allowAdd($data = array()) */ protected function allowEdit($data = array(), $key = 'id') { - // [Interpretation 19199] get user object. + // [Interpretation 19191] get user object. $user = JFactory::getUser(); - // [Interpretation 19202] get record id. + // [Interpretation 19194] get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; if ($recordId) { - // [Interpretation 19234] The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit', 'com_recipemanager.ingredient.' . (int) $recordId); + // [Interpretation 19226] The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_recipe_manager.ingredient.' . (int) $recordId); if (!$permission) { - if ($user->authorise('core.edit.own', 'com_recipemanager.ingredient.' . $recordId)) + if ($user->authorise('core.edit.own', 'com_recipe_manager.ingredient.' . $recordId)) { - // [Interpretation 19283] Now test the owner is the user. + // [Interpretation 19275] Now test the owner is the user. $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; if (empty($ownerId)) { - // [Interpretation 19289] Need to do a lookup from the model. + // [Interpretation 19281] Need to do a lookup from the model. $record = $this->getModel()->getItem($recordId); if (empty($record)) @@ -114,10 +114,10 @@ protected function allowEdit($data = array(), $key = 'id') $ownerId = $record->created_by; } - // [Interpretation 19299] If the owner matches 'me' then allow. + // [Interpretation 19291] If the owner matches 'me' then allow. if ($ownerId == $user->id) { - if ($user->authorise('core.edit.own', 'com_recipemanager')) + if ($user->authorise('core.edit.own', 'com_recipe_manager')) { return true; } @@ -126,7 +126,7 @@ protected function allowEdit($data = array(), $key = 'id') return false; } } - // [Interpretation 19348] Since there is no permission, revert to the component permissions. + // [Interpretation 19340] Since there is no permission, revert to the component permissions. return parent::allowEdit($data, $key); } @@ -179,7 +179,7 @@ public function batch($model = null) $model = $this->getModel('Ingredient', '', array()); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view=ingredients' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view=ingredients' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } diff --git a/admin/controllers/ingredients.php b/admin/controllers/ingredients.php index b0b16a4..7e2d5ff 100644 --- a/admin/controllers/ingredients.php +++ b/admin/controllers/ingredients.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage ingredients.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -26,7 +26,7 @@ /** * Ingredients Controller */ -class RecipemanagerControllerIngredients extends JControllerAdmin +class Recipe_managerControllerIngredients extends JControllerAdmin { /** * The prefix to use with controller messages. @@ -34,7 +34,7 @@ class RecipemanagerControllerIngredients extends JControllerAdmin * @var string * @since 1.6 */ - protected $text_prefix = 'COM_RECIPEMANAGER_INGREDIENTS'; + protected $text_prefix = 'COM_RECIPE_MANAGER_INGREDIENTS'; /** * Method to get a model object, loading it if required. @@ -47,71 +47,71 @@ class RecipemanagerControllerIngredients extends JControllerAdmin * * @since 1.6 */ - public function getModel($name = 'Ingredient', $prefix = 'RecipemanagerModel', $config = array('ignore_request' => true)) + public function getModel($name = 'Ingredient', $prefix = 'Recipe_managerModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } public function exportData() { - // [Interpretation 15235] Check for request forgeries + // [Interpretation 15227] Check for request forgeries JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // [Interpretation 15239] check if export is allowed for this user. + // [Interpretation 15231] check if export is allowed for this user. $user = JFactory::getUser(); - if ($user->authorise('ingredient.export', 'com_recipemanager') && $user->authorise('core.export', 'com_recipemanager')) + if ($user->authorise('ingredient.export', 'com_recipe_manager') && $user->authorise('core.export', 'com_recipe_manager')) { - // [Interpretation 15248] Get the input + // [Interpretation 15240] Get the input $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); - // [Interpretation 15254] Sanitize the input + // [Interpretation 15246] Sanitize the input $pks = ArrayHelper::toInteger($pks); - // [Interpretation 15257] Get the model + // [Interpretation 15249] Get the model $model = $this->getModel('Ingredients'); - // [Interpretation 15262] get the data to export + // [Interpretation 15254] get the data to export $data = $model->getExportData($pks); - if (RecipemanagerHelper::checkArray($data)) + if (Recipe_managerHelper::checkArray($data)) { - // [Interpretation 15270] now set the data to the spreadsheet + // [Interpretation 15262] now set the data to the spreadsheet $date = JFactory::getDate(); - RecipemanagerHelper::xls($data,'Ingredients_'.$date->format('jS_F_Y'),'Ingredients exported ('.$date->format('jS F, Y').')','ingredients'); + Recipe_managerHelper::xls($data,'Ingredients_'.$date->format('jS_F_Y'),'Ingredients exported ('.$date->format('jS F, Y').')','ingredients'); } } - // [Interpretation 15283] Redirect to the list screen with error. - $message = JText::_('COM_RECIPEMANAGER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view=ingredients', false), $message, 'error'); + // [Interpretation 15275] Redirect to the list screen with error. + $message = JText::_('COM_RECIPE_MANAGER_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view=ingredients', false), $message, 'error'); return; } public function importData() { - // [Interpretation 15298] Check for request forgeries + // [Interpretation 15290] Check for request forgeries JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // [Interpretation 15302] check if import is allowed for this user. + // [Interpretation 15294] check if import is allowed for this user. $user = JFactory::getUser(); - if ($user->authorise('ingredient.import', 'com_recipemanager') && $user->authorise('core.import', 'com_recipemanager')) + if ($user->authorise('ingredient.import', 'com_recipe_manager') && $user->authorise('core.import', 'com_recipe_manager')) { - // [Interpretation 15311] Get the import model + // [Interpretation 15303] Get the import model $model = $this->getModel('Ingredients'); - // [Interpretation 15316] get the headers to import + // [Interpretation 15308] get the headers to import $headers = $model->getExImPortHeaders(); - if (RecipemanagerHelper::checkObject($headers)) + if (Recipe_managerHelper::checkObject($headers)) { - // [Interpretation 15324] Load headers to session. + // [Interpretation 15316] Load headers to session. $session = JFactory::getSession(); $headers = json_encode($headers); $session->set('ingredient_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'ingredients'); $session->set('dataType_VDM_IMPORTINTO', 'ingredient'); - // [Interpretation 15335] Redirect to import view. - $message = JText::_('COM_RECIPEMANAGER_IMPORT_SELECT_FILE_FOR_INGREDIENTS'); - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view=import', false), $message); + // [Interpretation 15327] Redirect to import view. + $message = JText::_('COM_RECIPE_MANAGER_IMPORT_SELECT_FILE_FOR_INGREDIENTS'); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view=import', false), $message); return; } } - // [Interpretation 15366] Redirect to the list screen with error. - $message = JText::_('COM_RECIPEMANAGER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view=ingredients', false), $message, 'error'); + // [Interpretation 15358] Redirect to the list screen with error. + $message = JText::_('COM_RECIPE_MANAGER_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view=ingredients', false), $message, 'error'); return; } } diff --git a/admin/controllers/recipe.php b/admin/controllers/recipe.php index dac3ba9..e379447 100644 --- a/admin/controllers/recipe.php +++ b/admin/controllers/recipe.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage recipe.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -26,7 +26,7 @@ /** * Recipe Controller */ -class RecipemanagerControllerRecipe extends JControllerForm +class Recipe_managerControllerRecipe extends JControllerForm { /** * Current or most recently performed task. @@ -61,16 +61,16 @@ public function __construct($config = array()) */ protected function allowAdd($data = array()) { - // [Interpretation 18945] Get user object. + // [Interpretation 18937] Get user object. $user = JFactory::getUser(); - // [Interpretation 18959] Access check. - $access = $user->authorise('recipe.access', 'com_recipemanager'); + // [Interpretation 18951] Access check. + $access = $user->authorise('recipe.access', 'com_recipe_manager'); if (!$access) { return false; } - // [Interpretation 18990] In the absense of better information, revert to the component permissions. + // [Interpretation 18982] In the absense of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -85,14 +85,14 @@ protected function allowAdd($data = array()) * @since 1.6 */ protected function allowEdit($data = array(), $key = 'id') - { // [Interpretation 19035] get user object. + { // [Interpretation 19027] get user object. $user = JFactory::getUser(); - // [Interpretation 19038] get record id. + // [Interpretation 19030] get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; - // [Interpretation 19056] Access check. - $access = ($user->authorise('recipe.access', 'com_recipemanager.recipe.' . (int) $recordId) && $user->authorise('recipe.access', 'com_recipemanager')); + // [Interpretation 19048] Access check. + $access = ($user->authorise('recipe.access', 'com_recipe_manager.recipe.' . (int) $recordId) && $user->authorise('recipe.access', 'com_recipe_manager')); if (!$access) { return false; @@ -100,17 +100,17 @@ protected function allowEdit($data = array(), $key = 'id') if ($recordId) { - // [Interpretation 19070] The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit', 'com_recipemanager.recipe.' . (int) $recordId); + // [Interpretation 19062] The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_recipe_manager.recipe.' . (int) $recordId); if (!$permission) { - if ($user->authorise('core.edit.own', 'com_recipemanager.recipe.' . $recordId)) + if ($user->authorise('core.edit.own', 'com_recipe_manager.recipe.' . $recordId)) { - // [Interpretation 19115] Fallback on edit.own. Now test the owner is the user. + // [Interpretation 19107] Fallback on edit.own. Now test the owner is the user. $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; if (empty($ownerId)) { - // [Interpretation 19121] Need to do a lookup from the model. + // [Interpretation 19113] Need to do a lookup from the model. $record = $this->getModel()->getItem($recordId); if (empty($record)) @@ -120,10 +120,10 @@ protected function allowEdit($data = array(), $key = 'id') $ownerId = $record->created_by; } - // [Interpretation 19131] If the owner matches 'me' then do the test. + // [Interpretation 19123] If the owner matches 'me' then do the test. if ($ownerId == $user->id) { - if ($user->authorise('core.edit.own', 'com_recipemanager')) + if ($user->authorise('core.edit.own', 'com_recipe_manager')) { return true; } @@ -132,7 +132,7 @@ protected function allowEdit($data = array(), $key = 'id') return false; } } - // [Interpretation 19190] Since there is no permission, revert to the component permissions. + // [Interpretation 19182] Since there is no permission, revert to the component permissions. return parent::allowEdit($data, $key); } @@ -185,7 +185,7 @@ public function batch($model = null) $model = $this->getModel('Recipe', '', array()); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view=recipes' . $this->getRedirectToListAppend(), false)); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view=recipes' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } diff --git a/admin/controllers/recipe_manager.php b/admin/controllers/recipe_manager.php new file mode 100644 index 0000000..c54a4bc --- /dev/null +++ b/admin/controllers/recipe_manager.php @@ -0,0 +1,30 @@ + + @copyright Copyright (C) 2020. All Rights Reserved + @license GNU General Public License version 2 or later; see LICENSE.txt + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Recipe_manager Controller + */ +class Recipe_managerControllerRecipe_manager extends JControllerAdmin +{ + +} diff --git a/admin/controllers/recipes.php b/admin/controllers/recipes.php index 0afaebe..2cb1ff5 100644 --- a/admin/controllers/recipes.php +++ b/admin/controllers/recipes.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage recipes.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -26,7 +26,7 @@ /** * Recipes Controller */ -class RecipemanagerControllerRecipes extends JControllerAdmin +class Recipe_managerControllerRecipes extends JControllerAdmin { /** * The prefix to use with controller messages. @@ -34,7 +34,7 @@ class RecipemanagerControllerRecipes extends JControllerAdmin * @var string * @since 1.6 */ - protected $text_prefix = 'COM_RECIPEMANAGER_RECIPES'; + protected $text_prefix = 'COM_RECIPE_MANAGER_RECIPES'; /** * Method to get a model object, loading it if required. @@ -47,71 +47,71 @@ class RecipemanagerControllerRecipes extends JControllerAdmin * * @since 1.6 */ - public function getModel($name = 'Recipe', $prefix = 'RecipemanagerModel', $config = array('ignore_request' => true)) + public function getModel($name = 'Recipe', $prefix = 'Recipe_managerModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } public function exportData() { - // [Interpretation 15235] Check for request forgeries + // [Interpretation 15227] Check for request forgeries JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // [Interpretation 15239] check if export is allowed for this user. + // [Interpretation 15231] check if export is allowed for this user. $user = JFactory::getUser(); - if ($user->authorise('recipe.export', 'com_recipemanager') && $user->authorise('core.export', 'com_recipemanager')) + if ($user->authorise('recipe.export', 'com_recipe_manager') && $user->authorise('core.export', 'com_recipe_manager')) { - // [Interpretation 15248] Get the input + // [Interpretation 15240] Get the input $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); - // [Interpretation 15254] Sanitize the input + // [Interpretation 15246] Sanitize the input $pks = ArrayHelper::toInteger($pks); - // [Interpretation 15257] Get the model + // [Interpretation 15249] Get the model $model = $this->getModel('Recipes'); - // [Interpretation 15262] get the data to export + // [Interpretation 15254] get the data to export $data = $model->getExportData($pks); - if (RecipemanagerHelper::checkArray($data)) + if (Recipe_managerHelper::checkArray($data)) { - // [Interpretation 15270] now set the data to the spreadsheet + // [Interpretation 15262] now set the data to the spreadsheet $date = JFactory::getDate(); - RecipemanagerHelper::xls($data,'Recipes_'.$date->format('jS_F_Y'),'Recipes exported ('.$date->format('jS F, Y').')','recipes'); + Recipe_managerHelper::xls($data,'Recipes_'.$date->format('jS_F_Y'),'Recipes exported ('.$date->format('jS F, Y').')','recipes'); } } - // [Interpretation 15283] Redirect to the list screen with error. - $message = JText::_('COM_RECIPEMANAGER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view=recipes', false), $message, 'error'); + // [Interpretation 15275] Redirect to the list screen with error. + $message = JText::_('COM_RECIPE_MANAGER_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view=recipes', false), $message, 'error'); return; } public function importData() { - // [Interpretation 15298] Check for request forgeries + // [Interpretation 15290] Check for request forgeries JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // [Interpretation 15302] check if import is allowed for this user. + // [Interpretation 15294] check if import is allowed for this user. $user = JFactory::getUser(); - if ($user->authorise('recipe.import', 'com_recipemanager') && $user->authorise('core.import', 'com_recipemanager')) + if ($user->authorise('recipe.import', 'com_recipe_manager') && $user->authorise('core.import', 'com_recipe_manager')) { - // [Interpretation 15311] Get the import model + // [Interpretation 15303] Get the import model $model = $this->getModel('Recipes'); - // [Interpretation 15316] get the headers to import + // [Interpretation 15308] get the headers to import $headers = $model->getExImPortHeaders(); - if (RecipemanagerHelper::checkObject($headers)) + if (Recipe_managerHelper::checkObject($headers)) { - // [Interpretation 15324] Load headers to session. + // [Interpretation 15316] Load headers to session. $session = JFactory::getSession(); $headers = json_encode($headers); $session->set('recipe_VDM_IMPORTHEADERS', $headers); $session->set('backto_VDM_IMPORT', 'recipes'); $session->set('dataType_VDM_IMPORTINTO', 'recipe'); - // [Interpretation 15335] Redirect to import view. - $message = JText::_('COM_RECIPEMANAGER_IMPORT_SELECT_FILE_FOR_RECIPES'); - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view=import', false), $message); + // [Interpretation 15327] Redirect to import view. + $message = JText::_('COM_RECIPE_MANAGER_IMPORT_SELECT_FILE_FOR_RECIPES'); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view=import', false), $message); return; } } - // [Interpretation 15366] Redirect to the list screen with error. - $message = JText::_('COM_RECIPEMANAGER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_recipemanager&view=recipes', false), $message, 'error'); + // [Interpretation 15358] Redirect to the list screen with error. + $message = JText::_('COM_RECIPE_MANAGER_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_recipe_manager&view=recipes', false), $message, 'error'); return; } } diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index d210c26..c4bbb62 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage headercheck.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -21,7 +21,7 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -class recipemanagerHeaderCheck +class recipe_managerHeaderCheck { function js_loaded($script_name) { diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index 43ff00c..edabef8 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage batch_.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/helpers/recipe_manager.php b/admin/helpers/recipe_manager.php new file mode 100644 index 0000000..c7365d5 --- /dev/null +++ b/admin/helpers/recipe_manager.php @@ -0,0 +1,1587 @@ + + @copyright Copyright (C) 2020. All Rights Reserved + @license GNU General Public License version 2 or later; see LICENSE.txt + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Language\Language; +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; +use PhpOffice\PhpSpreadsheet\IOFactory; +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +/** + * Recipe_manager component helper. + */ +abstract class Recipe_managerHelper +{ + /** + * Composer Switch + * + * @var array + */ + protected static $composer = array(); + + /** + * The Main Active Language + * + * @var string + */ + public static $langTag; + + /** + * Load the Composer Vendors + */ + public static function composerAutoload($target) + { + // insure we load the composer vendor only once + if (!isset(self::$composer[$target])) + { + // get the function name + $functionName = self::safeString('compose' . $target); + // check if method exist + if (method_exists(__CLASS__, $functionName)) + { + return self::{$functionName}(); + } + return false; + } + return self::$composer[$target]; + } + + /** + * Load the Component xml manifest. + */ + public static function manifest() + { + $manifestUrl = JPATH_ADMINISTRATOR."/components/com_recipe_manager/recipe_manager.xml"; + return simplexml_load_file($manifestUrl); + } + + /** + * Joomla version object + */ + protected static $JVersion; + + /** + * set/get Joomla version + */ + public static function jVersion() + { + // check if set + if (!self::checkObject(self::$JVersion)) + { + self::$JVersion = new JVersion(); + } + return self::$JVersion; + } + + /** + * Load the Contributors details. + */ + public static function getContributors() + { + // get params + $params = JComponentHelper::getParams('com_recipe_manager'); + // start contributors array + $contributors = array(); + // get all Contributors (max 20) + $searchArray = range('0','20'); + foreach($searchArray as $nr) + { + if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) + { + // set link based of selected option + if($params->get("useContributor".$nr) == 1) + { + $link_front = ''; + $link_back = ''; + } + elseif($params->get("useContributor".$nr) == 2) + { + $link_front = ''; + $link_back = ''; + } + else + { + $link_front = ''; + $link_back = ''; + } + $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + } + } + return $contributors; + } + + /** + * Can be used to build help urls. + **/ + public static function getHelpUrl($view) + { + return false; + } + + /** + * Configure the Linkbar. + */ + public static function addSubmenu($submenu) + { + // load user for access menus + $user = JFactory::getUser(); + // load the submenus to sidebar + JHtmlSidebar::addEntry(JText::_('COM_RECIPE_MANAGER_SUBMENU_DASHBOARD'), 'index.php?option=com_recipe_manager&view=recipe_manager', $submenu === 'recipe_manager'); + if ($user->authorise('ingredient.access', 'com_recipe_manager') && $user->authorise('ingredient.submenu', 'com_recipe_manager')) + { + JHtmlSidebar::addEntry(JText::_('COM_RECIPE_MANAGER_SUBMENU_INGREDIENTS'), 'index.php?option=com_recipe_manager&view=ingredients', $submenu === 'ingredients'); + } + if ($user->authorise('recipe.access', 'com_recipe_manager') && $user->authorise('recipe.submenu', 'com_recipe_manager')) + { + JHtmlSidebar::addEntry(JText::_('COM_RECIPE_MANAGER_SUBMENU_RECIPES'), 'index.php?option=com_recipe_manager&view=recipes', $submenu === 'recipes'); + JHtmlSidebar::addEntry(JText::_('COM_RECIPE_MANAGER_RECIPE_RECIPES_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_recipe_manager', $submenu === 'categories'); + } + } + + /** + * Prepares the xml document + */ + public static function xls($rows, $fileName = null, $title = null, $subjectTab = null, $creator = 'Joomla Component Builder', $description = null, $category = null,$keywords = null, $modified = null) + { + // [Interpretation 1596] set the user + $user = JFactory::getUser(); + // [Interpretation 1599] set fileName if not set + if (!$fileName) + { + $fileName = 'exported_'.JFactory::getDate()->format('jS_F_Y'); + } + // [Interpretation 1606] set modified if not set + if (!$modified) + { + $modified = $user->name; + } + // [Interpretation 1612] set title if not set + if (!$title) + { + $title = 'Book1'; + } + // [Interpretation 1618] set tab name if not set + if (!$subjectTab) + { + $subjectTab = 'Sheet1'; + } + + // [Interpretation 1624] make sure we have the composer classes loaded + self::composerAutoload('phpspreadsheet'); + + // [Interpretation 1628] Create new Spreadsheet object + $spreadsheet = new Spreadsheet(); + + // [Interpretation 1631] Set document properties + $spreadsheet->getProperties() + ->setCreator($creator) + ->setCompany('Joomla Component Builder') + ->setLastModifiedBy($modified) + ->setTitle($title) + ->setSubject($subjectTab); + // [Interpretation 1639] The file type + $file_type = 'Xls'; + // [Interpretation 1642] set description + if ($description) + { + $spreadsheet->getProperties()->setDescription($description); + } + // [Interpretation 1649] set keywords + if ($keywords) + { + $spreadsheet->getProperties()->setKeywords($keywords); + } + // [Interpretation 1656] set category + if ($category) + { + $spreadsheet->getProperties()->setCategory($category); + } + + // [Interpretation 1663] Some styles + $headerStyles = array( + 'font' => array( + 'bold' => true, + 'color' => array('rgb' => '1171A3'), + 'size' => 12, + 'name' => 'Verdana' + )); + $sideStyles = array( + 'font' => array( + 'bold' => true, + 'color' => array('rgb' => '444444'), + 'size' => 11, + 'name' => 'Verdana' + )); + $normalStyles = array( + 'font' => array( + 'color' => array('rgb' => '444444'), + 'size' => 11, + 'name' => 'Verdana' + )); + + // [Interpretation 1685] Add some data + if (($size = self::checkArray($rows)) !== false) + { + $i = 1; + + // [Interpretation 1691] Based on data size we adapt the behaviour. + $xls_mode = 1; + if ($size > 3000) + { + $xls_mode = 3; + $file_type = 'Csv'; + } + elseif ($size > 2000) + { + $xls_mode = 2; + } + + // [Interpretation 1703] Set active sheet and get it. + $active_sheet = $spreadsheet->setActiveSheetIndex(0); + foreach ($rows as $array) + { + $a = 'A'; + foreach ($array as $value) + { + $active_sheet->setCellValue($a.$i, $value); + if ($xls_mode != 3) + { + if ($i == 1) + { + $active_sheet->getColumnDimension($a)->setAutoSize(true); + $active_sheet->getStyle($a.$i)->applyFromArray($headerStyles); + $active_sheet->getStyle($a.$i)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER); + } + elseif ($a === 'A') + { + $active_sheet->getStyle($a.$i)->applyFromArray($sideStyles); + } + elseif ($xls_mode == 1) + { + $active_sheet->getStyle($a.$i)->applyFromArray($normalStyles); + } + } + $a++; + } + $i++; + } + } + else + { + return false; + } + + // [Interpretation 1745] Rename worksheet + $spreadsheet->getActiveSheet()->setTitle($subjectTab); + + // [Interpretation 1749] Set active sheet index to the first sheet, so Excel opens this as the first sheet + $spreadsheet->setActiveSheetIndex(0); + + // [Interpretation 1752] Redirect output to a client's web browser (Excel5) + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment;filename="' . $fileName . '.' . strtolower($file_type) .'"'); + header('Cache-Control: max-age=0'); + // [Interpretation 1759] If you're serving to IE 9, then the following may be needed + header('Cache-Control: max-age=1'); + + // [Interpretation 1762] If you're serving to IE over SSL, then the following may be needed + header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // [Interpretation 1766] Date in the past + header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // [Interpretation 1769] always modified + header ('Cache-Control: cache, must-revalidate'); // [Interpretation 1772] HTTP/1.1 + header ('Pragma: public'); // [Interpretation 1774] HTTP/1.0 + + $writer = IOFactory::createWriter($spreadsheet, $file_type); + $writer->save('php://output'); + jexit(); + } + + /** + * Get CSV Headers + */ + public static function getFileHeaders($dataType) + { + // [Interpretation 1786] make sure we have the composer classes loaded + self::composerAutoload('phpspreadsheet'); + // [Interpretation 1790] get session object + $session = JFactory::getSession(); + $package = $session->get('package', null); + $package = json_decode($package, true); + // [Interpretation 1797] set the headers + if(isset($package['dir'])) + { + // [Interpretation 1801] only load first three rows + $chunkFilter = new PhpOffice\PhpSpreadsheet\Reader\chunkReadFilter(2,1); + // [Interpretation 1805] identify the file type + $inputFileType = IOFactory::identify($package['dir']); + // [Interpretation 1809] create the reader for this file type + $excelReader = IOFactory::createReader($inputFileType); + // [Interpretation 1813] load the limiting filter + $excelReader->setReadFilter($chunkFilter); + $excelReader->setReadDataOnly(true); + // [Interpretation 1818] load the rows (only first three) + $excelObj = $excelReader->load($package['dir']); + $headers = array(); + foreach ($excelObj->getActiveSheet()->getRowIterator() as $row) + { + if($row->getRowIndex() == 1) + { + $cellIterator = $row->getCellIterator(); + $cellIterator->setIterateOnlyExistingCells(false); + foreach ($cellIterator as $cell) + { + if (!is_null($cell)) + { + $headers[$cell->getColumn()] = $cell->getValue(); + } + } + $excelObj->disconnectWorksheets(); + unset($excelObj); + break; + } + } + return $headers; + } + return false; + } + + /** + * Load the Composer Vendor phpspreadsheet + */ + protected static function composephpspreadsheet() + { + // [Interpretation 1856] load the autoloader for phpspreadsheet + require_once JPATH_SITE . '/libraries/phpspreadsheet/vendor/autoload.php'; + // [Interpretation 1860] do not load again + self::$composer['phpspreadsheet'] = true; + + return true; + } + + /** + * Get a Variable + * + * @param string $table The table from which to get the variable + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * + * @return mix string/int/float + * + */ + public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'recipe_manager') + { + if(!$where) + { + $where = JFactory::getUser()->id; + } + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + if (empty($table)) + { + $query->from($db->quoteName('#__'.$main)); + } + else + { + $query->from($db->quoteName('#__'.$main.'_'.$table)); + } + if (is_numeric($where)) + { + $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); + } + elseif (is_string($where)) + { + $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); + } + else + { + return false; + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + return $db->loadResult(); + } + return false; + } + + /** + * Get array of variables + * + * @param string $table The table from which to get the variables + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * @param bool $unique The switch to return a unique array + * + * @return array + * + */ + public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'recipe_manager', $unique = true) + { + if(!$where) + { + $where = JFactory::getUser()->id; + } + + if (!self::checkArray($where) && $where > 0) + { + $where = array($where); + } + + if (self::checkArray($where)) + { + // prep main <-- why? well if $main='' is empty then $table can be categories or users + if (self::checkString($main)) + { + $main = '_'.ltrim($main, '_'); + } + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + + $query->select($db->quoteName(array($what))); + if (empty($table)) + { + $query->from($db->quoteName('#__'.$main)); + } + else + { + $query->from($db->quoteName('#_'.$main.'_'.$table)); + } + // add strings to array search + if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) + { + $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); + } + else + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + if ($unique) + { + return array_unique($db->loadColumn()); + } + return $db->loadColumn(); + } + } + return false; + } + + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') + { + // do some table foot work + $external = false; + if (strpos($table, '#__') !== false) + { + $external = true; + $table = str_replace('#__', '', $table); + } + // check if string is JSON + $result = json_decode($value, true); + if (json_last_error() === JSON_ERROR_NONE) + { + // is JSON + if (self::checkArray($result)) + { + if (self::checkString($table)) + { + $names = array(); + foreach ($result as $val) + { + if ($external) + { + if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) + { + $names[] = $_name; + } + } + else + { + if ($_name = self::getVar($table, $val, $id, $name)) + { + $names[] = $_name; + } + } + } + if (self::checkArray($names)) + { + return (string) implode($sperator,$names); + } + } + return (string) implode($sperator,$result); + } + return (string) json_decode($value); + } + return $value; + } + + public static function isPublished($id,$type) + { + if ($type == 'raw') + { + $type = 'item'; + } + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select(array('a.published')); + $query->from('#__recipe_manager_'.$type.' AS a'); + $query->where('a.id = '. (int) $id); + $query->where('a.published = 1'); + $db->setQuery($query); + $db->execute(); + $found = $db->getNumRows(); + if($found) + { + return true; + } + return false; + } + + public static function getGroupName($id) + { + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select(array('a.title')); + $query->from('#__usergroups AS a'); + $query->where('a.id = '. (int) $id); + $db->setQuery($query); + $db->execute(); + $found = $db->getNumRows(); + if($found) + { + return $db->loadResult(); + } + return $id; + } + + /** + * Get the action permissions + * + * @param string $view The related view name + * @param int $record The item to act upon + * @param string $views The related list view name + * @param mixed $target Only get this permission (like edit, create, delete) + * @param string $component The target component + * @param object $user The user whose permissions we are loading + * + * @return object The JObject of permission/authorised actions + * + */ + public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'recipe_manager', $user = 'null') + { + // load the user if not given + if (!self::checkObject($user)) + { + // get the user object + $user = JFactory::getUser(); + } + // load the JObject + $result = new JObject; + // make view name safe (just incase) + $view = self::safeString($view); + if (self::checkString($views)) + { + $views = self::safeString($views); + } + // get all actions from component + $actions = JAccess::getActionsFromFile( + JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', + "/access/section[@name='component']/" + ); + // if non found then return empty JObject + if (empty($actions)) + { + return $result; + } + // get created by if not found + if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + { + $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + } + // set actions only set in component settings + $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); + // check if we have a target + $checkTarget = false; + if ($target) + { + // convert to an array + if (self::checkString($target)) + { + $target = array($target); + } + // check if we are good to go + if (self::checkArray($target)) + { + $checkTarget = true; + } + } + // loop the actions and set the permissions + foreach ($actions as $action) + { + // check target action filter + if ($checkTarget && self::filterActions($view, $action->name, $target)) + { + continue; + } + // set to use component default + $fallback = true; + // reset permission per/action + $permission = false; + $catpermission = false; + // set area + $area = 'comp'; + // check if the record has an ID and the action is item related (not a component action) + if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) + { + // we are in item + $area = 'item'; + // The record has been set. Check the record permissions. + $permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id); + // if no permission found, check edit own + if (!$permission) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // the correct target + $coreCheck = (array) explode('.', $action->name); + // check that we have both local and global access + if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) && + $user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + { + // we are in item + $area = 'category'; + // set the core check + $coreCheck = explode('.', $action->name); + $core = $coreCheck[0]; + // make sure we use the core. action check for the categories + if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false ) + { + $coreCheck[0] = 'core'; + $categoryCheck = implode('.', $coreCheck); + } + else + { + $categoryCheck = $action->name; + } + // The record has a category. Check the category permissions. + $catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid); + if (!$catpermission && !is_null($catpermission)) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // check that we have both local and global access + if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) && + $user->authorise($core . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + } + } + // if allowed then fallback on component global settings + if ($fallback) + { + // if item/category blocks access then don't fall back on global + if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission)) + { + // do not allow + $result->set($action->name, false); + } + // Finally remember the global settings have the final say. (even if item allow) + // The local item permissions can block, but it can't open and override of global permissions. + // Since items are created by users and global permissions is set by system admin. + else + { + $result->set($action->name, $user->authorise($action->name, 'com_' . $component)); + } + } + } + return $result; + } + + /** + * Filter the action permissions + * + * @param string $action The action to check + * @param array $targets The array of target actions + * + * @return boolean true if action should be filtered out + * + */ + protected static function filterActions(&$view, &$action, &$targets) + { + foreach ($targets as $target) + { + if (strpos($action, $view . '.' . $target) !== false || + strpos($action, 'core.' . $target) !== false) + { + return false; + break; + } + } + return true; + } + + /** + * Get any component's model + */ + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Recipe_manager', $config = array()) + { + // fix the name + $name = self::safeString($name); + // full path to models + $fullPathModels = $path . '/models'; + // load the model file + JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + // make sure the table path is loaded + if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + { + // This is the JCB default path to tables in Joomla 3.x + $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + } + // get instance + $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + // if model not found (strange) + if ($model == false) + { + jimport('joomla.filesystem.file'); + // get file path + $filePath = $path . '/' . $name . '.php'; + $fullPathModel = $fullPathModels . '/' . $name . '.php'; + // check if it exists + if (JFile::exists($filePath)) + { + // get the file + require_once $filePath; + } + elseif (JFile::exists($fullPathModel)) + { + // get the file + require_once $fullPathModel; + } + // build class names + $modelClass = $Component . 'Model' . $name; + if (class_exists($modelClass)) + { + // initialize the model + return new $modelClass($config); + } + } + return $model; + } + + /** + * Add to asset Table + */ + public static function setAsset($id, $table, $inherit = true) + { + $parent = JTable::getInstance('Asset'); + $parent->loadByName('com_recipe_manager'); + + $parentId = $parent->id; + $name = 'com_recipe_manager.'.$table.'.'.$id; + $title = ''; + + $asset = JTable::getInstance('Asset'); + $asset->loadByName($name); + + // Check for an error. + $error = $asset->getError(); + + if ($error) + { + return false; + } + else + { + // Specify how a new or moved node asset is inserted into the tree. + if ($asset->parent_id != $parentId) + { + $asset->setLocation($parentId, 'last-child'); + } + + // Prepare the asset to be stored. + $asset->parent_id = $parentId; + $asset->name = $name; + $asset->title = $title; + // get the default asset rules + $rules = self::getDefaultAssetRules('com_recipe_manager', $table, $inherit); + if ($rules instanceof JAccessRules) + { + $asset->rules = (string) $rules; + } + + if (!$asset->check() || !$asset->store()) + { + JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + return false; + } + else + { + // Create an asset_id or heal one that is corrupted. + $object = new stdClass(); + + // Must be a valid primary key value. + $object->id = $id; + $object->asset_id = (int) $asset->id; + + // Update their asset_id to link to the asset table. + return JFactory::getDbo()->updateObject('#__recipe_manager_'.$table, $object, 'id'); + } + } + return false; + } + + /** + * Gets the default asset Rules for a component/view. + */ + protected static function getDefaultAssetRules($component, $view, $inherit = true) + { + // if new or inherited + $assetId = 0; + // Only get the actual item rules if not inheriting + if (!$inherit) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + // check that there is a value + if ($db->getNumRows()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + } + } + // get asset rules + $result = JAccess::getAssetRules($assetId); + if ($result instanceof JAccessRules) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($view !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + elseif ($inherit) + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count((array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules($_result); + // return filtered rules + return $rules; + } + } + return $result; + } + + /** + * xmlAppend + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement + * + * @return null + * + */ + public static function xmlAppend(&$xml, $node) + { + if (!$node) + { + // element was not returned + return; + } + switch (get_class($node)) + { + case 'stdClass': + if (property_exists($node, 'comment')) + { + self::xmlComment($xml, $node->comment); + } + if (property_exists($node, 'fieldXML')) + { + self::xmlAppend($xml, $node->fieldXML); + } + break; + case 'SimpleXMLElement': + $domXML = dom_import_simplexml($xml); + $domNode = dom_import_simplexml($node); + $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); + $xml = simplexml_import_dom($domXML); + break; + } + } + + /** + * xmlComment + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param string $comment The comment to inject + * + * @return null + * + */ + public static function xmlComment(&$xml, $comment) + { + $domXML = dom_import_simplexml($xml); + $domComment = new DOMComment($comment); + $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); + $domXML->appendChild($nodeTarget); + $xml = simplexml_import_dom($domXML); + } + + /** + * xmlAddAttributes + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $attributes The attributes to apply to the XML element + * + * @return null + * + */ + public static function xmlAddAttributes(&$xml, $attributes = array()) + { + foreach ($attributes as $key => $value) + { + $xml->addAttribute($key, $value); + } + } + + /** + * xmlAddOptions + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $options The options to apply to the XML element + * + * @return void + * + */ + public static function xmlAddOptions(&$xml, $options = array()) + { + foreach ($options as $key => $value) + { + $addOption = $xml->addChild('option'); + $addOption->addAttribute('value', $key); + $addOption[] = $value; + } + } + + /** + * get the field object + * + * @param array $attributes The array of attributes + * @param string $default The default of the field + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldObject(&$attributes, $default = '', $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes) && isset($attributes['type'])) + { + // make sure the form helper class is loaded + if (!method_exists('JFormHelper', 'loadFieldType')) + { + jimport('joomla.form.form'); + } + // get field type + $field = JFormHelper::loadFieldType($attributes['type'], true); + // get field xml + $XML = self::getFieldXML($attributes, $options); + // setup the field + $field->setup($XML, $default); + // return the field object + return $field; + } + return false; + } + + /** + * get the field xml + * + * @param array $attributes The array of attributes + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldXML(&$attributes, $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes)) + { + // start field xml + $XML = new SimpleXMLElement(''); + // load the attributes + self::xmlAddAttributes($XML, $attributes); + // check if we have options + if (self::checkArray($options)) + { + // load the options + self::xmlAddOptions($XML, $options); + } + // return the field xml + return $XML; + } + return false; + } + + /** + * Render Bool Button + * + * @param array $args All the args for the button + * 0) name + * 1) additional (options class) // not used at this time + * 2) default + * 3) yes (name) + * 4) no (name) + * + * @return string The input html of the button + * + */ + public static function renderBoolButton() + { + $args = func_get_args(); + // check if there is additional button class + $additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time + // button attributes + $buttonAttributes = array( + 'type' => 'radio', + 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'class' => 'btn-group', + 'filter' => 'INT', + 'default' => isset($args[2]) ? (int) $args[2] : 0); + // set the button options + $buttonOptions = array( + '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', + '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + // return the input + return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + } + + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + */ + public static function checkJson($string) + { + if (self::checkString($string)) + { + json_decode($string); + return (json_last_error() === JSON_ERROR_NONE); + } + return false; + } + + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + */ + public static function checkObject($object) + { + if (isset($object) && is_object($object)) + { + return count((array)$object) > 0; + } + return false; + } + + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool/int number of items in array on success + */ + public static function checkArray($array, $removeEmptyString = false) + { + if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) + { + // also make sure the empty strings are removed + if ($removeEmptyString) + { + foreach ($array as $key => $string) + { + if (empty($string)) + { + unset($array[$key]); + } + } + return self::checkArray($array, false); + } + return $nr; + } + return false; + } + + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + */ + public static function checkString($string) + { + if (isset($string) && is_string($string) && strlen($string) > 0) + { + return true; + } + return false; + } + + /** + * Check if we are connected + * Thanks https://stackoverflow.com/a/4860432/1429677 + * + * @returns bool true on success + */ + public static function isConnected() + { + // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) + if ($connected) + { + //action when connected + $is_conn = true; + fclose($connected); + } + else + { + //action in connection failure + $is_conn = false; + } + return $is_conn; + } + + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + */ + public static function mergeArrays($arrays) + { + if(self::checkArray($arrays)) + { + $arrayBuket = array(); + foreach ($arrays as $array) + { + if (self::checkArray($array)) + { + $arrayBuket = array_merge($arrayBuket, $array); + } + } + return $arrayBuket; + } + return false; + } + + // typo sorry! + public static function sorten($string, $length = 40, $addTip = true) + { + return self::shorten($string, $length, $addTip); + } + + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + */ + public static function shorten($string, $length = 40, $addTip = true) + { + if (self::checkString($string)) + { + $initial = strlen($string); + $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); + $words_count = count((array)$words); + + $word_length = 0; + $last_word = 0; + for (; $last_word < $words_count; ++$last_word) + { + $word_length += strlen($words[$last_word]); + if ($word_length > $length) + { + break; + } + } + + $newString = implode(array_slice($words, 0, $last_word)); + $final = strlen($newString); + if ($initial != $final && $addTip) + { + $title = self::shorten($string, 400 , false); + return ''.trim($newString).'...'; + } + elseif ($initial != $final && !$addTip) + { + return trim($newString).'...'; + } + } + return $string; + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + */ + public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + if ($replaceNumbers === true) + { + // remove all numbers and replace with english text version (works well only up to millions) + $string = self::replaceNumbers($string); + } + // 0nly continue if we have a string + if (self::checkString($string)) + { + // create file name without the extention that is safe + if ($type === 'filename') + { + // make sure VDM is not in the string + $string = str_replace('VDM', 'vDm', $string); + // Remove anything which isn't a word, whitespace, number + // or any of the following caracters -_() + // If you don't need to handle multi-byte characters + // you can use preg_replace rather than mb_ereg_replace + // Thanks @Ɓukasz Rysiak! + // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); + $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); + // http://stackoverflow.com/a/2021729/1429677 + return preg_replace('/\s+/', ' ', $string); + } + // remove all other characters + $string = trim($string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + // Transliterate string + $string = self::transliterate($string); + // remove all and keep only characters + if ($keepOnlyCharacters) + { + $string = preg_replace("/[^A-Za-z ]/", '', $string); + } + // keep both numbers and characters + else + { + $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); + } + // select final adaptations + if ($type === 'L' || $type === 'strtolower') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // default is to return lower + return strtolower($string); + } + elseif ($type === 'W') + { + // return a string with all first letter of each word uppercase(no undersocre) + return ucwords(strtolower($string)); + } + elseif ($type === 'w' || $type === 'word') + { + // return a string with all lowercase(no undersocre) + return strtolower($string); + } + elseif ($type === 'Ww' || $type === 'Word') + { + // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) + return ucfirst(strtolower($string)); + } + elseif ($type === 'WW' || $type === 'WORD') + { + // return a string with all the uppercase(no undersocre) + return strtoupper($string); + } + elseif ($type === 'U' || $type === 'strtoupper') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // return all upper + return strtoupper($string); + } + elseif ($type === 'F' || $type === 'ucfirst') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // return with first caracter to upper + return ucfirst(strtolower($string)); + } + elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') + { + // convert all words to first letter uppercase + $string = ucwords(strtolower($string)); + // remove white space + $string = preg_replace('/\s+/', '', $string); + // now return first letter lowercase + return lcfirst($string); + } + // return string + return $string; + } + // not a string + return ''; + } + + public static function transliterate($string) + { + // set tag only once + if (!self::checkString(self::$langTag)) + { + // get global value + self::$langTag = JComponentHelper::getParams('com_recipe_manager')->get('language', 'en-GB'); + } + // Transliterate on the language requested + $lang = Language::getInstance(self::$langTag); + return $lang->transliterate($string); + } + + public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) + { + if (self::checkString($var)) + { + $filter = new JFilterInput(); + $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); + if ($shorten) + { + return self::shorten($string,$length); + } + return $string; + } + else + { + return ''; + } + } + + public static function replaceNumbers($string) + { + // set numbers array + $numbers = array(); + // first get all numbers + preg_match_all('!\d+!', $string, $numbers); + // check if we have any numbers + if (isset($numbers[0]) && self::checkArray($numbers[0])) + { + foreach ($numbers[0] as $number) + { + $searchReplace[$number] = self::numberToString((int)$number); + } + // now replace numbers in string + $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); + // check if we missed any, strange if we did. + return self::replaceNumbers($string); + } + // return the string with no numbers remaining. + return $string; + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + */ + public static function numberToString($x) + { + $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "thirteen", + "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", + "nineteen", "twenty", 30 => "thirty", 40 => "forty", + 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", + 90 => "ninety" ); + + if(!is_numeric($x)) + { + $w = $x; + } + elseif(fmod($x, 1) != 0) + { + $w = $x; + } + else + { + if($x < 0) + { + $w = 'minus '; + $x = -$x; + } + else + { + $w = ''; + // ... now $x is a non-negative integer. + } + + if($x < 21) // 0 to 20 + { + $w .= $nwords[$x]; + } + elseif($x < 100) // 21 to 99 + { + $w .= $nwords[10 * floor($x/10)]; + $r = fmod($x, 10); + if($r > 0) + { + $w .= ' '. $nwords[$r]; + } + } + elseif($x < 1000) // 100 to 999 + { + $w .= $nwords[floor($x/100)] .' hundred'; + $r = fmod($x, 100); + if($r > 0) + { + $w .= ' and '. self::numberToString($r); + } + } + elseif($x < 1000000) // 1000 to 999999 + { + $w .= self::numberToString(floor($x/1000)) .' thousand'; + $r = fmod($x, 1000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::numberToString($r); + } + } + else // millions + { + $w .= self::numberToString(floor($x/1000000)) .' million'; + $r = fmod($x, 1000000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::numberToString($r); + } + } + } + return $w; + } + + /** + * Random Key + * + * @returns a string + */ + public static function randomkey($size) + { + $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; + $key = array(); + $bagsize = strlen($bag) - 1; + for ($i = 0; $i < $size; $i++) + { + $get = rand(0, $bagsize); + $key[] = $bag[$get]; + } + return implode($key); + } +} diff --git a/admin/language/af-ZA/af-ZA.com_recipe_manager.ini b/admin/language/af-ZA/af-ZA.com_recipe_manager.ini new file mode 100644 index 0000000..91ee866 --- /dev/null +++ b/admin/language/af-ZA/af-ZA.com_recipe_manager.ini @@ -0,0 +1,15 @@ +COM_RECIPE_MANAGER_AUTHOR="Skrywer" +COM_RECIPE_MANAGER_BACK="Terug" +COM_RECIPE_MANAGER_CONFIG_AUTHOR="Skrywer Inligting" +COM_RECIPE_MANAGER_CONFIG_AUTHOR_EMAIL_DESC="Die epos adres van die skrywer van die komponent." +COM_RECIPE_MANAGER_CONFIG_AUTHOR_EMAIL_LABEL="Skrywer Epos" +COM_RECIPE_MANAGER_CONFIG_AUTHOR_NAME_DESC="Die naam van die skrywer van die komponent." +COM_RECIPE_MANAGER_CONFIG_AUTHOR_NAME_LABEL="Skrywer Naam" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_DESC="Stel die siklus wanneer die outomatiese funksie die items in die tabelle moet terug in teken wat aan gebruikers uit geteken is." +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_LABEL="In teken siklus" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_FIVE="Een keer 'n week" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_FOUR="Elke tweede dag" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_ONE="Elke vyf ure" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_SIX="Nooit" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_THREE="Een keer 'n dag" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_TWO="Elke twaalf ure" \ No newline at end of file diff --git a/admin/language/en-GB/en-GB.com_recipe_manager.ini b/admin/language/en-GB/en-GB.com_recipe_manager.ini new file mode 100644 index 0000000..876d71e --- /dev/null +++ b/admin/language/en-GB/en-GB.com_recipe_manager.ini @@ -0,0 +1,260 @@ +COM_RECIPE_MANAGER="Recipe Manager" +COM_RECIPE_MANAGER_ARCHIVED="Archived" +COM_RECIPE_MANAGER_AUTHOR="Author" +COM_RECIPE_MANAGER_BACK="Back" +COM_RECIPE_MANAGER_CLOSE_NEW="Close & New" +COM_RECIPE_MANAGER_CONFIG_AUTHOR="Author Info" +COM_RECIPE_MANAGER_CONFIG_AUTHOR_EMAIL_DESC="The email address of the author of this component." +COM_RECIPE_MANAGER_CONFIG_AUTHOR_EMAIL_LABEL="Author Email" +COM_RECIPE_MANAGER_CONFIG_AUTHOR_NAME_DESC="The name of the author of this component." +COM_RECIPE_MANAGER_CONFIG_AUTHOR_NAME_LABEL="Author Name" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_DESC="Set the intervals for the auto checkin fuction of tables that checks out the items to an user." +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_LABEL="Check in timer" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_FIVE="Once a week" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_FOUR="Every second day" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_ONE="Every five hours" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_SIX="Never" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_THREE="Once a day" +COM_RECIPE_MANAGER_CONFIG_CHECK_TIMER_OPTION_TWO="Every twelve hours" +COM_RECIPE_MANAGER_CONFIG_GLOBAL_DESC="The Global Parameters" +COM_RECIPE_MANAGER_CONFIG_GLOBAL_LABEL="Global" +COM_RECIPE_MANAGER_CONTRIBUTOR="Contributor" +COM_RECIPE_MANAGER_CONTRIBUTORS="Contributors" +COM_RECIPE_MANAGER_CREATE_NEW_S="Create New %s" +COM_RECIPE_MANAGER_DASH="Dashboard" +COM_RECIPE_MANAGER_DASHBOARD="Recipe Manager Dashboard" +COM_RECIPE_MANAGER_DASHBOARD_INGREDIENTS="Ingredients

" +COM_RECIPE_MANAGER_DASHBOARD_RECIPES="Recipes

" +COM_RECIPE_MANAGER_DASHBOARD_RECIPES_CATID="Categories For
Recipes" +COM_RECIPE_MANAGER_DATE="Date" +COM_RECIPE_MANAGER_EDIT_CREATED_BY="Edit Created By" +COM_RECIPE_MANAGER_EDIT_CREATED_BY_DESC="Allows users in this group to edit created by." +COM_RECIPE_MANAGER_EDIT_CREATED_DATE="Edit Created Date" +COM_RECIPE_MANAGER_EDIT_CREATED_DATE_DESC="Allows users in this group to edit created date." +COM_RECIPE_MANAGER_EDIT_S="Edit %s" +COM_RECIPE_MANAGER_EDIT_VERSIONS="Edit Version" +COM_RECIPE_MANAGER_EDIT_VERSIONS_DESC="Allows users in this group to edit versions." +COM_RECIPE_MANAGER_EXPORT_DATA="Export Data" +COM_RECIPE_MANAGER_EXPORT_DATA_DESC="Allows users in this group to export data." +COM_RECIPE_MANAGER_EXPORT_FAILED="Export Failed" +COM_RECIPE_MANAGER_FILTER_NAME_ASCENDING="Name ascending" +COM_RECIPE_MANAGER_FILTER_NAME_DESCENDING="Name descending" +COM_RECIPE_MANAGER_FILTER_PUBLISHED="Status" +COM_RECIPE_MANAGER_FILTER_PUBLISHED_INGREDIENTS="Status options for ingredients" +COM_RECIPE_MANAGER_FILTER_PUBLISHED_RECIPES="Status options for recipes" +COM_RECIPE_MANAGER_FILTER_SEARCH="Searchingredients" +COM_RECIPE_MANAGER_FILTER_SEARCH_INGREDIENTS="Search the ingredient items. Prefix with ID: to search for an item by ID." +COM_RECIPE_MANAGER_FILTER_SEARCH_RECIPES="Search the recipe items. Prefix with ID: to search for an item by ID." +COM_RECIPE_MANAGER_FILTER_SELECT_ACCESS="Select Access" +COM_RECIPE_MANAGER_FILTER_SELECT_RECIPES_CATEGORIES="Select Recipes Categories" +COM_RECIPE_MANAGER_HELP_MANAGER="Help" +COM_RECIPE_MANAGER_IMPORT_CONTINUE="Continue" +COM_RECIPE_MANAGER_IMPORT_DATA="Import Data" +COM_RECIPE_MANAGER_IMPORT_DATA_DESC="Allows users in this group to import data." +COM_RECIPE_MANAGER_IMPORT_ERROR="Import error." +COM_RECIPE_MANAGER_IMPORT_FAILED="Import Failed" +COM_RECIPE_MANAGER_IMPORT_FILE_COLUMNS="File Columns" +COM_RECIPE_MANAGER_IMPORT_FORMATS_ACCEPTED="formats accepted" +COM_RECIPE_MANAGER_IMPORT_FROM_DIRECTORY="Directory" +COM_RECIPE_MANAGER_IMPORT_FROM_UPLOAD="Upload" +COM_RECIPE_MANAGER_IMPORT_FROM_URL="URL" +COM_RECIPE_MANAGER_IMPORT_GET_BOTTON="Get File" +COM_RECIPE_MANAGER_IMPORT_IGNORE_COLUMN="-- Ignore This Column --" +COM_RECIPE_MANAGER_IMPORT_LINK_FILE_TO_TABLE_COLUMNS="Link File to Table Columns" +COM_RECIPE_MANAGER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE="Does not have a valid file type." +COM_RECIPE_MANAGER_IMPORT_MSG_ENTER_A_URL="Please enter a url." +COM_RECIPE_MANAGER_IMPORT_MSG_INVALID_URL="Invalid url." +COM_RECIPE_MANAGER_IMPORT_MSG_NO_FILE_SELECTED="No import file selected." +COM_RECIPE_MANAGER_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE="Path does not have a valid file." +COM_RECIPE_MANAGER_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY="Please enter the file directory." +COM_RECIPE_MANAGER_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS="Please link all columns." +COM_RECIPE_MANAGER_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY="Please enter the file directory." +COM_RECIPE_MANAGER_IMPORT_MSG_PLEASE_SELECT_A_FILE="Please select a file to import." +COM_RECIPE_MANAGER_IMPORT_MSG_WARNIMPORTFILE="Warning, import file error." +COM_RECIPE_MANAGER_IMPORT_MSG_WARNIMPORTUPLOADERROR="Warning, import upload error." +COM_RECIPE_MANAGER_IMPORT_NO_IMPORT_TYPE_FOUND="Import type not found." +COM_RECIPE_MANAGER_IMPORT_PLEASE_SELECT_COLUMN="-- Please Select Column --" +COM_RECIPE_MANAGER_IMPORT_SELECT_FILE="Select File" +COM_RECIPE_MANAGER_IMPORT_SELECT_FILE_DIRECTORY="Set the path to file" +COM_RECIPE_MANAGER_IMPORT_SELECT_FILE_FOR_INGREDIENTS="Select the file to import data to ingredients." +COM_RECIPE_MANAGER_IMPORT_SELECT_FILE_FOR_RECIPES="Select the file to import data to recipes." +COM_RECIPE_MANAGER_IMPORT_SELECT_FILE_URL="Enter file URL" +COM_RECIPE_MANAGER_IMPORT_SUCCESS="Great! Import successful." +COM_RECIPE_MANAGER_IMPORT_TABLE_COLUMNS="Table Columns" +COM_RECIPE_MANAGER_IMPORT_TITLE="Data Importer" +COM_RECIPE_MANAGER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE="Package to import not found." +COM_RECIPE_MANAGER_IMPORT_UPDATE_DATA="Import Data" +COM_RECIPE_MANAGER_IMPORT_UPLOAD_BOTTON="Upload File" +COM_RECIPE_MANAGER_INACTIVE="Inactive" +COM_RECIPE_MANAGER_INGREDIENT="Ingredient" +COM_RECIPE_MANAGER_INGREDIENTS="Ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_ACCESS="Ingredients Access" +COM_RECIPE_MANAGER_INGREDIENTS_ACCESS_DESC="Allows the users in this group to access access ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_BATCH_OPTIONS="Batch process the selected Ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_BATCH_TIP="All changes will be applied to all selected Ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_BATCH_USE="Ingredients Batch Use" +COM_RECIPE_MANAGER_INGREDIENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_DASHBOARD_LIST="Ingredients Dashboard List" +COM_RECIPE_MANAGER_INGREDIENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of ingredient" +COM_RECIPE_MANAGER_INGREDIENTS_EDIT_VERSION="Ingredients Edit Version" +COM_RECIPE_MANAGER_INGREDIENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_EXPORT="Ingredients Export" +COM_RECIPE_MANAGER_INGREDIENTS_EXPORT_DESC="Allows the users in this group to export export ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_IMPORT="Ingredients Import" +COM_RECIPE_MANAGER_INGREDIENTS_IMPORT_DESC="Allows the users in this group to import import ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_ARCHIVED="%s Ingredients archived." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_ARCHIVED_1="%s Ingredient archived." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_CHECKED_IN_0="No Ingredient successfully checked in." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_CHECKED_IN_1="%d Ingredient successfully checked in." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_CHECKED_IN_MORE="%d Ingredients successfully checked in." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_DELETED="%s Ingredients deleted." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_DELETED_1="%s Ingredient deleted." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_FAILED_PUBLISHING="%s Ingredients failed publishing." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_FAILED_PUBLISHING_1="%s Ingredient failed publishing." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_FEATURED="%s Ingredients featured." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_FEATURED_1="%s Ingredient featured." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_PUBLISHED="%s Ingredients published." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_PUBLISHED_1="%s Ingredient published." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_TRASHED="%s Ingredients trashed." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_TRASHED_1="%s Ingredient trashed." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_UNFEATURED="%s Ingredients unfeatured." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_UNFEATURED_1="%s Ingredient unfeatured." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_UNPUBLISHED="%s Ingredients unpublished." +COM_RECIPE_MANAGER_INGREDIENTS_N_ITEMS_UNPUBLISHED_1="%s Ingredient unpublished." +COM_RECIPE_MANAGER_INGREDIENTS_SUBMENU="Ingredients Submenu" +COM_RECIPE_MANAGER_INGREDIENTS_SUBMENU_DESC="Allows the users in this group to submenu of ingredient" +COM_RECIPE_MANAGER_INGREDIENT_CREATED_BY_DESC="The user that created this Ingredient." +COM_RECIPE_MANAGER_INGREDIENT_CREATED_BY_LABEL="Created By" +COM_RECIPE_MANAGER_INGREDIENT_CREATED_DATE_DESC="The date this Ingredient was created." +COM_RECIPE_MANAGER_INGREDIENT_CREATED_DATE_LABEL="Created Date" +COM_RECIPE_MANAGER_INGREDIENT_CUP="Cup" +COM_RECIPE_MANAGER_INGREDIENT_DESSERTSPOON="Dessertspoon" +COM_RECIPE_MANAGER_INGREDIENT_DETAILS="Details" +COM_RECIPE_MANAGER_INGREDIENT_EDIT="Editing the Ingredient" +COM_RECIPE_MANAGER_INGREDIENT_ERROR_UNIQUE_ALIAS="Another Ingredient has the same alias." +COM_RECIPE_MANAGER_INGREDIENT_FLUIDOUNCE="Fluidounce" +COM_RECIPE_MANAGER_INGREDIENT_GALLON="Gallon" +COM_RECIPE_MANAGER_INGREDIENT_ID="Id" +COM_RECIPE_MANAGER_INGREDIENT_IMAGE="Image" +COM_RECIPE_MANAGER_INGREDIENT_IMAGE_LABEL="Image" +COM_RECIPE_MANAGER_INGREDIENT_MODIFIED_BY_DESC="The last user that modified this Ingredient." +COM_RECIPE_MANAGER_INGREDIENT_MODIFIED_BY_LABEL="Modified By" +COM_RECIPE_MANAGER_INGREDIENT_MODIFIED_DATE_DESC="The date this Ingredient was modified." +COM_RECIPE_MANAGER_INGREDIENT_MODIFIED_DATE_LABEL="Modified Date" +COM_RECIPE_MANAGER_INGREDIENT_NAME="Name" +COM_RECIPE_MANAGER_INGREDIENT_NAME_DESCRIPTION="Enter Name Here" +COM_RECIPE_MANAGER_INGREDIENT_NAME_HINT="Name Here" +COM_RECIPE_MANAGER_INGREDIENT_NAME_LABEL="Name" +COM_RECIPE_MANAGER_INGREDIENT_NAME_MESSAGE="Error! Please add name here." +COM_RECIPE_MANAGER_INGREDIENT_NEW="A New Ingredient" +COM_RECIPE_MANAGER_INGREDIENT_ORDERING_LABEL="Ordering" +COM_RECIPE_MANAGER_INGREDIENT_PERMISSION="Permissions" +COM_RECIPE_MANAGER_INGREDIENT_PINT="Pint" +COM_RECIPE_MANAGER_INGREDIENT_PUBLISHING="Publishing" +COM_RECIPE_MANAGER_INGREDIENT_QUART="Quart" +COM_RECIPE_MANAGER_INGREDIENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Ingredient to customise the alias." +COM_RECIPE_MANAGER_INGREDIENT_STATUS="Status" +COM_RECIPE_MANAGER_INGREDIENT_TABLESPOON="Tablespoon" +COM_RECIPE_MANAGER_INGREDIENT_TEASPOON="Teaspoon" +COM_RECIPE_MANAGER_INGREDIENT_UNIT="Unit" +COM_RECIPE_MANAGER_INGREDIENT_UNIT_LABEL="Select Unit" +COM_RECIPE_MANAGER_INGREDIENT_VERSION_DESC="A count of the number of times this Ingredient has been revised." +COM_RECIPE_MANAGER_INGREDIENT_VERSION_LABEL="Version" +COM_RECIPE_MANAGER_KEEP_ORIGINAL_ACCESS="- Keep Original Access -" +COM_RECIPE_MANAGER_KEEP_ORIGINAL_CATEGORY="- Keep Original Category -" +COM_RECIPE_MANAGER_KEEP_ORIGINAL_STATE="- Keep Original State -" +COM_RECIPE_MANAGER_LICENSE="License" +COM_RECIPE_MANAGER_NEW="New" +COM_RECIPE_MANAGER_NOT_FOUND_OR_ACCESS_DENIED="Not found or access denied!" +COM_RECIPE_MANAGER_NO_ACCESS_GRANTED="No Access Granted!" +COM_RECIPE_MANAGER_PUBLISHED="Published" +COM_RECIPE_MANAGER_RECIPE="Recipe" +COM_RECIPE_MANAGER_RECIPES="Recipes" +COM_RECIPE_MANAGER_RECIPES_ACCESS="Recipes Access" +COM_RECIPE_MANAGER_RECIPES_ACCESS_DESC="Allows the users in this group to access access recipes" +COM_RECIPE_MANAGER_RECIPES_BATCH_OPTIONS="Batch process the selected Recipes" +COM_RECIPE_MANAGER_RECIPES_BATCH_TIP="All changes will be applied to all selected Recipes" +COM_RECIPE_MANAGER_RECIPES_BATCH_USE="Recipes Batch Use" +COM_RECIPE_MANAGER_RECIPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch recipes" +COM_RECIPE_MANAGER_RECIPES_DASHBOARD_LIST="Recipes Dashboard List" +COM_RECIPE_MANAGER_RECIPES_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of recipe" +COM_RECIPE_MANAGER_RECIPES_EDIT_VERSION="Recipes Edit Version" +COM_RECIPE_MANAGER_RECIPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version recipes" +COM_RECIPE_MANAGER_RECIPES_EXPORT="Recipes Export" +COM_RECIPE_MANAGER_RECIPES_EXPORT_DESC="Allows the users in this group to export export recipes" +COM_RECIPE_MANAGER_RECIPES_IMPORT="Recipes Import" +COM_RECIPE_MANAGER_RECIPES_IMPORT_DESC="Allows the users in this group to import import recipes" +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_ARCHIVED="%s Recipes archived." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_ARCHIVED_1="%s Recipe archived." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_CHECKED_IN_0="No Recipe successfully checked in." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_CHECKED_IN_1="%d Recipe successfully checked in." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_CHECKED_IN_MORE="%d Recipes successfully checked in." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_DELETED="%s Recipes deleted." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_DELETED_1="%s Recipe deleted." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_FAILED_PUBLISHING="%s Recipes failed publishing." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_FAILED_PUBLISHING_1="%s Recipe failed publishing." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_FEATURED="%s Recipes featured." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_FEATURED_1="%s Recipe featured." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_PUBLISHED="%s Recipes published." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_PUBLISHED_1="%s Recipe published." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_TRASHED="%s Recipes trashed." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_TRASHED_1="%s Recipe trashed." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_UNFEATURED="%s Recipes unfeatured." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_UNFEATURED_1="%s Recipe unfeatured." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_UNPUBLISHED="%s Recipes unpublished." +COM_RECIPE_MANAGER_RECIPES_N_ITEMS_UNPUBLISHED_1="%s Recipe unpublished." +COM_RECIPE_MANAGER_RECIPES_SUBMENU="Recipes Submenu" +COM_RECIPE_MANAGER_RECIPES_SUBMENU_DESC="Allows the users in this group to submenu of recipe" +COM_RECIPE_MANAGER_RECIPE_ALIAS="Alias" +COM_RECIPE_MANAGER_RECIPE_ALIAS_HINT="Auto-generated from name" +COM_RECIPE_MANAGER_RECIPE_ALIAS_LABEL="Alias" +COM_RECIPE_MANAGER_RECIPE_CATID_DESCRIPTION="select one of the following categories" +COM_RECIPE_MANAGER_RECIPE_CATID_LABEL="Select a category" +COM_RECIPE_MANAGER_RECIPE_CREATED_BY_DESC="The user that created this Recipe." +COM_RECIPE_MANAGER_RECIPE_CREATED_BY_LABEL="Created By" +COM_RECIPE_MANAGER_RECIPE_CREATED_DATE_DESC="The date this Recipe was created." +COM_RECIPE_MANAGER_RECIPE_CREATED_DATE_LABEL="Created Date" +COM_RECIPE_MANAGER_RECIPE_DESCRIPTION="Description" +COM_RECIPE_MANAGER_RECIPE_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_RECIPE_MANAGER_RECIPE_DESCRIPTION_HINT="Add Description Here" +COM_RECIPE_MANAGER_RECIPE_DESCRIPTION_LABEL="Description" +COM_RECIPE_MANAGER_RECIPE_DETAILS="Details" +COM_RECIPE_MANAGER_RECIPE_EDIT="Editing the Recipe" +COM_RECIPE_MANAGER_RECIPE_ERROR_UNIQUE_ALIAS="Another Recipe has the same alias." +COM_RECIPE_MANAGER_RECIPE_ID="Id" +COM_RECIPE_MANAGER_RECIPE_IMAGE="Image" +COM_RECIPE_MANAGER_RECIPE_IMAGE_LABEL="Image" +COM_RECIPE_MANAGER_RECIPE_INGREDIENTS="Ingredients" +COM_RECIPE_MANAGER_RECIPE_INGREDIENTS_LABEL="The Ingredients List" +COM_RECIPE_MANAGER_RECIPE_MODIFIED_BY_DESC="The last user that modified this Recipe." +COM_RECIPE_MANAGER_RECIPE_MODIFIED_BY_LABEL="Modified By" +COM_RECIPE_MANAGER_RECIPE_MODIFIED_DATE_DESC="The date this Recipe was modified." +COM_RECIPE_MANAGER_RECIPE_MODIFIED_DATE_LABEL="Modified Date" +COM_RECIPE_MANAGER_RECIPE_NAME="Name" +COM_RECIPE_MANAGER_RECIPE_NAME_DESCRIPTION="Enter Name Here" +COM_RECIPE_MANAGER_RECIPE_NAME_HINT="Name Here" +COM_RECIPE_MANAGER_RECIPE_NAME_LABEL="Name" +COM_RECIPE_MANAGER_RECIPE_NAME_MESSAGE="Error! Please add name here." +COM_RECIPE_MANAGER_RECIPE_NEW="A New Recipe" +COM_RECIPE_MANAGER_RECIPE_ORDERING_LABEL="Ordering" +COM_RECIPE_MANAGER_RECIPE_PERMISSION="Permissions" +COM_RECIPE_MANAGER_RECIPE_PREPARING_TIME="Preparing Time" +COM_RECIPE_MANAGER_RECIPE_PREPARING_TIME_DESCRIPTION="Preparing time in minutes" +COM_RECIPE_MANAGER_RECIPE_PREPARING_TIME_LABEL="Preparing Time (min)" +COM_RECIPE_MANAGER_RECIPE_PUBLISHING="Publishing" +COM_RECIPE_MANAGER_RECIPE_QUANTITY_LABEL="Quantity" +COM_RECIPE_MANAGER_RECIPE_RECIPES_CATEGORIES="Recipes Categories" +COM_RECIPE_MANAGER_RECIPE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Recipe to customise the alias." +COM_RECIPE_MANAGER_RECIPE_STATUS="Status" +COM_RECIPE_MANAGER_RECIPE_VERSION_DESC="A count of the number of times this Recipe has been revised." +COM_RECIPE_MANAGER_RECIPE_VERSION_LABEL="Version" +COM_RECIPE_MANAGER_SAVE_SUCCESS="Great! Item successfully saved." +COM_RECIPE_MANAGER_SAVE_WARNING="The value already existed so please select another." +COM_RECIPE_MANAGER_SUBMENU_DASHBOARD="Dashboard" +COM_RECIPE_MANAGER_SUBMENU_INGREDIENTS="Ingredients" +COM_RECIPE_MANAGER_SUBMENU_RECIPES="Recipes" +COM_RECIPE_MANAGER_TRASHED="Trashed" +COM_RECIPE_MANAGER_USE_BATCH="Use Batch" +COM_RECIPE_MANAGER_USE_BATCH_DESC="Allows users in this group to use batch copy/update method." +COM_RECIPE_MANAGER_VERSION="Version" +COM_RECIPE_MANAGER_WEBSITE="Website" \ No newline at end of file diff --git a/admin/language/en-GB/en-GB.com_recipe_manager.sys.ini b/admin/language/en-GB/en-GB.com_recipe_manager.sys.ini new file mode 100644 index 0000000..e3489e5 --- /dev/null +++ b/admin/language/en-GB/en-GB.com_recipe_manager.sys.ini @@ -0,0 +1,48 @@ +COM_RECIPE_MANAGER="Recipe Manager" +COM_RECIPE_MANAGER_CONFIGURATION="Recipe Manager Configuration" +COM_RECIPE_MANAGER_EDIT_CREATED_BY="Edit Created By" +COM_RECIPE_MANAGER_EDIT_CREATED_BY_DESC="Allows users in this group to edit created by." +COM_RECIPE_MANAGER_EDIT_CREATED_DATE="Edit Created Date" +COM_RECIPE_MANAGER_EDIT_CREATED_DATE_DESC="Allows users in this group to edit created date." +COM_RECIPE_MANAGER_EDIT_VERSIONS="Edit Version" +COM_RECIPE_MANAGER_EDIT_VERSIONS_DESC="Allows users in this group to edit versions." +COM_RECIPE_MANAGER_EXPORT_DATA="Export Data" +COM_RECIPE_MANAGER_EXPORT_DATA_DESC="Allows users in this group to export data." +COM_RECIPE_MANAGER_IMPORT_DATA="Import Data" +COM_RECIPE_MANAGER_IMPORT_DATA_DESC="Allows users in this group to import data." +COM_RECIPE_MANAGER_INGREDIENTS_ACCESS="Ingredients Access" +COM_RECIPE_MANAGER_INGREDIENTS_ACCESS_DESC="Allows the users in this group to access access ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_BATCH_USE="Ingredients Batch Use" +COM_RECIPE_MANAGER_INGREDIENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_DASHBOARD_LIST="Ingredients Dashboard List" +COM_RECIPE_MANAGER_INGREDIENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of ingredient" +COM_RECIPE_MANAGER_INGREDIENTS_EDIT_VERSION="Ingredients Edit Version" +COM_RECIPE_MANAGER_INGREDIENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_EXPORT="Ingredients Export" +COM_RECIPE_MANAGER_INGREDIENTS_EXPORT_DESC="Allows the users in this group to export export ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_IMPORT="Ingredients Import" +COM_RECIPE_MANAGER_INGREDIENTS_IMPORT_DESC="Allows the users in this group to import import ingredients" +COM_RECIPE_MANAGER_INGREDIENTS_SUBMENU="Ingredients Submenu" +COM_RECIPE_MANAGER_INGREDIENTS_SUBMENU_DESC="Allows the users in this group to submenu of ingredient" +COM_RECIPE_MANAGER_MENU="♣ Recipe Manager" +COM_RECIPE_MANAGER_MENU_INGREDIENTS="Ingredients" +COM_RECIPE_MANAGER_MENU_RECIPES="Recipes" +COM_RECIPE_MANAGER_MENU_RECIPES_DESC="Recipes" +COM_RECIPE_MANAGER_MENU_RECIPES_OPTION="Recipes" +COM_RECIPE_MANAGER_MENU_RECIPES_TITLE="Recipes" +COM_RECIPE_MANAGER_RECIPES_ACCESS="Recipes Access" +COM_RECIPE_MANAGER_RECIPES_ACCESS_DESC="Allows the users in this group to access access recipes" +COM_RECIPE_MANAGER_RECIPES_BATCH_USE="Recipes Batch Use" +COM_RECIPE_MANAGER_RECIPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch recipes" +COM_RECIPE_MANAGER_RECIPES_DASHBOARD_LIST="Recipes Dashboard List" +COM_RECIPE_MANAGER_RECIPES_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of recipe" +COM_RECIPE_MANAGER_RECIPES_EDIT_VERSION="Recipes Edit Version" +COM_RECIPE_MANAGER_RECIPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version recipes" +COM_RECIPE_MANAGER_RECIPES_EXPORT="Recipes Export" +COM_RECIPE_MANAGER_RECIPES_EXPORT_DESC="Allows the users in this group to export export recipes" +COM_RECIPE_MANAGER_RECIPES_IMPORT="Recipes Import" +COM_RECIPE_MANAGER_RECIPES_IMPORT_DESC="Allows the users in this group to import import recipes" +COM_RECIPE_MANAGER_RECIPES_SUBMENU="Recipes Submenu" +COM_RECIPE_MANAGER_RECIPES_SUBMENU_DESC="Allows the users in this group to submenu of recipe" +COM_RECIPE_MANAGER_USE_BATCH="Use Batch" +COM_RECIPE_MANAGER_USE_BATCH_DESC="Allows users in this group to use batch copy/update method." \ No newline at end of file diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 9ebf1be..c17ffb7 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage batchselection.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/layouts/ingredient/details_left.php b/admin/layouts/ingredient/details_left.php index a5a5c6c..a4acd0b 100644 --- a/admin/layouts/ingredient/details_left.php +++ b/admin/layouts/ingredient/details_left.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage details_left.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/layouts/ingredient/publishing.php b/admin/layouts/ingredient/publishing.php index 57742d3..ce6e4ab 100644 --- a/admin/layouts/ingredient/publishing.php +++ b/admin/layouts/ingredient/publishing.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage publishing.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/layouts/ingredient/publlshing.php b/admin/layouts/ingredient/publlshing.php index 78ed480..c683e8d 100644 --- a/admin/layouts/ingredient/publlshing.php +++ b/admin/layouts/ingredient/publlshing.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage publlshing.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/layouts/recipe/details_above.php b/admin/layouts/recipe/details_above.php index 61fcf9e..bb45668 100644 --- a/admin/layouts/recipe/details_above.php +++ b/admin/layouts/recipe/details_above.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage details_above.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/layouts/recipe/details_left.php b/admin/layouts/recipe/details_left.php index f6425fc..6a69000 100644 --- a/admin/layouts/recipe/details_left.php +++ b/admin/layouts/recipe/details_left.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage details_left.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/layouts/recipe/details_right.php b/admin/layouts/recipe/details_right.php index 25266b0..74a7ba0 100644 --- a/admin/layouts/recipe/details_right.php +++ b/admin/layouts/recipe/details_right.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage details_right.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/layouts/recipe/details_under.php b/admin/layouts/recipe/details_under.php index 439c31d..3e6b472 100644 --- a/admin/layouts/recipe/details_under.php +++ b/admin/layouts/recipe/details_under.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage details_under.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/layouts/recipe/publishing.php b/admin/layouts/recipe/publishing.php index 57742d3..ce6e4ab 100644 --- a/admin/layouts/recipe/publishing.php +++ b/admin/layouts/recipe/publishing.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage publishing.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/layouts/recipe/publlshing.php b/admin/layouts/recipe/publlshing.php index 78ed480..c683e8d 100644 --- a/admin/layouts/recipe/publlshing.php +++ b/admin/layouts/recipe/publlshing.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage publlshing.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/models/fields/ingredients.php b/admin/models/fields/ingredients.php index 24e73e4..9117c1c 100644 --- a/admin/models/fields/ingredients.php +++ b/admin/models/fields/ingredients.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage ingredients.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -26,7 +26,7 @@ JFormHelper::loadFieldClass('list'); /** - * Ingredients Form Field class for the Recipemanager component + * Ingredients Form Field class for the Recipe_manager component */ class JFormFieldIngredients extends JFormFieldList { @@ -50,13 +50,13 @@ protected function getOptions() $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName(array('a.id','a.name','a.unit'),array('id','ingredients_name', 'unit'))); - $query->from($db->quoteName('#__recipemanager_ingredient', 'a')); + $query->from($db->quoteName('#__recipe_manager_ingredient', 'a')); $query->where($db->quoteName('a.published') . ' = 1'); $query->order('a.name ASC'); // Implement View Level Access (if set in table) - if (!$user->authorise('core.options', 'com_recipemanager')) + if (!$user->authorise('core.options', 'com_recipe_manager')) { - $columns = $db->getTableColumns('#__recipemanager_ingredient'); + $columns = $db->getTableColumns('#__recipe_manager_ingredient'); if(isset($columns['access'])) { $groups = implode(',', $user->getAuthorisedViewLevels()); diff --git a/admin/models/forms/filter_ingredients.xml b/admin/models/forms/filter_ingredients.xml new file mode 100644 index 0000000..38707ae --- /dev/null +++ b/admin/models/forms/filter_ingredients.xml @@ -0,0 +1,67 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_recipes.xml b/admin/models/forms/filter_recipes.xml new file mode 100644 index 0000000..a499420 --- /dev/null +++ b/admin/models/forms/filter_recipes.xml @@ -0,0 +1,78 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/ingredient.js b/admin/models/forms/ingredient.js index 8ef1ac5..b00f04e 100644 --- a/admin/models/forms/ingredient.js +++ b/admin/models/forms/ingredient.js @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage ingredient.js @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/models/forms/ingredient.xml b/admin/models/forms/ingredient.xml index 393afbb..33c8ffb 100644 --- a/admin/models/forms/ingredient.xml +++ b/admin/models/forms/ingredient.xml @@ -1,7 +1,7 @@
@@ -16,8 +16,8 @@ + COM_RECIPE_MANAGER_INGREDIENT_TEASPOON + COM_RECIPE_MANAGER_INGREDIENT_DESSERTSPOON + COM_RECIPE_MANAGER_INGREDIENT_TABLESPOON + COM_RECIPE_MANAGER_INGREDIENT_FLUIDOUNCE + COM_RECIPE_MANAGER_INGREDIENT_CUP + COM_RECIPE_MANAGER_INGREDIENT_PINT + COM_RECIPE_MANAGER_INGREDIENT_QUART + COM_RECIPE_MANAGER_INGREDIENT_GALLON
- +
- + - +
diff --git a/admin/models/forms/recipe.js b/admin/models/forms/recipe.js index 3f77798..edfacf4 100644 --- a/admin/models/forms/recipe.js +++ b/admin/models/forms/recipe.js @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage recipe.js @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/models/forms/recipe.xml b/admin/models/forms/recipe.xml index 9642e80..7c276af 100644 --- a/admin/models/forms/recipe.xml +++ b/admin/models/forms/recipe.xml @@ -1,7 +1,7 @@
@@ -16,8 +16,8 @@
- +
- + - +
diff --git a/admin/models/import.php b/admin/models/import.php index 9a18e26..98fe2c6 100644 --- a/admin/models/import.php +++ b/admin/models/import.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage import.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -25,9 +25,9 @@ use PhpOffice\PhpSpreadsheet\IOFactory; /** - * Recipemanager Import Model + * Recipe_manager Import Model */ -class RecipemanagerModelImport extends JModelLegacy +class Recipe_managerModelImport extends JModelLegacy { // set uploading values protected $use_streams = false; @@ -49,7 +49,7 @@ class RecipemanagerModelImport extends JModelLegacy * * @var string */ - protected $_context = 'com_recipemanager.import'; + protected $_context = 'com_recipe_manager.import'; /** * Import Settings @@ -69,8 +69,8 @@ protected function populateState() { $app = JFactory::getApplication('administrator'); - $this->setState('message', $app->getUserState('com_recipemanager.message')); - $app->setUserState('com_recipemanager.message', ''); + $this->setState('message', $app->getUserState('com_recipe_manager.message')); + $app->setUserState('com_recipe_manager.message', ''); // Recall the 'Import from Directory' path. $path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path')); @@ -125,7 +125,7 @@ public function import() break; default: - $app->setUserState('com_recipemanager.message', JText::_('COM_RECIPEMANAGER_IMPORT_NO_IMPORT_TYPE_FOUND')); + $app->setUserState('com_recipe_manager.message', JText::_('COM_RECIPE_MANAGER_IMPORT_NO_IMPORT_TYPE_FOUND')); return false; break; @@ -139,7 +139,7 @@ public function import() $this->remove($package['packagename']); } - $app->setUserState('com_recipemanager.message', JText::_('COM_RECIPEMANAGER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); + $app->setUserState('com_recipe_manager.message', JText::_('COM_RECIPE_MANAGER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); return false; } @@ -157,11 +157,11 @@ public function import() if (!$this->setData($package,$this->dataType,$headerList)) { // There was an error importing the package - $msg = JText::_('COM_RECIPEMANAGER_IMPORT_ERROR'); + $msg = JText::_('COM_RECIPE_MANAGER_IMPORT_ERROR'); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { - $app->setUserState('com_recipemanager.redirect_url', 'index.php?option=com_recipemanager&view='.$back); + $app->setUserState('com_recipe_manager.redirect_url', 'index.php?option=com_recipe_manager&view='.$back); $session->clear('backto_VDM_IMPORT'); } $result = false; @@ -169,11 +169,11 @@ public function import() else { // Package imported sucessfully - $msg = JText::sprintf('COM_RECIPEMANAGER_IMPORT_SUCCESS', $package['packagename']); + $msg = JText::sprintf('COM_RECIPE_MANAGER_IMPORT_SUCCESS', $package['packagename']); $back = $session->get('backto_VDM_IMPORT', NULL); if ($back) { - $app->setUserState('com_recipemanager.redirect_url', 'index.php?option=com_recipemanager&view='.$back); + $app->setUserState('com_recipe_manager.redirect_url', 'index.php?option=com_recipe_manager&view='.$back); $session->clear('backto_VDM_IMPORT'); } $result = true; @@ -206,21 +206,21 @@ protected function _getPackageFromUpload() // Make sure that file uploads are enabled in php if (!(bool) ini_get('file_uploads')) { - $app->enqueueMessage(JText::_('COM_RECIPEMANAGER_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + $app->enqueueMessage(JText::_('COM_RECIPE_MANAGER_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); return false; } // If there is no uploaded file, we have a problem... if (!is_array($userfile)) { - $app->enqueueMessage(JText::_('COM_RECIPEMANAGER_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + $app->enqueueMessage(JText::_('COM_RECIPE_MANAGER_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); return false; } // Check if there was a problem uploading the file. if ($userfile['error'] || $userfile['size'] < 1) { - $app->enqueueMessage(JText::_('COM_RECIPEMANAGER_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + $app->enqueueMessage(JText::_('COM_RECIPE_MANAGER_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); return false; } @@ -267,7 +267,7 @@ protected function _getPackageFromFolder() // Did you give us a valid path? if (!file_exists($p_dir)) { - $app->enqueueMessage(JText::_('COM_RECIPEMANAGER_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + $app->enqueueMessage(JText::_('COM_RECIPE_MANAGER_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); return false; } @@ -277,14 +277,14 @@ protected function _getPackageFromFolder() // Did you give us a valid package? if (!$type) { - $app->enqueueMessage(JText::_('COM_RECIPEMANAGER_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + $app->enqueueMessage(JText::_('COM_RECIPE_MANAGER_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); } // check the extention if(!$this->checkExtension($p_dir)) { // set error message - $app->enqueueMessage(JText::_('COM_RECIPEMANAGER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(JText::_('COM_RECIPE_MANAGER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } @@ -312,7 +312,7 @@ protected function _getPackageFromUrl() // Did you give us a URL? if (!$url) { - $app->enqueueMessage(JText::_('COM_RECIPEMANAGER_IMPORT_MSG_ENTER_A_URL'), 'warning'); + $app->enqueueMessage(JText::_('COM_RECIPE_MANAGER_IMPORT_MSG_ENTER_A_URL'), 'warning'); return false; } @@ -322,7 +322,7 @@ protected function _getPackageFromUrl() // Was the package downloaded? if (!$p_file) { - $app->enqueueMessage(JText::_('COM_RECIPEMANAGER_IMPORT_MSG_INVALID_URL'), 'warning'); + $app->enqueueMessage(JText::_('COM_RECIPE_MANAGER_IMPORT_MSG_INVALID_URL'), 'warning'); return false; } @@ -352,7 +352,7 @@ protected function check($archivename) { // Cleanup the import files $this->remove($archivename); - $app->enqueueMessage(JText::_('COM_RECIPEMANAGER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + $app->enqueueMessage(JText::_('COM_RECIPE_MANAGER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); return false; } @@ -428,10 +428,10 @@ protected function remove($package) **/ protected function setData($package,$table,$target_headers) { - if (RecipemanagerHelper::checkArray($target_headers)) + if (Recipe_managerHelper::checkArray($target_headers)) { // make sure the file is loaded - RecipemanagerHelper::composerAutoload('phpspreadsheet'); + Recipe_managerHelper::composerAutoload('phpspreadsheet'); $jinput = JFactory::getApplication()->input; foreach($target_headers as $header) { @@ -472,7 +472,7 @@ protected function setData($package,$table,$target_headers) protected function save($data,$table) { // import the data if there is any - if(RecipemanagerHelper::checkArray($data['array'])) + if(Recipe_managerHelper::checkArray($data['array'])) { // get user object $user = JFactory::getUser(); @@ -490,7 +490,7 @@ protected function save($data,$table) } // make sure there is still values in array and that it was not only headers - if(RecipemanagerHelper::checkArray($data['array']) && $user->authorise($table.'.import', 'com_recipemanager') && $user->authorise('core.import', 'com_recipemanager')) + if(Recipe_managerHelper::checkArray($data['array']) && $user->authorise($table.'.import', 'com_recipe_manager') && $user->authorise('core.import', 'com_recipe_manager')) { // set target. $target = array_flip($data['target_headers']); @@ -499,7 +499,7 @@ protected function save($data,$table) // set some defaults $todayDate = JFactory::getDate()->toSql(); // get global action permissions - $canDo = RecipemanagerHelper::getActions($table); + $canDo = Recipe_managerHelper::getActions($table); $canEdit = $canDo->get('core.edit'); $canState = $canDo->get('core.edit.state'); $canCreate = $canDo->get('core.create'); @@ -514,7 +514,7 @@ protected function save($data,$table) $query = $db->getQuery(true); $query ->select('version') - ->from($db->quoteName('#__recipemanager_'.$table)) + ->from($db->quoteName('#__recipe_manager_'.$table)) ->where($db->quoteName('id') . ' = '. $db->quote($row[$id_key])); // Reset the query using our newly populated query object. $db->setQuery($query); @@ -581,7 +581,7 @@ protected function save($data,$table) $db->quoteName('id') . ' = ' . $id ); - $query->update($db->quoteName('#__recipemanager_'.$table))->set($fields)->where($conditions); + $query->update($db->quoteName('#__recipe_manager_'.$table))->set($fields)->where($conditions); $db->setQuery($query); $db->execute(); } @@ -657,7 +657,7 @@ protected function save($data,$table) } // Prepare the insert query. $query - ->insert($db->quoteName('#__recipemanager_'.$table)) + ->insert($db->quoteName('#__recipe_manager_'.$table)) ->columns($db->quoteName($columns)) ->values(implode(',', $values)); // Set the query using our newly populated query object and execute it. @@ -667,7 +667,7 @@ protected function save($data,$table) { $aId = $db->insertid(); // make sure the access of asset is set - RecipemanagerHelper::setAsset($aId,$table); + Recipe_managerHelper::setAsset($aId,$table); } } else @@ -725,12 +725,12 @@ protected function getAliasesUsed($table) // Get a db connection. $db = JFactory::getDbo(); // first we check if there is a alias column - $columns = $db->getTableColumns('#__recipemanager_'.$table); + $columns = $db->getTableColumns('#__recipe_manager_'.$table); if(isset($columns['alias'])){ // Create a new query object. $query = $db->getQuery(true); $query->select($db->quoteName(array('alias'))); - $query->from($db->quoteName('#__recipemanager_'.$table)); + $query->from($db->quoteName('#__recipe_manager_'.$table)); $db->setQuery($query); $db->execute(); if ($db->getNumRows()) diff --git a/admin/models/ingredient.php b/admin/models/ingredient.php index 369cca6..7095352 100644 --- a/admin/models/ingredient.php +++ b/admin/models/ingredient.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage ingredient.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -26,9 +26,9 @@ use Joomla\Utilities\ArrayHelper; /** - * Recipemanager Ingredient Model + * Recipe_manager Ingredient Model */ -class RecipemanagerModelIngredient extends JModelAdmin +class Recipe_managerModelIngredient extends JModelAdmin { /** * The tab layout fields array. @@ -49,7 +49,7 @@ class RecipemanagerModelIngredient extends JModelAdmin * @var string The prefix to use with controller messages. * @since 1.6 */ - protected $text_prefix = 'COM_RECIPEMANAGER'; + protected $text_prefix = 'COM_RECIPE_MANAGER'; /** * The type alias for this content type. @@ -57,7 +57,7 @@ class RecipemanagerModelIngredient extends JModelAdmin * @var string * @since 3.2 */ - public $typeAlias = 'com_recipemanager.ingredient'; + public $typeAlias = 'com_recipe_manager.ingredient'; /** * Returns a Table object, always creating it @@ -70,10 +70,10 @@ class RecipemanagerModelIngredient extends JModelAdmin * * @since 1.6 */ - public function getTable($type = 'ingredient', $prefix = 'RecipemanagerTable', $config = array()) + public function getTable($type = 'ingredient', $prefix = 'Recipe_managerTable', $config = array()) { // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_recipemanager/tables'); + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_recipe_manager/tables'); // get instance of the table return JTable::getInstance($type, $prefix, $config); } @@ -110,7 +110,7 @@ public function getItem($pk = null) if (!empty($item->id)) { $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_recipemanager.ingredient'); + $item->tags->getTagIds($item->id, 'com_recipe_manager.ingredient'); } } @@ -132,14 +132,14 @@ public function getForm($data = array(), $loadData = true, $options = array('con { // set load data option $options['load_data'] = $loadData; - // [Interpretation 19364] check if xpath was set in options + // [Interpretation 19356] check if xpath was set in options $xpath = false; if (isset($options['xpath'])) { $xpath = $options['xpath']; unset($options['xpath']); } - // [Interpretation 19372] check if clear form was set in options + // [Interpretation 19364] check if clear form was set in options $clear = false; if (isset($options['clear'])) { @@ -147,8 +147,8 @@ public function getForm($data = array(), $loadData = true, $options = array('con unset($options['clear']); } - // [Interpretation 19380] Get the form. - $form = $this->loadForm('com_recipemanager.ingredient', 'ingredient', $options, $clear, $xpath); + // [Interpretation 19372] Get the form. + $form = $this->loadForm('com_recipe_manager.ingredient', 'ingredient', $options, $clear, $xpath); if (empty($form)) { @@ -157,12 +157,12 @@ public function getForm($data = array(), $loadData = true, $options = array('con $jinput = JFactory::getApplication()->input; - // [Interpretation 19546] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + // [Interpretation 19538] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) { $id = $jinput->get('a_id', 0, 'INT'); } - // [Interpretation 19554] The back end uses id so we use that the rest of the time and set it to 0 by default. + // [Interpretation 19546] The back end uses id so we use that the rest of the time and set it to 0 by default. else { $id = $jinput->get('id', 0, 'INT'); @@ -170,56 +170,56 @@ public function getForm($data = array(), $loadData = true, $options = array('con $user = JFactory::getUser(); - // [Interpretation 19563] Check for existing item. - // [Interpretation 19565] Modify the form based on Edit State access controls. - if ($id != 0 && (!$user->authorise('core.edit.state', 'com_recipemanager.ingredient.' . (int) $id)) - || ($id == 0 && !$user->authorise('core.edit.state', 'com_recipemanager'))) + // [Interpretation 19555] Check for existing item. + // [Interpretation 19557] Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_recipe_manager.ingredient.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_recipe_manager'))) { - // [Interpretation 19598] Disable fields for display. + // [Interpretation 19590] Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true'); - // [Interpretation 19604] Disable fields while saving. + // [Interpretation 19596] Disable fields while saving. $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset'); } - // [Interpretation 19612] If this is a new item insure the greated by is set. + // [Interpretation 19604] If this is a new item insure the greated by is set. if (0 == $id) { - // [Interpretation 19616] Set the created_by to this user + // [Interpretation 19608] Set the created_by to this user $form->setValue('created_by', null, $user->id); } - // [Interpretation 19621] Modify the form based on Edit Creaded By access controls. - if (!$user->authorise('core.edit.created_by', 'com_recipemanager')) + // [Interpretation 19613] Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_recipe_manager')) { - // [Interpretation 19648] Disable fields for display. + // [Interpretation 19640] Disable fields for display. $form->setFieldAttribute('created_by', 'disabled', 'true'); - // [Interpretation 19652] Disable fields for display. + // [Interpretation 19644] Disable fields for display. $form->setFieldAttribute('created_by', 'readonly', 'true'); - // [Interpretation 19656] Disable fields while saving. + // [Interpretation 19648] Disable fields while saving. $form->setFieldAttribute('created_by', 'filter', 'unset'); } - // [Interpretation 19661] Modify the form based on Edit Creaded Date access controls. - if (!$user->authorise('core.edit.created', 'com_recipemanager')) + // [Interpretation 19653] Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_recipe_manager')) { - // [Interpretation 19687] Disable fields for display. + // [Interpretation 19679] Disable fields for display. $form->setFieldAttribute('created', 'disabled', 'true'); - // [Interpretation 19691] Disable fields while saving. + // [Interpretation 19683] Disable fields while saving. $form->setFieldAttribute('created', 'filter', 'unset'); } - // [Interpretation 19769] Only load these values if no id is found + // [Interpretation 19761] Only load these values if no id is found if (0 == $id) { - // [Interpretation 19773] Set redirected view name + // [Interpretation 19765] Set redirected view name $redirectedView = $jinput->get('ref', null, 'STRING'); - // [Interpretation 19777] Set field name (or fall back to view name) + // [Interpretation 19769] Set field name (or fall back to view name) $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); - // [Interpretation 19781] Set redirected view id + // [Interpretation 19773] Set redirected view id $redirectedId = $jinput->get('refid', 0, 'INT'); - // [Interpretation 19785] Set field id (or fall back to redirected view id) + // [Interpretation 19777] Set field id (or fall back to redirected view id) $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); if (0 != $redirectedValue && $redirectedField) { - // [Interpretation 19792] Now set the local-redirected field default value + // [Interpretation 19784] Now set the local-redirected field default value $form->setValue($redirectedField, null, $redirectedValue); } } @@ -233,7 +233,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con */ public function getScript() { - return 'administrator/components/com_recipemanager/models/forms/ingredient.js'; + return 'administrator/components/com_recipe_manager/models/forms/ingredient.js'; } /** @@ -255,8 +255,8 @@ protected function canDelete($record) } $user = JFactory::getUser(); - // [Interpretation 20119] The record has been set. Check the record permissions. - return $user->authorise('core.delete', 'com_recipemanager.ingredient.' . (int) $record->id); + // [Interpretation 20111] The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_recipe_manager.ingredient.' . (int) $record->id); } return false; } @@ -277,14 +277,14 @@ protected function canEditState($record) if ($recordId) { - // [Interpretation 20244] The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit.state', 'com_recipemanager.ingredient.' . (int) $recordId); + // [Interpretation 20236] The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_recipe_manager.ingredient.' . (int) $recordId); if (!$permission && !is_null($permission)) { return false; } } - // [Interpretation 20292] In the absense of better information, revert to the component permissions. + // [Interpretation 20284] In the absense of better information, revert to the component permissions. return parent::canEditState($record); } @@ -299,9 +299,9 @@ protected function canEditState($record) */ protected function allowEdit($data = array(), $key = 'id') { - // [Interpretation 19994] Check specific edit permission then general edit permission. + // [Interpretation 19986] Check specific edit permission then general edit permission. - return JFactory::getUser()->authorise('core.edit', 'com_recipemanager.ingredient.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + return JFactory::getUser()->authorise('core.edit', 'com_recipe_manager.ingredient.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); } /** @@ -342,7 +342,7 @@ protected function prepareTable($table) $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') - ->from($db->quoteName('#__recipemanager_ingredient')); + ->from($db->quoteName('#__recipe_manager_ingredient')); $db->setQuery($query); $max = $db->loadResult(); @@ -372,13 +372,13 @@ protected function prepareTable($table) protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_recipemanager.edit.ingredient.data', array()); + $data = JFactory::getApplication()->getUserState('com_recipe_manager.edit.ingredient.data', array()); if (empty($data)) { $data = $this->getItem(); // run the perprocess of the data - $this->preprocessData('com_recipemanager.ingredient', $data); + $this->preprocessData('com_recipe_manager.ingredient', $data); } return $data; @@ -472,7 +472,7 @@ public function batch($commands, $pks, $contexts) $this->tableClassName = get_class($this->table); $this->contentType = new JUcmType; $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = RecipemanagerHelper::getActions('ingredient'); + $this->canDo = Recipe_managerHelper::getActions('ingredient'); $this->batchSet = true; if (!$this->canDo->get('core.batch')) @@ -546,11 +546,11 @@ protected function batchCopy($values, $pks, $contexts) { if (empty($this->batchSet)) { - // [Interpretation 9486] Set some needed variables. + // [Interpretation 9478] Set some needed variables. $this->user = JFactory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); - $this->canDo = RecipemanagerHelper::getActions('ingredient'); + $this->canDo = Recipe_managerHelper::getActions('ingredient'); } if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) @@ -558,12 +558,12 @@ protected function batchCopy($values, $pks, $contexts) return false; } - // [Interpretation 9520] get list of unique fields + // [Interpretation 9512] get list of unique fields $uniqueFields = $this->getUniqueFields(); - // [Interpretation 9524] remove move_copy from array + // [Interpretation 9516] remove move_copy from array unset($values['move_copy']); - // [Interpretation 9528] make sure published is set + // [Interpretation 9520] make sure published is set if (!isset($values['published'])) { $values['published'] = 0; @@ -574,47 +574,47 @@ protected function batchCopy($values, $pks, $contexts) } $newIds = array(); - // [Interpretation 9582] Parent exists so let's proceed + // [Interpretation 9574] Parent exists so let's proceed while (!empty($pks)) { - // [Interpretation 9586] Pop the first ID off the stack + // [Interpretation 9578] Pop the first ID off the stack $pk = array_shift($pks); $this->table->reset(); - // [Interpretation 9592] only allow copy if user may edit this item. + // [Interpretation 9584] only allow copy if user may edit this item. if (!$this->user->authorise('core.edit', $contexts[$pk])) { - // [Interpretation 9612] Not fatal error + // [Interpretation 9604] Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } - // [Interpretation 9619] Check that the row actually exists + // [Interpretation 9611] Check that the row actually exists if (!$this->table->load($pk)) { if ($error = $this->table->getError()) { - // [Interpretation 9626] Fatal error + // [Interpretation 9618] Fatal error $this->setError($error); return false; } else { - // [Interpretation 9634] Not fatal error + // [Interpretation 9626] Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } - // [Interpretation 9705] Only for strings - if (RecipemanagerHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + // [Interpretation 9697] Only for strings + if (Recipe_managerHelper::checkString($this->table->name) && !is_numeric($this->table->name)) { $this->table->name = $this->generateUnique('name',$this->table->name); } - // [Interpretation 9719] insert all set values - if (RecipemanagerHelper::checkArray($values)) + // [Interpretation 9711] insert all set values + if (Recipe_managerHelper::checkArray($values)) { foreach ($values as $key => $value) { @@ -625,8 +625,8 @@ protected function batchCopy($values, $pks, $contexts) } } - // [Interpretation 9734] update all unique fields - if (RecipemanagerHelper::checkArray($uniqueFields)) + // [Interpretation 9726] update all unique fields + if (Recipe_managerHelper::checkArray($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -634,13 +634,13 @@ protected function batchCopy($values, $pks, $contexts) } } - // [Interpretation 9747] Reset the ID because we are making a copy + // [Interpretation 9739] Reset the ID because we are making a copy $this->table->id = 0; - // [Interpretation 9751] TODO: Deal with ordering? - // [Interpretation 9753] $this->table->ordering = 1; + // [Interpretation 9743] TODO: Deal with ordering? + // [Interpretation 9745] $this->table->ordering = 1; - // [Interpretation 9756] Check the row. + // [Interpretation 9748] Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); @@ -653,7 +653,7 @@ protected function batchCopy($values, $pks, $contexts) $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); } - // [Interpretation 9772] Store the row. + // [Interpretation 9764] Store the row. if (!$this->table->store()) { $this->setError($this->table->getError()); @@ -661,14 +661,14 @@ protected function batchCopy($values, $pks, $contexts) return false; } - // [Interpretation 9782] Get the new item ID + // [Interpretation 9774] Get the new item ID $newId = $this->table->get('id'); - // [Interpretation 9786] Add the new ID to the array + // [Interpretation 9778] Add the new ID to the array $newIds[$pk] = $newId; } - // [Interpretation 9791] Clean the cache + // [Interpretation 9783] Clean the cache $this->cleanCache(); return $newIds; @@ -689,11 +689,11 @@ protected function batchMove($values, $pks, $contexts) { if (empty($this->batchSet)) { - // [Interpretation 9206] Set some needed variables. + // [Interpretation 9198] Set some needed variables. $this->user = JFactory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); - $this->canDo = RecipemanagerHelper::getActions('ingredient'); + $this->canDo = Recipe_managerHelper::getActions('ingredient'); } if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) @@ -702,15 +702,15 @@ protected function batchMove($values, $pks, $contexts) return false; } - // [Interpretation 9243] make sure published only updates if user has the permission. + // [Interpretation 9235] make sure published only updates if user has the permission. if (isset($values['published']) && !$this->canDo->get('core.edit.state')) { unset($values['published']); } - // [Interpretation 9268] remove move_copy from array + // [Interpretation 9260] remove move_copy from array unset($values['move_copy']); - // [Interpretation 9295] Parent exists so we proceed + // [Interpretation 9287] Parent exists so we proceed foreach ($pks as $pk) { if (!$this->user->authorise('core.edit', $contexts[$pk])) @@ -719,29 +719,29 @@ protected function batchMove($values, $pks, $contexts) return false; } - // [Interpretation 9323] Check that the row actually exists + // [Interpretation 9315] Check that the row actually exists if (!$this->table->load($pk)) { if ($error = $this->table->getError()) { - // [Interpretation 9330] Fatal error + // [Interpretation 9322] Fatal error $this->setError($error); return false; } else { - // [Interpretation 9338] Not fatal error + // [Interpretation 9330] Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } - // [Interpretation 9346] insert all set values. - if (RecipemanagerHelper::checkArray($values)) + // [Interpretation 9338] insert all set values. + if (Recipe_managerHelper::checkArray($values)) { foreach ($values as $key => $value) { - // [Interpretation 9353] Do special action for access. + // [Interpretation 9345] Do special action for access. if ('access' === $key && strlen($value) > 0) { $this->table->$key = $value; @@ -754,7 +754,7 @@ protected function batchMove($values, $pks, $contexts) } - // [Interpretation 9368] Check the row. + // [Interpretation 9360] Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); @@ -767,7 +767,7 @@ protected function batchMove($values, $pks, $contexts) $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); } - // [Interpretation 9384] Store the row. + // [Interpretation 9376] Store the row. if (!$this->table->store()) { $this->setError($this->table->getError()); @@ -776,7 +776,7 @@ protected function batchMove($values, $pks, $contexts) } } - // [Interpretation 9395] Clean the cache + // [Interpretation 9387] Clean the cache $this->cleanCache(); return true; @@ -814,12 +814,12 @@ public function save($data) $data['params'] = (string) $params; } - // [Interpretation 9988] Alter the unique field for save as copy + // [Interpretation 9980] Alter the unique field for save as copy if ($input->get('task') === 'save2copy') { - // [Interpretation 9993] Automatic handling of other unique fields + // [Interpretation 9985] Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (RecipemanagerHelper::checkArray($uniqueFields)) + if (Recipe_managerHelper::checkArray($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -870,7 +870,7 @@ protected function generateUnique($field,$value) protected function _generateNewTitle($title) { - // [Interpretation 10108] Alter the title + // [Interpretation 10100] Alter the title $table = $this->getTable(); while ($table->load(array('title' => $title))) diff --git a/admin/models/ingredients.php b/admin/models/ingredients.php index 9c87f83..2903120 100644 --- a/admin/models/ingredients.php +++ b/admin/models/ingredients.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage ingredients.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -26,7 +26,7 @@ /** * Ingredients Model */ -class RecipemanagerModelIngredients extends JModelList +class Recipe_managerModelIngredients extends JModelList { public function __construct($config = array()) { @@ -67,8 +67,15 @@ protected function populateState($ordering = null, $direction = null) $this->context .= '.' . $layout; } + // [Interpretation 21133] Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $this->setState('filter.published', $published); @@ -86,7 +93,11 @@ protected function populateState($ordering = null, $direction = null) $this->setState('filter.search', $search); $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } // List state information. parent::populateState($ordering, $direction); @@ -99,18 +110,18 @@ protected function populateState($ordering = null, $direction = null) */ public function getItems() { - // [Interpretation 21363] check in items + // [Interpretation 21355] check in items $this->checkInNow(); // load parent items $items = parent::getItems(); - // [Interpretation 22354] set selection value to a translatable value - if (RecipemanagerHelper::checkArray($items)) + // [Interpretation 22346] set selection value to a translatable value + if (Recipe_managerHelper::checkArray($items)) { foreach ($items as $nr => &$item) { - // [Interpretation 22368] convert unit + // [Interpretation 22360] convert unit $item->unit = $this->selectionTranslation($item->unit, 'unit'); } } @@ -127,21 +138,21 @@ public function getItems() */ public function selectionTranslation($value,$name) { - // [Interpretation 22408] Array of unit language strings + // [Interpretation 22400] Array of unit language strings if ($name === 'unit') { $unitArray = array( - 0 => 'COM_RECIPEMANAGER_INGREDIENT_TEASPOON', - ' 1' => 'COM_RECIPEMANAGER_INGREDIENT_DESSERTSPOON', - ' 2' => 'COM_RECIPEMANAGER_INGREDIENT_TABLESPOON', - ' 3' => 'COM_RECIPEMANAGER_INGREDIENT_FLUIDOUNCE', - ' 4' => 'COM_RECIPEMANAGER_INGREDIENT_CUP', - ' 5' => 'COM_RECIPEMANAGER_INGREDIENT_PINT', - ' 6' => 'COM_RECIPEMANAGER_INGREDIENT_QUART', - ' 7' => 'COM_RECIPEMANAGER_INGREDIENT_GALLON' + 0 => 'COM_RECIPE_MANAGER_INGREDIENT_TEASPOON', + ' 1' => 'COM_RECIPE_MANAGER_INGREDIENT_DESSERTSPOON', + ' 2' => 'COM_RECIPE_MANAGER_INGREDIENT_TABLESPOON', + ' 3' => 'COM_RECIPE_MANAGER_INGREDIENT_FLUIDOUNCE', + ' 4' => 'COM_RECIPE_MANAGER_INGREDIENT_CUP', + ' 5' => 'COM_RECIPE_MANAGER_INGREDIENT_PINT', + ' 6' => 'COM_RECIPE_MANAGER_INGREDIENT_QUART', + ' 7' => 'COM_RECIPE_MANAGER_INGREDIENT_GALLON' ); - // [Interpretation 22445] Now check if value is found in this array - if (isset($unitArray[$value]) && RecipemanagerHelper::checkString($unitArray[$value])) + // [Interpretation 22437] Now check if value is found in this array + if (isset($unitArray[$value]) && Recipe_managerHelper::checkString($unitArray[$value])) { return $unitArray[$value]; } @@ -156,19 +167,19 @@ public function selectionTranslation($value,$name) */ protected function getListQuery() { - // [Interpretation 15534] Get the user object. + // [Interpretation 15526] Get the user object. $user = JFactory::getUser(); - // [Interpretation 15536] Create a new query object. + // [Interpretation 15528] Create a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); - // [Interpretation 15541] Select some fields + // [Interpretation 15533] Select some fields $query->select('a.*'); - // [Interpretation 15551] From the recipemanager_item table - $query->from($db->quoteName('#__recipemanager_ingredient', 'a')); + // [Interpretation 15543] From the recipe_manager_item table + $query->from($db->quoteName('#__recipe_manager_ingredient', 'a')); - // [Interpretation 15570] Filter by published state + // [Interpretation 15562] Filter by published state $published = $this->getState('filter.published'); if (is_numeric($published)) { @@ -179,29 +190,29 @@ protected function getListQuery() $query->where('(a.published = 0 OR a.published = 1)'); } - // [Interpretation 15590] Join over the asset groups. + // [Interpretation 15582] Join over the asset groups. $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); - // [Interpretation 15604] Filter by access level. + // [Interpretation 15596] Filter by access level. $_access = $this->getState('filter.access'); if ($_access && is_numeric($_access)) { $query->where('a.access = ' . (int) $_access); } - elseif (RecipemanagerHelper::checkArray($_access)) + elseif (Recipe_managerHelper::checkArray($_access)) { - // [Interpretation 15619] Secure the array for the query + // [Interpretation 15611] Secure the array for the query $_access = ArrayHelper::toInteger($_access); - // [Interpretation 15624] Filter by the Access Array. + // [Interpretation 15616] Filter by the Access Array. $query->where('a.access IN (' . implode(',', $_access) . ')'); } - // [Interpretation 15630] Implement View Level Access - if (!$user->authorise('core.options', 'com_recipemanager')) + // [Interpretation 15622] Implement View Level Access + if (!$user->authorise('core.options', 'com_recipe_manager')) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')'); } - // [Interpretation 15791] Filter by search. + // [Interpretation 15783] Filter by search. $search = $this->getState('filter.search'); if (!empty($search)) { @@ -217,7 +228,7 @@ protected function getListQuery() } - // [Interpretation 15738] Add the list ordering clause. + // [Interpretation 15730] Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') @@ -238,74 +249,74 @@ protected function getListQuery() */ public function getExportData($pks, $user = null) { - // [Interpretation 14988] setup the query - if (($pks_size = RecipemanagerHelper::checkArray($pks)) !== false || 'bulk' === $pks) + // [Interpretation 14980] setup the query + if (($pks_size = Recipe_managerHelper::checkArray($pks)) !== false || 'bulk' === $pks) { - // [Interpretation 14995] Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + // [Interpretation 14987] Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; - // [Interpretation 15000] Get the user object if not set. - if (!isset($user) || !RecipemanagerHelper::checkObject($user)) + // [Interpretation 14992] Get the user object if not set. + if (!isset($user) || !Recipe_managerHelper::checkObject($user)) { $user = JFactory::getUser(); } - // [Interpretation 15008] Create a new query object. + // [Interpretation 15000] Create a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); - // [Interpretation 15014] Select some fields + // [Interpretation 15006] Select some fields $query->select('a.*'); - // [Interpretation 15018] From the recipemanager_ingredient table - $query->from($db->quoteName('#__recipemanager_ingredient', 'a')); - // [Interpretation 15025] The bulk export path + // [Interpretation 15010] From the recipe_manager_ingredient table + $query->from($db->quoteName('#__recipe_manager_ingredient', 'a')); + // [Interpretation 15017] The bulk export path if ('bulk' === $pks) { $query->where('a.id > 0'); } - // [Interpretation 15034] A large array of ID's will not work out well + // [Interpretation 15026] A large array of ID's will not work out well elseif ($pks_size > 500) { - // [Interpretation 15039] Use lowest ID + // [Interpretation 15031] Use lowest ID $query->where('a.id >= ' . (int) min($pks)); - // [Interpretation 15043] Use highest ID + // [Interpretation 15035] Use highest ID $query->where('a.id <= ' . (int) max($pks)); } - // [Interpretation 15049] The normal default path + // [Interpretation 15041] The normal default path else { $query->where('a.id IN (' . implode(',',$pks) . ')'); } - // [Interpretation 15101] Implement View Level Access - if (!$user->authorise('core.options', 'com_recipemanager')) + // [Interpretation 15093] Implement View Level Access + if (!$user->authorise('core.options', 'com_recipe_manager')) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')'); } - // [Interpretation 15142] Order the results by ordering + // [Interpretation 15134] Order the results by ordering $query->order('a.ordering ASC'); - // [Interpretation 15148] Load the items + // [Interpretation 15140] Load the items $db->setQuery($query); $db->execute(); if ($db->getNumRows()) { $items = $db->loadObjectList(); - // [Interpretation 21901] Set values to display correctly. - if (RecipemanagerHelper::checkArray($items)) + // [Interpretation 21893] Set values to display correctly. + if (Recipe_managerHelper::checkArray($items)) { foreach ($items as $nr => &$item) { - // [Interpretation 22043] unset the values we don't want exported. + // [Interpretation 22035] unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); unset($item->checked_out_time); } } - // [Interpretation 22058] Add headers to items array. + // [Interpretation 22050] Add headers to items array. $headers = $this->getExImPortHeaders(); - if (RecipemanagerHelper::checkObject($headers)) + if (Recipe_managerHelper::checkObject($headers)) { array_unshift($items,$headers); } @@ -325,8 +336,8 @@ public function getExImPortHeaders() // Get a db connection. $db = JFactory::getDbo(); // get the columns - $columns = $db->getTableColumns("#__recipemanager_ingredient"); - if (RecipemanagerHelper::checkArray($columns)) + $columns = $db->getTableColumns("#__recipe_manager_ingredient"); + if (Recipe_managerHelper::checkArray($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); @@ -350,11 +361,22 @@ public function getExImPortHeaders() */ protected function getStoreId($id = '') { - // [Interpretation 20600] Compile the store id. + // [Interpretation 20592] Compile the store id. $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); - $id .= ':' . $this->getState('filter.access'); + // [Interpretation 20757] Check if the value is an array + $_access = $this->getState('filter.access'); + if (Recipe_managerHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // [Interpretation 20772] Check if this is only an number or string + elseif (is_numeric($_access) + || Recipe_managerHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); @@ -371,41 +393,41 @@ protected function getStoreId($id = '') */ protected function checkInNow() { - // [Interpretation 21381] Get set check in time - $time = JComponentHelper::getParams('com_recipemanager')->get('check_in'); + // [Interpretation 21373] Get set check in time + $time = JComponentHelper::getParams('com_recipe_manager')->get('check_in'); if ($time) { - // [Interpretation 21389] Get a db connection. + // [Interpretation 21381] Get a db connection. $db = JFactory::getDbo(); - // [Interpretation 21392] reset query + // [Interpretation 21384] reset query $query = $db->getQuery(true); $query->select('*'); - $query->from($db->quoteName('#__recipemanager_ingredient')); + $query->from($db->quoteName('#__recipe_manager_ingredient')); $db->setQuery($query); $db->execute(); if ($db->getNumRows()) { - // [Interpretation 21403] Get Yesterdays date + // [Interpretation 21395] Get Yesterdays date $date = JFactory::getDate()->modify($time)->toSql(); - // [Interpretation 21407] reset query + // [Interpretation 21399] reset query $query = $db->getQuery(true); - // [Interpretation 21411] Fields to update. + // [Interpretation 21403] Fields to update. $fields = array( $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', $db->quoteName('checked_out') . '=0' ); - // [Interpretation 21420] Conditions for which records should be updated. + // [Interpretation 21412] Conditions for which records should be updated. $conditions = array( $db->quoteName('checked_out') . '!=0', $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // [Interpretation 21429] Check table - $query->update($db->quoteName('#__recipemanager_ingredient'))->set($fields)->where($conditions); + // [Interpretation 21421] Check table + $query->update($db->quoteName('#__recipe_manager_ingredient'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/recipe.php b/admin/models/recipe.php index afd423a..167c781 100644 --- a/admin/models/recipe.php +++ b/admin/models/recipe.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage recipe.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -26,9 +26,9 @@ use Joomla\Utilities\ArrayHelper; /** - * Recipemanager Recipe Model + * Recipe_manager Recipe Model */ -class RecipemanagerModelRecipe extends JModelAdmin +class Recipe_managerModelRecipe extends JModelAdmin { /** * The tab layout fields array. @@ -59,7 +59,7 @@ class RecipemanagerModelRecipe extends JModelAdmin * @var string The prefix to use with controller messages. * @since 1.6 */ - protected $text_prefix = 'COM_RECIPEMANAGER'; + protected $text_prefix = 'COM_RECIPE_MANAGER'; /** * The type alias for this content type. @@ -67,7 +67,7 @@ class RecipemanagerModelRecipe extends JModelAdmin * @var string * @since 3.2 */ - public $typeAlias = 'com_recipemanager.recipe'; + public $typeAlias = 'com_recipe_manager.recipe'; /** * Returns a Table object, always creating it @@ -80,10 +80,10 @@ class RecipemanagerModelRecipe extends JModelAdmin * * @since 1.6 */ - public function getTable($type = 'recipe', $prefix = 'RecipemanagerTable', $config = array()) + public function getTable($type = 'recipe', $prefix = 'Recipe_managerTable', $config = array()) { // add table path for when model gets used from other component - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_recipemanager/tables'); + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_recipe_manager/tables'); // get instance of the table return JTable::getInstance($type, $prefix, $config); } @@ -128,7 +128,7 @@ public function getItem($pk = null) if (!empty($item->id)) { $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_recipemanager.recipe'); + $item->tags->getTagIds($item->id, 'com_recipe_manager.recipe'); } } @@ -150,14 +150,14 @@ public function getForm($data = array(), $loadData = true, $options = array('con { // set load data option $options['load_data'] = $loadData; - // [Interpretation 19364] check if xpath was set in options + // [Interpretation 19356] check if xpath was set in options $xpath = false; if (isset($options['xpath'])) { $xpath = $options['xpath']; unset($options['xpath']); } - // [Interpretation 19372] check if clear form was set in options + // [Interpretation 19364] check if clear form was set in options $clear = false; if (isset($options['clear'])) { @@ -165,8 +165,8 @@ public function getForm($data = array(), $loadData = true, $options = array('con unset($options['clear']); } - // [Interpretation 19380] Get the form. - $form = $this->loadForm('com_recipemanager.recipe', 'recipe', $options, $clear, $xpath); + // [Interpretation 19372] Get the form. + $form = $this->loadForm('com_recipe_manager.recipe', 'recipe', $options, $clear, $xpath); if (empty($form)) { @@ -175,12 +175,12 @@ public function getForm($data = array(), $loadData = true, $options = array('con $jinput = JFactory::getApplication()->input; - // [Interpretation 19546] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + // [Interpretation 19538] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. if ($jinput->get('a_id')) { $id = $jinput->get('a_id', 0, 'INT'); } - // [Interpretation 19554] The back end uses id so we use that the rest of the time and set it to 0 by default. + // [Interpretation 19546] The back end uses id so we use that the rest of the time and set it to 0 by default. else { $id = $jinput->get('id', 0, 'INT'); @@ -188,56 +188,56 @@ public function getForm($data = array(), $loadData = true, $options = array('con $user = JFactory::getUser(); - // [Interpretation 19563] Check for existing item. - // [Interpretation 19565] Modify the form based on Edit State access controls. - if ($id != 0 && (!$user->authorise('core.edit.state', 'com_recipemanager.recipe.' . (int) $id)) - || ($id == 0 && !$user->authorise('core.edit.state', 'com_recipemanager'))) + // [Interpretation 19555] Check for existing item. + // [Interpretation 19557] Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_recipe_manager.recipe.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_recipe_manager'))) { - // [Interpretation 19598] Disable fields for display. + // [Interpretation 19590] Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true'); - // [Interpretation 19604] Disable fields while saving. + // [Interpretation 19596] Disable fields while saving. $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset'); } - // [Interpretation 19612] If this is a new item insure the greated by is set. + // [Interpretation 19604] If this is a new item insure the greated by is set. if (0 == $id) { - // [Interpretation 19616] Set the created_by to this user + // [Interpretation 19608] Set the created_by to this user $form->setValue('created_by', null, $user->id); } - // [Interpretation 19621] Modify the form based on Edit Creaded By access controls. - if (!$user->authorise('core.edit.created_by', 'com_recipemanager')) + // [Interpretation 19613] Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_recipe_manager')) { - // [Interpretation 19648] Disable fields for display. + // [Interpretation 19640] Disable fields for display. $form->setFieldAttribute('created_by', 'disabled', 'true'); - // [Interpretation 19652] Disable fields for display. + // [Interpretation 19644] Disable fields for display. $form->setFieldAttribute('created_by', 'readonly', 'true'); - // [Interpretation 19656] Disable fields while saving. + // [Interpretation 19648] Disable fields while saving. $form->setFieldAttribute('created_by', 'filter', 'unset'); } - // [Interpretation 19661] Modify the form based on Edit Creaded Date access controls. - if (!$user->authorise('core.edit.created', 'com_recipemanager')) + // [Interpretation 19653] Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_recipe_manager')) { - // [Interpretation 19687] Disable fields for display. + // [Interpretation 19679] Disable fields for display. $form->setFieldAttribute('created', 'disabled', 'true'); - // [Interpretation 19691] Disable fields while saving. + // [Interpretation 19683] Disable fields while saving. $form->setFieldAttribute('created', 'filter', 'unset'); } - // [Interpretation 19769] Only load these values if no id is found + // [Interpretation 19761] Only load these values if no id is found if (0 == $id) { - // [Interpretation 19773] Set redirected view name + // [Interpretation 19765] Set redirected view name $redirectedView = $jinput->get('ref', null, 'STRING'); - // [Interpretation 19777] Set field name (or fall back to view name) + // [Interpretation 19769] Set field name (or fall back to view name) $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); - // [Interpretation 19781] Set redirected view id + // [Interpretation 19773] Set redirected view id $redirectedId = $jinput->get('refid', 0, 'INT'); - // [Interpretation 19785] Set field id (or fall back to redirected view id) + // [Interpretation 19777] Set field id (or fall back to redirected view id) $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); if (0 != $redirectedValue && $redirectedField) { - // [Interpretation 19792] Now set the local-redirected field default value + // [Interpretation 19784] Now set the local-redirected field default value $form->setValue($redirectedField, null, $redirectedValue); } } @@ -251,7 +251,7 @@ public function getForm($data = array(), $loadData = true, $options = array('con */ public function getScript() { - return 'administrator/components/com_recipemanager/models/forms/recipe.js'; + return 'administrator/components/com_recipe_manager/models/forms/recipe.js'; } /** @@ -273,8 +273,8 @@ protected function canDelete($record) } $user = JFactory::getUser(); - // [Interpretation 20119] The record has been set. Check the record permissions. - return $user->authorise('core.delete', 'com_recipemanager.recipe.' . (int) $record->id); + // [Interpretation 20111] The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_recipe_manager.recipe.' . (int) $record->id); } return false; } @@ -295,14 +295,14 @@ protected function canEditState($record) if ($recordId) { - // [Interpretation 20244] The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit.state', 'com_recipemanager.recipe.' . (int) $recordId); + // [Interpretation 20236] The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_recipe_manager.recipe.' . (int) $recordId); if (!$permission && !is_null($permission)) { return false; } } - // [Interpretation 20292] In the absense of better information, revert to the component permissions. + // [Interpretation 20284] In the absense of better information, revert to the component permissions. return parent::canEditState($record); } @@ -317,9 +317,9 @@ protected function canEditState($record) */ protected function allowEdit($data = array(), $key = 'id') { - // [Interpretation 19994] Check specific edit permission then general edit permission. + // [Interpretation 19986] Check specific edit permission then general edit permission. - return JFactory::getUser()->authorise('core.edit', 'com_recipemanager.recipe.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + return JFactory::getUser()->authorise('core.edit', 'com_recipe_manager.recipe.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); } /** @@ -360,7 +360,7 @@ protected function prepareTable($table) $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') - ->from($db->quoteName('#__recipemanager_recipe')); + ->from($db->quoteName('#__recipe_manager_recipe')); $db->setQuery($query); $max = $db->loadResult(); @@ -390,13 +390,13 @@ protected function prepareTable($table) protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_recipemanager.edit.recipe.data', array()); + $data = JFactory::getApplication()->getUserState('com_recipe_manager.edit.recipe.data', array()); if (empty($data)) { $data = $this->getItem(); // run the perprocess of the data - $this->preprocessData('com_recipemanager.recipe', $data); + $this->preprocessData('com_recipe_manager.recipe', $data); } return $data; @@ -490,7 +490,7 @@ public function batch($commands, $pks, $contexts) $this->tableClassName = get_class($this->table); $this->contentType = new JUcmType; $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = RecipemanagerHelper::getActions('recipe'); + $this->canDo = Recipe_managerHelper::getActions('recipe'); $this->batchSet = true; if (!$this->canDo->get('core.batch')) @@ -564,11 +564,11 @@ protected function batchCopy($values, $pks, $contexts) { if (empty($this->batchSet)) { - // [Interpretation 9486] Set some needed variables. + // [Interpretation 9478] Set some needed variables. $this->user = JFactory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); - $this->canDo = RecipemanagerHelper::getActions('recipe'); + $this->canDo = Recipe_managerHelper::getActions('recipe'); } if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) @@ -576,12 +576,12 @@ protected function batchCopy($values, $pks, $contexts) return false; } - // [Interpretation 9520] get list of unique fields + // [Interpretation 9512] get list of unique fields $uniqueFields = $this->getUniqueFields(); - // [Interpretation 9524] remove move_copy from array + // [Interpretation 9516] remove move_copy from array unset($values['move_copy']); - // [Interpretation 9528] make sure published is set + // [Interpretation 9520] make sure published is set if (!isset($values['published'])) { $values['published'] = 0; @@ -597,7 +597,7 @@ protected function batchCopy($values, $pks, $contexts) } elseif (isset($values['category']) && (int) $values['category'] > 0) { - // [Interpretation 9567] move the category value to correct field name + // [Interpretation 9559] move the category value to correct field name $values['catid'] = $values['category']; unset($values['category']); } @@ -607,34 +607,34 @@ protected function batchCopy($values, $pks, $contexts) } $newIds = array(); - // [Interpretation 9582] Parent exists so let's proceed + // [Interpretation 9574] Parent exists so let's proceed while (!empty($pks)) { - // [Interpretation 9586] Pop the first ID off the stack + // [Interpretation 9578] Pop the first ID off the stack $pk = array_shift($pks); $this->table->reset(); - // [Interpretation 9592] only allow copy if user may edit this item. + // [Interpretation 9584] only allow copy if user may edit this item. if (!$this->user->authorise('core.edit', $contexts[$pk])) { - // [Interpretation 9612] Not fatal error + // [Interpretation 9604] Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } - // [Interpretation 9619] Check that the row actually exists + // [Interpretation 9611] Check that the row actually exists if (!$this->table->load($pk)) { if ($error = $this->table->getError()) { - // [Interpretation 9626] Fatal error + // [Interpretation 9618] Fatal error $this->setError($error); return false; } else { - // [Interpretation 9634] Not fatal error + // [Interpretation 9626] Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } @@ -649,8 +649,8 @@ protected function batchCopy($values, $pks, $contexts) list($this->table->name, $this->table->alias) = $this->generateNewTitle($this->table->catid, $this->table->alias, $this->table->name); } - // [Interpretation 9719] insert all set values - if (RecipemanagerHelper::checkArray($values)) + // [Interpretation 9711] insert all set values + if (Recipe_managerHelper::checkArray($values)) { foreach ($values as $key => $value) { @@ -661,8 +661,8 @@ protected function batchCopy($values, $pks, $contexts) } } - // [Interpretation 9734] update all unique fields - if (RecipemanagerHelper::checkArray($uniqueFields)) + // [Interpretation 9726] update all unique fields + if (Recipe_managerHelper::checkArray($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -670,13 +670,13 @@ protected function batchCopy($values, $pks, $contexts) } } - // [Interpretation 9747] Reset the ID because we are making a copy + // [Interpretation 9739] Reset the ID because we are making a copy $this->table->id = 0; - // [Interpretation 9751] TODO: Deal with ordering? - // [Interpretation 9753] $this->table->ordering = 1; + // [Interpretation 9743] TODO: Deal with ordering? + // [Interpretation 9745] $this->table->ordering = 1; - // [Interpretation 9756] Check the row. + // [Interpretation 9748] Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); @@ -689,7 +689,7 @@ protected function batchCopy($values, $pks, $contexts) $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); } - // [Interpretation 9772] Store the row. + // [Interpretation 9764] Store the row. if (!$this->table->store()) { $this->setError($this->table->getError()); @@ -697,14 +697,14 @@ protected function batchCopy($values, $pks, $contexts) return false; } - // [Interpretation 9782] Get the new item ID + // [Interpretation 9774] Get the new item ID $newId = $this->table->get('id'); - // [Interpretation 9786] Add the new ID to the array + // [Interpretation 9778] Add the new ID to the array $newIds[$pk] = $newId; } - // [Interpretation 9791] Clean the cache + // [Interpretation 9783] Clean the cache $this->cleanCache(); return $newIds; @@ -725,11 +725,11 @@ protected function batchMove($values, $pks, $contexts) { if (empty($this->batchSet)) { - // [Interpretation 9206] Set some needed variables. + // [Interpretation 9198] Set some needed variables. $this->user = JFactory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); - $this->canDo = RecipemanagerHelper::getActions('recipe'); + $this->canDo = Recipe_managerHelper::getActions('recipe'); } if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) @@ -738,12 +738,12 @@ protected function batchMove($values, $pks, $contexts) return false; } - // [Interpretation 9243] make sure published only updates if user has the permission. + // [Interpretation 9235] make sure published only updates if user has the permission. if (isset($values['published']) && !$this->canDo->get('core.edit.state')) { unset($values['published']); } - // [Interpretation 9268] remove move_copy from array + // [Interpretation 9260] remove move_copy from array unset($values['move_copy']); if (isset($values['category']) && (int) $values['category'] > 0 && !static::checkCategoryId($values['category'])) @@ -752,7 +752,7 @@ protected function batchMove($values, $pks, $contexts) } elseif (isset($values['category']) && (int) $values['category'] > 0) { - // [Interpretation 9282] move the category value to correct field name + // [Interpretation 9274] move the category value to correct field name $values['catid'] = $values['category']; unset($values['category']); } @@ -762,7 +762,7 @@ protected function batchMove($values, $pks, $contexts) } - // [Interpretation 9295] Parent exists so we proceed + // [Interpretation 9287] Parent exists so we proceed foreach ($pks as $pk) { if (!$this->user->authorise('core.edit', $contexts[$pk])) @@ -771,29 +771,29 @@ protected function batchMove($values, $pks, $contexts) return false; } - // [Interpretation 9323] Check that the row actually exists + // [Interpretation 9315] Check that the row actually exists if (!$this->table->load($pk)) { if ($error = $this->table->getError()) { - // [Interpretation 9330] Fatal error + // [Interpretation 9322] Fatal error $this->setError($error); return false; } else { - // [Interpretation 9338] Not fatal error + // [Interpretation 9330] Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } - // [Interpretation 9346] insert all set values. - if (RecipemanagerHelper::checkArray($values)) + // [Interpretation 9338] insert all set values. + if (Recipe_managerHelper::checkArray($values)) { foreach ($values as $key => $value) { - // [Interpretation 9353] Do special action for access. + // [Interpretation 9345] Do special action for access. if ('access' === $key && strlen($value) > 0) { $this->table->$key = $value; @@ -806,7 +806,7 @@ protected function batchMove($values, $pks, $contexts) } - // [Interpretation 9368] Check the row. + // [Interpretation 9360] Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); @@ -819,7 +819,7 @@ protected function batchMove($values, $pks, $contexts) $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); } - // [Interpretation 9384] Store the row. + // [Interpretation 9376] Store the row. if (!$this->table->store()) { $this->setError($this->table->getError()); @@ -828,7 +828,7 @@ protected function batchMove($values, $pks, $contexts) } } - // [Interpretation 9395] Clean the cache + // [Interpretation 9387] Clean the cache $this->cleanCache(); return true; @@ -879,7 +879,7 @@ public function save($data) $data['params'] = (string) $params; } - // [Interpretation 9837] Alter the name for save as copy + // [Interpretation 9829] Alter the name for save as copy if ($input->get('task') === 'save2copy') { $origTable = clone $this->getTable(); @@ -902,7 +902,7 @@ public function save($data) $data['published'] = 0; } - // [Interpretation 9905] Automatic handling of alias for empty fields + // [Interpretation 9897] Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) { if ($data['alias'] == null || empty($data['alias'])) @@ -916,11 +916,11 @@ public function save($data) $data['alias'] = JFilterOutput::stringURLSafe($data['name']); } - $table = JTable::getInstance('recipe', 'recipemanagerTable'); + $table = JTable::getInstance('recipe', 'recipe_managerTable'); if ($table->load(array('alias' => $data['alias'], 'catid' => $data['catid'])) && ($table->id != $data['id'] || $data['id'] == 0)) { - $msg = JText::_('COM_RECIPEMANAGER_RECIPE_SAVE_WARNING'); + $msg = JText::_('COM_RECIPE_MANAGER_RECIPE_SAVE_WARNING'); } list($name, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['name']); @@ -933,12 +933,12 @@ public function save($data) } } - // [Interpretation 9988] Alter the unique field for save as copy + // [Interpretation 9980] Alter the unique field for save as copy if ($input->get('task') === 'save2copy') { - // [Interpretation 9993] Automatic handling of other unique fields + // [Interpretation 9985] Automatic handling of other unique fields $uniqueFields = $this->getUniqueFields(); - if (RecipemanagerHelper::checkArray($uniqueFields)) + if (Recipe_managerHelper::checkArray($uniqueFields)) { foreach ($uniqueFields as $uniqueField) { @@ -990,38 +990,38 @@ protected function generateUnique($field,$value) protected function _generateNewTitle($alias, $title = null) { - // [Interpretation 10042] Alter the title/s & alias + // [Interpretation 10034] Alter the title/s & alias $table = $this->getTable(); while ($table->load(array('alias' => $alias))) { - // [Interpretation 10048] Check if this is an array of titles - if (RecipemanagerHelper::checkArray($title)) + // [Interpretation 10040] Check if this is an array of titles + if (Recipe_managerHelper::checkArray($title)) { foreach($title as $nr => &$_title) { $_title = StringHelper::increment($_title); } } - // [Interpretation 10060] Make sure we have a title + // [Interpretation 10052] Make sure we have a title elseif ($title) { $title = StringHelper::increment($title); } $alias = StringHelper::increment($alias, 'dash'); } - // [Interpretation 10070] Check if this is an array of titles - if (RecipemanagerHelper::checkArray($title)) + // [Interpretation 10062] Check if this is an array of titles + if (Recipe_managerHelper::checkArray($title)) { $title[] = $alias; return $title; } - // [Interpretation 10078] Make sure we have a title + // [Interpretation 10070] Make sure we have a title elseif ($title) { return array($title, $alias); } - // [Interpretation 10084] We only had an alias + // [Interpretation 10076] We only had an alias return $alias; } } diff --git a/admin/models/recipe_manager.php b/admin/models/recipe_manager.php new file mode 100644 index 0000000..ab6c86a --- /dev/null +++ b/admin/models/recipe_manager.php @@ -0,0 +1,234 @@ + + @copyright Copyright (C) 2020. All Rights Reserved + @license GNU General Public License version 2 or later; see LICENSE.txt + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Recipe_manager Model + */ +class Recipe_managerModelRecipe_manager extends JModelList +{ + public function getIcons() + { + // load user for access menus + $user = JFactory::getUser(); + // reset icon array + $icons = array(); + // view groups array + $viewGroups = array( + 'main' => array('jpg.ingredients', 'png.recipes', 'png.recipes.catid_qpo0O0oqp_com_recipe_manager') + ); + // [Interpretation 22506] view access array + $viewAccess = array( + 'ingredients.access' => 'ingredient.access', + 'ingredient.access' => 'ingredient.access', + 'ingredients.submenu' => 'ingredient.submenu', + 'ingredients.dashboard_list' => 'ingredient.dashboard_list', + 'recipes.access' => 'recipe.access', + 'recipe.access' => 'recipe.access', + 'recipes.submenu' => 'recipe.submenu', + 'recipes.dashboard_list' => 'recipe.dashboard_list'); + // loop over the $views + foreach($viewGroups as $group => $views) + { + $i = 0; + if (Recipe_managerHelper::checkArray($views)) + { + foreach($views as $view) + { + $add = false; + // external views (links) + if (strpos($view,'||') !== false) + { + $dwd = explode('||', $view); + if (count($dwd) == 3) + { + list($type, $name, $url) = $dwd; + $viewName = $name; + $alt = $name; + $url = $url; + $image = $name . '.' . $type; + $name = 'COM_RECIPE_MANAGER_DASHBOARD_' . Recipe_managerHelper::safeString($name,'U'); + } + } + // internal views + elseif (strpos($view,'.') !== false) + { + $dwd = explode('.', $view); + if (count($dwd) == 3) + { + list($type, $name, $action) = $dwd; + } + elseif (count($dwd) == 2) + { + list($type, $name) = $dwd; + $action = false; + } + if ($action) + { + $viewName = $name; + switch($action) + { + case 'add': + $url = 'index.php?option=com_recipe_manager&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; + $name = 'COM_RECIPE_MANAGER_DASHBOARD_'.Recipe_managerHelper::safeString($name,'U').'_ADD'; + $add = true; + break; + default: + // check for new convention (more stable) + if (strpos($action, '_qpo0O0oqp_') !== false) + { + list($action, $extension) = (array) explode('_qpo0O0oqp_', $action); + $extension = str_replace('_po0O0oq_', '.', $extension); + } + else + { + $extension = 'com_recipe_manager.' . $name; + } + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_RECIPE_MANAGER_DASHBOARD_' . Recipe_managerHelper::safeString($name,'U') . '_' . Recipe_managerHelper::safeString($action,'U'); + break; + } + } + else + { + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_recipe_manager&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_RECIPE_MANAGER_DASHBOARD_' . Recipe_managerHelper::safeString($name,'U'); + $hover = false; + } + } + else + { + $viewName = $view; + $alt = $view; + $url = 'index.php?option=com_recipe_manager&view=' . $view; + $image = $view . '.png'; + $name = ucwords($view).'

'; + $hover = false; + } + // first make sure the view access is set + if (Recipe_managerHelper::checkArray($viewAccess)) + { + // setup some defaults + $dashboard_add = false; + $dashboard_list = false; + $accessTo = ''; + $accessAdd = ''; + // access checking start + $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? Recipe_managerHelper::checkString($viewAccess[$viewName.'.create']):false; + $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? Recipe_managerHelper::checkString($viewAccess[$viewName.'.access']):false; + // set main controllers + $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? Recipe_managerHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false; + $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? Recipe_managerHelper::checkString($viewAccess[$viewName.'.dashboard_list']):false; + // check for adding access + if ($add && $accessCreate) + { + $accessAdd = $viewAccess[$viewName.'.create']; + } + elseif ($add) + { + $accessAdd = 'core.create'; + } + // check if access to view is set + if ($accessAccess) + { + $accessTo = $viewAccess[$viewName.'.access']; + } + // set main access controllers + if ($accessDashboard_add) + { + $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_recipe_manager'); + } + if ($accessDashboard_list) + { + $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_recipe_manager'); + } + if (Recipe_managerHelper::checkString($accessAdd) && Recipe_managerHelper::checkString($accessTo)) + { + // check access + if($user->authorise($accessAdd, 'com_recipe_manager') && $user->authorise($accessTo, 'com_recipe_manager') && $dashboard_add) + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + elseif (Recipe_managerHelper::checkString($accessTo)) + { + // check access + if($user->authorise($accessTo, 'com_recipe_manager') && $dashboard_list) + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + elseif (Recipe_managerHelper::checkString($accessAdd)) + { + // check access + if($user->authorise($accessAdd, 'com_recipe_manager') && $dashboard_add) + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + else + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + else + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + $i++; + } + } + else + { + $icons[$group][$i] = false; + } + } + return $icons; + } +} diff --git a/admin/models/recipes.php b/admin/models/recipes.php index 422eb91..8d74caa 100644 --- a/admin/models/recipes.php +++ b/admin/models/recipes.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage recipes.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -26,7 +26,7 @@ /** * Recipes Model */ -class RecipemanagerModelRecipes extends JModelList +class Recipe_managerModelRecipes extends JModelList { public function __construct($config = array()) { @@ -70,8 +70,15 @@ protected function populateState($ordering = null, $direction = null) $this->context .= '.' . $layout; } + // [Interpretation 21133] Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $this->setState('filter.published', $published); @@ -95,10 +102,18 @@ protected function populateState($ordering = null, $direction = null) $this->setState('filter.category_id', $categoryId); $catid = $this->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid'); - $this->setState('filter.catid', $catid); + if ($formSubmited) + { + $catid = $app->input->post->get('catid'); + $this->setState('filter.catid', $catid); + } $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } // List state information. parent::populateState($ordering, $direction); @@ -111,7 +126,7 @@ protected function populateState($ordering = null, $direction = null) */ public function getItems() { - // [Interpretation 21363] check in items + // [Interpretation 21355] check in items $this->checkInNow(); // load parent items @@ -128,21 +143,21 @@ public function getItems() */ protected function getListQuery() { - // [Interpretation 15534] Get the user object. + // [Interpretation 15526] Get the user object. $user = JFactory::getUser(); - // [Interpretation 15536] Create a new query object. + // [Interpretation 15528] Create a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); - // [Interpretation 15541] Select some fields + // [Interpretation 15533] Select some fields $query->select('a.*'); $query->select($db->quoteName('c.title','category_title')); - // [Interpretation 15551] From the recipemanager_item table - $query->from($db->quoteName('#__recipemanager_recipe', 'a')); + // [Interpretation 15543] From the recipe_manager_item table + $query->from($db->quoteName('#__recipe_manager_recipe', 'a')); $query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')'); - // [Interpretation 15570] Filter by published state + // [Interpretation 15562] Filter by published state $published = $this->getState('filter.published'); if (is_numeric($published)) { @@ -153,29 +168,29 @@ protected function getListQuery() $query->where('(a.published = 0 OR a.published = 1)'); } - // [Interpretation 15590] Join over the asset groups. + // [Interpretation 15582] Join over the asset groups. $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); - // [Interpretation 15604] Filter by access level. + // [Interpretation 15596] Filter by access level. $_access = $this->getState('filter.access'); if ($_access && is_numeric($_access)) { $query->where('a.access = ' . (int) $_access); } - elseif (RecipemanagerHelper::checkArray($_access)) + elseif (Recipe_managerHelper::checkArray($_access)) { - // [Interpretation 15619] Secure the array for the query + // [Interpretation 15611] Secure the array for the query $_access = ArrayHelper::toInteger($_access); - // [Interpretation 15624] Filter by the Access Array. + // [Interpretation 15616] Filter by the Access Array. $query->where('a.access IN (' . implode(',', $_access) . ')'); } - // [Interpretation 15630] Implement View Level Access - if (!$user->authorise('core.options', 'com_recipemanager')) + // [Interpretation 15622] Implement View Level Access + if (!$user->authorise('core.options', 'com_recipe_manager')) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')'); } - // [Interpretation 15791] Filter by search. + // [Interpretation 15783] Filter by search. $search = $this->getState('filter.search'); if (!empty($search)) { @@ -191,7 +206,7 @@ protected function getListQuery() } - // [Interpretation 15650] Filter by a single or group of categories. + // [Interpretation 15642] Filter by a single or group of categories. $baselevel = 1; $categoryId = $this->getState('filter.category_id'); @@ -213,7 +228,7 @@ protected function getListQuery() } - // [Interpretation 15738] Add the list ordering clause. + // [Interpretation 15730] Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') @@ -234,74 +249,74 @@ protected function getListQuery() */ public function getExportData($pks, $user = null) { - // [Interpretation 14988] setup the query - if (($pks_size = RecipemanagerHelper::checkArray($pks)) !== false || 'bulk' === $pks) + // [Interpretation 14980] setup the query + if (($pks_size = Recipe_managerHelper::checkArray($pks)) !== false || 'bulk' === $pks) { - // [Interpretation 14995] Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + // [Interpretation 14987] Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) $_export = true; - // [Interpretation 15000] Get the user object if not set. - if (!isset($user) || !RecipemanagerHelper::checkObject($user)) + // [Interpretation 14992] Get the user object if not set. + if (!isset($user) || !Recipe_managerHelper::checkObject($user)) { $user = JFactory::getUser(); } - // [Interpretation 15008] Create a new query object. + // [Interpretation 15000] Create a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); - // [Interpretation 15014] Select some fields + // [Interpretation 15006] Select some fields $query->select('a.*'); - // [Interpretation 15018] From the recipemanager_recipe table - $query->from($db->quoteName('#__recipemanager_recipe', 'a')); - // [Interpretation 15025] The bulk export path + // [Interpretation 15010] From the recipe_manager_recipe table + $query->from($db->quoteName('#__recipe_manager_recipe', 'a')); + // [Interpretation 15017] The bulk export path if ('bulk' === $pks) { $query->where('a.id > 0'); } - // [Interpretation 15034] A large array of ID's will not work out well + // [Interpretation 15026] A large array of ID's will not work out well elseif ($pks_size > 500) { - // [Interpretation 15039] Use lowest ID + // [Interpretation 15031] Use lowest ID $query->where('a.id >= ' . (int) min($pks)); - // [Interpretation 15043] Use highest ID + // [Interpretation 15035] Use highest ID $query->where('a.id <= ' . (int) max($pks)); } - // [Interpretation 15049] The normal default path + // [Interpretation 15041] The normal default path else { $query->where('a.id IN (' . implode(',',$pks) . ')'); } - // [Interpretation 15101] Implement View Level Access - if (!$user->authorise('core.options', 'com_recipemanager')) + // [Interpretation 15093] Implement View Level Access + if (!$user->authorise('core.options', 'com_recipe_manager')) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN (' . $groups . ')'); } - // [Interpretation 15142] Order the results by ordering + // [Interpretation 15134] Order the results by ordering $query->order('a.ordering ASC'); - // [Interpretation 15148] Load the items + // [Interpretation 15140] Load the items $db->setQuery($query); $db->execute(); if ($db->getNumRows()) { $items = $db->loadObjectList(); - // [Interpretation 21901] Set values to display correctly. - if (RecipemanagerHelper::checkArray($items)) + // [Interpretation 21893] Set values to display correctly. + if (Recipe_managerHelper::checkArray($items)) { foreach ($items as $nr => &$item) { - // [Interpretation 22043] unset the values we don't want exported. + // [Interpretation 22035] unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); unset($item->checked_out_time); } } - // [Interpretation 22058] Add headers to items array. + // [Interpretation 22050] Add headers to items array. $headers = $this->getExImPortHeaders(); - if (RecipemanagerHelper::checkObject($headers)) + if (Recipe_managerHelper::checkObject($headers)) { array_unshift($items,$headers); } @@ -321,8 +336,8 @@ public function getExImPortHeaders() // Get a db connection. $db = JFactory::getDbo(); // get the columns - $columns = $db->getTableColumns("#__recipemanager_recipe"); - if (RecipemanagerHelper::checkArray($columns)) + $columns = $db->getTableColumns("#__recipe_manager_recipe"); + if (Recipe_managerHelper::checkArray($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); @@ -346,17 +361,61 @@ public function getExImPortHeaders() */ protected function getStoreId($id = '') { - // [Interpretation 20600] Compile the store id. + // [Interpretation 20592] Compile the store id. $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); - $id .= ':' . $this->getState('filter.access'); + // [Interpretation 20757] Check if the value is an array + $_access = $this->getState('filter.access'); + if (Recipe_managerHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // [Interpretation 20772] Check if this is only an number or string + elseif (is_numeric($_access) + || Recipe_managerHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.category'); - $id .= ':' . $this->getState('filter.category_id'); - $id .= ':' . $this->getState('filter.catid'); + // [Interpretation 20757] Check if the value is an array + $_category = $this->getState('filter.category'); + if (Recipe_managerHelper::checkArray($_category)) + { + $id .= ':' . implode(':', $_category); + } + // [Interpretation 20772] Check if this is only an number or string + elseif (is_numeric($_category) + || Recipe_managerHelper::checkString($_category)) + { + $id .= ':' . $_category; + } + // [Interpretation 20757] Check if the value is an array + $_category_id = $this->getState('filter.category_id'); + if (Recipe_managerHelper::checkArray($_category_id)) + { + $id .= ':' . implode(':', $_category_id); + } + // [Interpretation 20772] Check if this is only an number or string + elseif (is_numeric($_category_id) + || Recipe_managerHelper::checkString($_category_id)) + { + $id .= ':' . $_category_id; + } + // [Interpretation 20757] Check if the value is an array + $_catid = $this->getState('filter.catid'); + if (Recipe_managerHelper::checkArray($_catid)) + { + $id .= ':' . implode(':', $_catid); + } + // [Interpretation 20772] Check if this is only an number or string + elseif (is_numeric($_catid) + || Recipe_managerHelper::checkString($_catid)) + { + $id .= ':' . $_catid; + } $id .= ':' . $this->getState('filter.name'); return parent::getStoreId($id); @@ -370,41 +429,41 @@ protected function getStoreId($id = '') */ protected function checkInNow() { - // [Interpretation 21381] Get set check in time - $time = JComponentHelper::getParams('com_recipemanager')->get('check_in'); + // [Interpretation 21373] Get set check in time + $time = JComponentHelper::getParams('com_recipe_manager')->get('check_in'); if ($time) { - // [Interpretation 21389] Get a db connection. + // [Interpretation 21381] Get a db connection. $db = JFactory::getDbo(); - // [Interpretation 21392] reset query + // [Interpretation 21384] reset query $query = $db->getQuery(true); $query->select('*'); - $query->from($db->quoteName('#__recipemanager_recipe')); + $query->from($db->quoteName('#__recipe_manager_recipe')); $db->setQuery($query); $db->execute(); if ($db->getNumRows()) { - // [Interpretation 21403] Get Yesterdays date + // [Interpretation 21395] Get Yesterdays date $date = JFactory::getDate()->modify($time)->toSql(); - // [Interpretation 21407] reset query + // [Interpretation 21399] reset query $query = $db->getQuery(true); - // [Interpretation 21411] Fields to update. + // [Interpretation 21403] Fields to update. $fields = array( $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', $db->quoteName('checked_out') . '=0' ); - // [Interpretation 21420] Conditions for which records should be updated. + // [Interpretation 21412] Conditions for which records should be updated. $conditions = array( $db->quoteName('checked_out') . '!=0', $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // [Interpretation 21429] Check table - $query->update($db->quoteName('#__recipemanager_recipe'))->set($fields)->where($conditions); + // [Interpretation 21421] Check table + $query->update($db->quoteName('#__recipe_manager_recipe'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/recipe_manager.php b/admin/recipe_manager.php new file mode 100644 index 0000000..7c39dd7 --- /dev/null +++ b/admin/recipe_manager.php @@ -0,0 +1,47 @@ + + @copyright Copyright (C) 2020. All Rights Reserved + @license GNU General Public License version 2 or later; see LICENSE.txt + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); +JHtml::_('behavior.tabstate'); + +// Access check. +if (!JFactory::getUser()->authorise('core.manage', 'com_recipe_manager')) +{ + throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); +}; + +// Add CSS file for all pages +$document = JFactory::getDocument(); +$document->addStyleSheet('components/com_recipe_manager/assets/css/admin.css'); +$document->addScript('components/com_recipe_manager/assets/js/admin.js'); + +// require helper files +JLoader::register('Recipe_managerHelper', __DIR__ . '/helpers/recipe_manager.php'); +JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); + +// Get an instance of the controller prefixed by Recipe_manager +$controller = JControllerLegacy::getInstance('Recipe_manager'); + +// Perform the Request task +$controller->execute(JFactory::getApplication()->input->get('task')); + +// Redirect if set by the controller +$controller->redirect(); diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index efcd4ce..316e641 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -1,4 +1,4 @@ -CREATE TABLE IF NOT EXISTS `#__recipemanager_ingredient` ( +CREATE TABLE IF NOT EXISTS `#__recipe_manager_ingredient` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `image` CHAR(64) NOT NULL DEFAULT '', @@ -25,7 +25,7 @@ CREATE TABLE IF NOT EXISTS `#__recipemanager_ingredient` ( KEY `idx_state` (`published`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; -CREATE TABLE IF NOT EXISTS `#__recipemanager_recipe` ( +CREATE TABLE IF NOT EXISTS `#__recipe_manager_recipe` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `alias` CHAR(64) NOT NULL DEFAULT '', diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index a206405..4ddd586 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -1,3 +1,3 @@ -DROP TABLE IF EXISTS `#__recipemanager_ingredient`; -DROP TABLE IF EXISTS `#__recipemanager_recipe`; +DROP TABLE IF EXISTS `#__recipe_manager_ingredient`; +DROP TABLE IF EXISTS `#__recipe_manager_recipe`; diff --git a/admin/tables/ingredient.php b/admin/tables/ingredient.php index c2c382b..a277945 100644 --- a/admin/tables/ingredient.php +++ b/admin/tables/ingredient.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage ingredient.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -28,7 +28,7 @@ /** * Ingredients Table class */ -class RecipemanagerTableIngredient extends JTable +class Recipe_managerTableIngredient extends JTable { /** * Ensure the params and metadata in json encoded in the bind method @@ -45,10 +45,10 @@ class RecipemanagerTableIngredient extends JTable */ function __construct(&$db) { - parent::__construct('#__recipemanager_ingredient', 'id', $db); + parent::__construct('#__recipe_manager_ingredient', 'id', $db); // [Interpretation 7724] Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_recipemanager.ingredient')); + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_recipe_manager.ingredient')); } public function bind($array, $ignore = '') @@ -112,11 +112,11 @@ public function store($updateNulls = false) if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('ingredient', 'RecipemanagerTable'); + $table = JTable::getInstance('ingredient', 'Recipe_managerTable'); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_RECIPEMANAGER_INGREDIENT_ERROR_UNIQUE_ALIAS')); + $this->setError(JText::_('COM_RECIPE_MANAGER_INGREDIENT_ERROR_UNIQUE_ALIAS')); return false; } } @@ -147,7 +147,7 @@ public function check() // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('ingredient', 'recipemanagerTable'); + $table = JTable::getInstance('ingredient', 'recipe_managerTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -196,7 +196,7 @@ public function check() // If we don't have any access rules set at this point just use an empty JAccessRules class if (!$this->getRules()) { - $rules = $this->getDefaultAssetValues('com_recipemanager.ingredient.'.$this->id); + $rules = $this->getDefaultAssetValues('com_recipe_manager.ingredient.'.$this->id); $this->setRules($rules); } @@ -287,7 +287,7 @@ protected function getDefaultAssetValues($component, $try = true) protected function _getAssetName() { $k = $this->_tbl_key; - return 'com_recipemanager.ingredient.'.(int) $this->$k; + return 'com_recipe_manager.ingredient.'.(int) $this->$k; } /** @@ -314,7 +314,7 @@ protected function _getAssetTitle() protected function _getAssetParentId(JTable $table = NULL, $id = NULL) { $asset = JTable::getInstance('Asset'); - $asset->loadByName('com_recipemanager'); + $asset->loadByName('com_recipe_manager'); return $asset->id; } diff --git a/admin/tables/recipe.php b/admin/tables/recipe.php index c27d37f..6e2a920 100644 --- a/admin/tables/recipe.php +++ b/admin/tables/recipe.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage recipe.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -28,7 +28,7 @@ /** * Recipes Table class */ -class RecipemanagerTableRecipe extends JTable +class Recipe_managerTableRecipe extends JTable { /** * Ensure the params and metadata in json encoded in the bind method @@ -45,10 +45,10 @@ class RecipemanagerTableRecipe extends JTable */ function __construct(&$db) { - parent::__construct('#__recipemanager_recipe', 'id', $db); + parent::__construct('#__recipe_manager_recipe', 'id', $db); // [Interpretation 7724] Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_recipemanager.recipe')); + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_recipe_manager.recipe')); } public function bind($array, $ignore = '') @@ -112,11 +112,11 @@ public function store($updateNulls = false) if (isset($this->alias)) { // Verify that the alias is unique - $table = JTable::getInstance('recipe', 'RecipemanagerTable'); + $table = JTable::getInstance('recipe', 'Recipe_managerTable'); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(JText::_('COM_RECIPEMANAGER_RECIPE_ERROR_UNIQUE_ALIAS')); + $this->setError(JText::_('COM_RECIPE_MANAGER_RECIPE_ERROR_UNIQUE_ALIAS')); return false; } } @@ -147,7 +147,7 @@ public function check() // Generate a valid alias $this->generateAlias(); - $table = JTable::getInstance('recipe', 'recipemanagerTable'); + $table = JTable::getInstance('recipe', 'recipe_managerTable'); while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { @@ -196,7 +196,7 @@ public function check() // If we don't have any access rules set at this point just use an empty JAccessRules class if (!$this->getRules()) { - $rules = $this->getDefaultAssetValues('com_recipemanager.recipe.'.$this->id); + $rules = $this->getDefaultAssetValues('com_recipe_manager.recipe.'.$this->id); $this->setRules($rules); } @@ -287,7 +287,7 @@ protected function getDefaultAssetValues($component, $try = true) protected function _getAssetName() { $k = $this->_tbl_key; - return 'com_recipemanager.recipe.'.(int) $this->$k; + return 'com_recipe_manager.recipe.'.(int) $this->$k; } /** @@ -314,7 +314,7 @@ protected function _getAssetTitle() protected function _getAssetParentId(JTable $table = NULL, $id = NULL) { $asset = JTable::getInstance('Asset'); - $asset->loadByName('com_recipemanager'); + $asset->loadByName('com_recipe_manager'); return $asset->id; } diff --git a/admin/views/import/tmpl/default.php b/admin/views/import/tmpl/default.php index c7cb3c1..916f7ba 100644 --- a/admin/views/import/tmpl/default.php +++ b/admin/views/import/tmpl/default.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage default.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -27,7 +27,7 @@ JHtml::_('behavior.keepalive'); ?>
- + sidebar)) : ?>
@@ -141,13 +141,13 @@
- hasPackage && RecipemanagerHelper::checkArray($this->headerList) && RecipemanagerHelper::checkArray($this->headers)) : ?> + hasPackage && Recipe_managerHelper::checkArray($this->headerList) && Recipe_managerHelper::checkArray($this->headers)) : ?>
- +
- +
- +
headerList as $name => $title): ?> @@ -155,65 +155,65 @@
- +
'upload')); ?> - +
- +
- +
-     (.csv .xls .ods) +     (.csv .xls .ods)
- +
- +
- +
-     (.csv .xls .ods) +     (.csv .xls .ods)
- +
- +
- +
-     (.csv .xls .ods) +     (.csv .xls .ods)
diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php index 77c176e..d886e49 100644 --- a/admin/views/import/view.html.php +++ b/admin/views/import/view.html.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage view.html.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -22,9 +22,9 @@ defined('_JEXEC') or die('Restricted access'); /** - * Recipemanager Import View + * Recipe_manager Import View */ -class RecipemanagerViewImport extends JViewLegacy +class Recipe_managerViewImport extends JViewLegacy { protected $headerList; protected $hasPackage = false; @@ -37,7 +37,7 @@ public function display($tpl = null) if ($this->getLayout() !== 'modal') { // Include helper submenu - RecipemanagerHelper::addSubmenu('import'); + Recipe_managerHelper::addSubmenu('import'); } $paths = new stdClass; @@ -47,7 +47,7 @@ public function display($tpl = null) $this->paths = &$paths; $this->state = &$state; // get global action permissions - $this->canDo = RecipemanagerHelper::getActions('import'); + $this->canDo = Recipe_managerHelper::getActions('import'); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') @@ -64,7 +64,7 @@ public function display($tpl = null) if($this->hasPackage && $this->dataType) { $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); - $this->headers = RecipemanagerHelper::getFileHeaders($this->dataType); + $this->headers = Recipe_managerHelper::getFileHeaders($this->dataType); // clear the data type $session->clear('dataType'); } @@ -84,19 +84,19 @@ public function display($tpl = null) */ protected function addToolBar() { - JToolBarHelper::title(JText::_('COM_RECIPEMANAGER_IMPORT_TITLE'), 'upload'); - JHtmlSidebar::setAction('index.php?option=com_recipemanager&view=import'); + JToolBarHelper::title(JText::_('COM_RECIPE_MANAGER_IMPORT_TITLE'), 'upload'); + JHtmlSidebar::setAction('index.php?option=com_recipe_manager&view=import'); if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { - JToolBarHelper::preferences('com_recipemanager'); + JToolBarHelper::preferences('com_recipe_manager'); } // set help url for this view if found - $help_url = RecipemanagerHelper::getHelpUrl('import'); - if (RecipemanagerHelper::checkString($help_url)) + $help_url = Recipe_managerHelper::getHelpUrl('import'); + if (Recipe_managerHelper::checkString($help_url)) { - JToolbarHelper::help('COM_RECIPEMANAGER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_RECIPE_MANAGER_HELP_MANAGER', false, $help_url); } } } diff --git a/admin/views/ingredient/submitbutton.js b/admin/views/ingredient/submitbutton.js index 3eb618e..f1b3000 100644 --- a/admin/views/ingredient/submitbutton.js +++ b/admin/views/ingredient/submitbutton.js @@ -2,14 +2,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage submitbutton.js @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( diff --git a/admin/views/ingredient/tmpl/edit.php b/admin/views/ingredient/tmpl/edit.php index 29d88cb..2009289 100644 --- a/admin/views/ingredient/tmpl/edit.php +++ b/admin/views/ingredient/tmpl/edit.php @@ -3,14 +3,14 @@ Vast Development Method /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 11th December, 2020 + @version 1.0.2 + @build 14th December, 2020 @created 5th July, 2020 @package Recipe Manager @subpackage edit.php @author Oh Martin @copyright Copyright (C) 2020. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + @license GNU General Public License version 2 or later; see LICENSE.txt ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( @@ -32,7 +32,7 @@ // waiting spinner var outerDiv = jQuery('body'); jQuery('
') - .css("background", "rgba(255, 255, 255, .8) url('components/com_recipemanager/assets/images/import.gif') 50% 15% no-repeat") + .css("background", "rgba(255, 255, 255, .8) url('components/com_recipe_manager/assets/images/import.gif') 50% 15% no-repeat") .css("top", outerDiv.position().top - jQuery(window).scrollTop()) .css("left", outerDiv.position().left - jQuery(window).scrollLeft()) .css("width", outerDiv.width()) @@ -46,18 +46,18 @@ jQuery('#loading').show(); // when page is ready remove and show jQuery(window).load(function() { - jQuery('#recipemanager_loader').fadeIn('fast'); + jQuery('#recipe_manager_loader').fadeIn('fast'); jQuery('#loading').hide(); }); -