diff --git a/README.md b/README.md index 21190ae..f4ea299 100644 --- a/README.md +++ b/README.md @@ -15,31 +15,31 @@ Support Groups ## Build Time -**76 Hours** or **10 Eight Hour Days** (actual time the author saved - +**120 Hours** or **15 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder] (https://www.vdm.io/joomla-component-builder)) > (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*: **27334** -+ *File count*: **229** -+ *Folder count*: **64** ++ *Line count*: **42865** ++ *File count*: **331** ++ *Folder count*: **76** -**51 Hours** or **6 Eight Hour Days** (the actual time the author spent) +**79 Hours** or **10 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @19hours** = codingtime / 4; -> **planning @11hours** = codingtime / 7; -> **mapping @8hours** = codingtime / 10; -> **office @13hours** = codingtime / 6;) +> **debugging @30hours** = codingtime / 4; +> **planning @17hours** = codingtime / 7; +> **mapping @12hours** = codingtime / 10; +> **office @20hours** = codingtime / 6;) -**127 Hours** or **16 Eight Hour Days** +**199 Hours** or **25 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **3.2 weeks** or **0.7 months** +Project duration: **5 weeks** or **1 months** > This **component** was build with a Joomla [Automated Component Builder] (https://www.vdm.io/joomla-component-builder). > Developed by [Llewellyn van der Merwe] (mailto:joomla@vdm.io) \ No newline at end of file diff --git a/admin/access.xml b/admin/access.xml index b2901f6..20b9863 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -15,6 +15,23 @@ + + + + + + + + + + + + + + + + + @@ -39,47 +56,176 @@ + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + +
+
+ + + + + + + +
@@ -89,13 +235,13 @@
-
- - - - - - - +
+ + + + + + +
\ No newline at end of file diff --git a/admin/assets/css/clinic.css b/admin/assets/css/clinic.css new file mode 100644 index 0000000..096cab9 --- /dev/null +++ b/admin/assets/css/clinic.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage clinic.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/clinics.css b/admin/assets/css/clinics.css new file mode 100644 index 0000000..dfe5ce6 --- /dev/null +++ b/admin/assets/css/clinics.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage clinics.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/help_document.css b/admin/assets/css/help_document.css new file mode 100644 index 0000000..ef8e578 --- /dev/null +++ b/admin/assets/css/help_document.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage help_document.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/help_documents.css b/admin/assets/css/help_documents.css new file mode 100644 index 0000000..cd80498 --- /dev/null +++ b/admin/assets/css/help_documents.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage help_documents.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/payment.css b/admin/assets/css/payment.css new file mode 100644 index 0000000..e8ae986 --- /dev/null +++ b/admin/assets/css/payment.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage payment.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/payments.css b/admin/assets/css/payments.css new file mode 100644 index 0000000..174964c --- /dev/null +++ b/admin/assets/css/payments.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage payments.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/images/component-300.jpg b/admin/assets/images/component-300.jpg index eef9785..6bb95af 100644 Binary files a/admin/assets/images/component-300.jpg and b/admin/assets/images/component-300.jpg differ diff --git a/admin/assets/images/icons/clinics.png b/admin/assets/images/icons/clinics.png new file mode 100644 index 0000000..b6fa082 Binary files /dev/null and b/admin/assets/images/icons/clinics.png differ diff --git a/admin/assets/images/icons/help_documents.png b/admin/assets/images/icons/help_documents.png new file mode 100644 index 0000000..bdf2b46 Binary files /dev/null and b/admin/assets/images/icons/help_documents.png differ diff --git a/admin/assets/images/icons/location_add.png b/admin/assets/images/icons/location_add.png deleted file mode 100644 index 8fe539f..0000000 Binary files a/admin/assets/images/icons/location_add.png and /dev/null differ diff --git a/admin/assets/images/icons/payment_add.png b/admin/assets/images/icons/payment_add.png new file mode 100644 index 0000000..51b891c Binary files /dev/null and b/admin/assets/images/icons/payment_add.png differ diff --git a/admin/assets/images/icons/payments.png b/admin/assets/images/icons/payments.png new file mode 100644 index 0000000..9eeab0a Binary files /dev/null and b/admin/assets/images/icons/payments.png differ diff --git a/admin/assets/images/icons/region_add.png b/admin/assets/images/icons/region_add.png deleted file mode 100644 index 7e99d4e..0000000 Binary files a/admin/assets/images/icons/region_add.png and /dev/null differ diff --git a/admin/controller.php b/admin/controller.php index 16500f4..b599c25 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -89,10 +89,13 @@ class SupportgroupsController extends JControllerLegacy { $views = array( 'support_group' => 'support_groups', + 'payment' => 'payments', + 'clinic' => 'clinics', 'location' => 'locations', 'region' => 'regions', + 'country' => 'countries', 'currency' => 'currencies', - 'country' => 'countries' + 'help_document' => 'help_documents' ); // check if this is a list view if (in_array($view,$views)) diff --git a/admin/controllers/clinic.php b/admin/controllers/clinic.php new file mode 100644 index 0000000..dd3a3bd --- /dev/null +++ b/admin/controllers/clinic.php @@ -0,0 +1,326 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controllerform library +jimport('joomla.application.component.controllerform'); + +/** + * Clinic Controller + */ +class SupportgroupsControllerClinic extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + public function __construct($config = array()) + { + $this->view_list = 'Clinics'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Access check. + $access = JFactory::getUser()->authorise('clinic.access', 'com_supportgroups'); + if (!$access) + { + return false; + } + // In the absense of better information, revert to the component permissions. + return JFactory::getUser()->authorise('clinic.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('clinic.access', 'com_supportgroups.clinic.' . (int) $recordId) && $user->authorise('clinic.access', 'com_supportgroups')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('clinic.edit', 'com_supportgroups.clinic.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + if ($user->authorise('clinic.edit.own', 'com_supportgroups.clinic.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('clinic.edit.own', 'com_supportgroups')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('clinic.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 12.2 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + $tmpl = $this->input->get('tmpl'); + $layout = $this->input->get('layout', 'edit', 'string'); + + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // Setup redirect info. + + $append = ''; + + if ($refid) + { + $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + } + elseif ($ref) + { + $append .= '&ref='.(string)$ref; + } + + if ($tmpl) + { + $append .= '&tmpl=' . $tmpl; + } + + if ($layout) + { + $append .= '&layout=' . $layout; + } + + if ($recordId) + { + $append .= '&' . $urlVar . '=' . $recordId; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Clinic', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=clinics' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + $cancel = parent::cancel($key); + + if ($cancel) + { + if ($this->refid) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + } + else + { + // Redirect to the items screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + if ($this->refid && $saved) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref && $saved) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/clinics.php b/admin/controllers/clinics.php new file mode 100644 index 0000000..aec2819 --- /dev/null +++ b/admin/controllers/clinics.php @@ -0,0 +1,111 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controlleradmin library +jimport('joomla.application.component.controlleradmin'); + +/** + * Clinics Controller + */ +class SupportgroupsControllerClinics extends JControllerAdmin +{ + protected $text_prefix = 'COM_SUPPORTGROUPS_CLINICS'; + /** + * Proxy for getModel. + * @since 2.5 + */ + public function getModel($name = 'Clinic', $prefix = 'SupportgroupsModel', $config = array()) + { + $model = parent::getModel($name, $prefix, array('ignore_request' => true)); + + return $model; + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('clinic.export', 'com_supportgroups') && $user->authorise('core.export', 'com_supportgroups')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + JArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Clinics'); + // get the data to export + $data = $model->getExportData($pks); + if (SupportgroupsHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + SupportgroupsHelper::xls($data,'Clinics_'.$date->format('jS_F_Y'),'Clinics exported ('.$date->format('jS F, Y').')','clinics'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SUPPORTGROUPS_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=clinics', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('clinic.import', 'com_supportgroups') && $user->authorise('core.import', 'com_supportgroups')) + { + // Get the import model + $model = $this->getModel('Clinics'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (SupportgroupsHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('clinic_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'clinics'); + $session->set('dataType_VDM_IMPORTINTO', 'clinic'); + // Redirect to import view. + $message = JText::_('COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_CLINICS'); + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SUPPORTGROUPS_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=clinics', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/help.php b/admin/controllers/help.php new file mode 100644 index 0000000..ee529a1 --- /dev/null +++ b/admin/controllers/help.php @@ -0,0 +1,129 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controllerform library +jimport('joomla.application.component.controller'); + +/** + * Supportgroups Help Controller + */ +class SupportgroupsControllerHelp extends JControllerLegacy +{ + public function __construct($config) + { + parent::__construct($config); + // load the tasks + $this->registerTask('getText', 'help'); + } + + public function help() + { + $user = JFactory::getUser(); + $jinput = JFactory::getApplication()->input; + // Check Token! + $token = JSession::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($user->id != 0 && $token == $call_token){ + $task = $this->getTask(); + switch($task){ + case 'getText': + try + { + $idValue = $jinput->get('id', 0, 'INT'); + if($idValue) + { + $result = $this->getHelpDocumentText($idValue); + } + else + { + $result = ''; + } + echo $result; + // stop execution gracefully + jexit(); + } + catch(Exception $e) + { + // stop execution gracefully + jexit(); + } + break; + } + } + else + { + // stop execution gracefully + jexit(); + } + } + + protected function getHelpDocumentText($id) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select(array('a.title','a.content')); + $query->from('#__supportgroups_help_document AS a'); + $query->where('a.id = '.(int) $id); + $query->where('a.published = 1'); + $db->setQuery($query); + $db->execute(); + if($db->getNumRows()) + { + $text = array(); + $document = $db->loadObject(); + // fix image issue + $images['src="images'] = 'src="'.JURI::root().'images'; + $images["src='images"] = "src='".JURI::root()."images"; + $images['src="/images'] = 'src="'.JURI::root().'images'; + $images["src='/images"] = "src='".JURI::root()."images"; + // set document template + $text[] = ""; + $text[] = ''; + $text[] = ""; + $text[] = ''; + $text[] = "".$document->title.""; + $text[] = ''; + $text[] = ''; + $text[] = ""; + $text[] = '
'; + $text[] = '
'; + $text[] = '
'; + // build the help text + $text[] = '

'.$document->title."

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


'; + $text[] = '
'; + $text[] = ""; + $text[] = ""; + + return implode("\n",$text); + } + return false; + } +} diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php new file mode 100644 index 0000000..b7285ac --- /dev/null +++ b/admin/controllers/help_document.php @@ -0,0 +1,326 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controllerform library +jimport('joomla.application.component.controllerform'); + +/** + * Help_document Controller + */ +class SupportgroupsControllerHelp_document extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + public function __construct($config = array()) + { + $this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Access check. + $access = JFactory::getUser()->authorise('help_document.access', 'com_supportgroups'); + if (!$access) + { + return false; + } + // In the absense of better information, revert to the component permissions. + return JFactory::getUser()->authorise('help_document.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('help_document.access', 'com_supportgroups.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_supportgroups')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('help_document.edit', 'com_supportgroups.help_document.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + if ($user->authorise('help_document.edit.own', 'com_supportgroups.help_document.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('help_document.edit.own', 'com_supportgroups')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('help_document.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 12.2 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + $tmpl = $this->input->get('tmpl'); + $layout = $this->input->get('layout', 'edit', 'string'); + + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // Setup redirect info. + + $append = ''; + + if ($refid) + { + $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + } + elseif ($ref) + { + $append .= '&ref='.(string)$ref; + } + + if ($tmpl) + { + $append .= '&tmpl=' . $tmpl; + } + + if ($layout) + { + $append .= '&layout=' . $layout; + } + + if ($recordId) + { + $append .= '&' . $urlVar . '=' . $recordId; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Help_document', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=help_documents' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + $cancel = parent::cancel($key); + + if ($cancel) + { + if ($this->refid) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + } + else + { + // Redirect to the items screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + if ($this->refid && $saved) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref && $saved) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/help_documents.php b/admin/controllers/help_documents.php new file mode 100644 index 0000000..2a587c2 --- /dev/null +++ b/admin/controllers/help_documents.php @@ -0,0 +1,111 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controlleradmin library +jimport('joomla.application.component.controlleradmin'); + +/** + * Help_documents Controller + */ +class SupportgroupsControllerHelp_documents extends JControllerAdmin +{ + protected $text_prefix = 'COM_SUPPORTGROUPS_HELP_DOCUMENTS'; + /** + * Proxy for getModel. + * @since 2.5 + */ + public function getModel($name = 'Help_document', $prefix = 'SupportgroupsModel', $config = array()) + { + $model = parent::getModel($name, $prefix, array('ignore_request' => true)); + + return $model; + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('help_document.export', 'com_supportgroups') && $user->authorise('core.export', 'com_supportgroups')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + JArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Help_documents'); + // get the data to export + $data = $model->getExportData($pks); + if (SupportgroupsHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + SupportgroupsHelper::xls($data,'Help_documents_'.$date->format('jS_F_Y'),'Help documents exported ('.$date->format('jS F, Y').')','help documents'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SUPPORTGROUPS_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=help_documents', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('help_document.import', 'com_supportgroups') && $user->authorise('core.import', 'com_supportgroups')) + { + // Get the import model + $model = $this->getModel('Help_documents'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (SupportgroupsHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('help_document_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'help_documents'); + $session->set('dataType_VDM_IMPORTINTO', 'help_document'); + // Redirect to import view. + $message = JText::_('COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS'); + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SUPPORTGROUPS_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=help_documents', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/location.php b/admin/controllers/location.php index f634921..ece8de7 100644 --- a/admin/controllers/location.php +++ b/admin/controllers/location.php @@ -59,8 +59,15 @@ class SupportgroupsControllerLocation extends JControllerForm * @since 1.6 */ protected function allowAdd($data = array()) - { // In the absense of better information, revert to the component permissions. - return parent::allowAdd($data); + { + // Access check. + $access = JFactory::getUser()->authorise('location.access', 'com_supportgroups'); + if (!$access) + { + return false; + } + // In the absense of better information, revert to the component permissions. + return JFactory::getUser()->authorise('location.create', $this->option); } /** @@ -81,13 +88,20 @@ class SupportgroupsControllerLocation extends JControllerForm $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + // Access check. + $access = ($user->authorise('location.access', 'com_supportgroups.location.' . (int) $recordId) && $user->authorise('location.access', 'com_supportgroups')); + if (!$access) + { + return false; + } + if ($recordId) { // The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit', 'com_supportgroups.location.' . (int) $recordId); + $permission = $user->authorise('location.edit', 'com_supportgroups.location.' . (int) $recordId); if (!$permission && !is_null($permission)) { - if ($user->authorise('core.edit.own', 'com_supportgroups.location.' . $recordId)) + if ($user->authorise('location.edit.own', 'com_supportgroups.location.' . $recordId)) { // Now test the owner is the user. $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; @@ -106,7 +120,7 @@ class SupportgroupsControllerLocation extends JControllerForm // If the owner matches 'me' then allow. if ($ownerId == $user->id) { - if ($user->authorise('core.edit.own', 'com_supportgroups')) + if ($user->authorise('location.edit.own', 'com_supportgroups')) { return true; } @@ -116,7 +130,7 @@ class SupportgroupsControllerLocation extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return parent::allowEdit($data, $key); + return $user->authorise('location.edit', $this->option); } /** diff --git a/admin/controllers/payment.php b/admin/controllers/payment.php new file mode 100644 index 0000000..835c31a --- /dev/null +++ b/admin/controllers/payment.php @@ -0,0 +1,326 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controllerform library +jimport('joomla.application.component.controllerform'); + +/** + * Payment Controller + */ +class SupportgroupsControllerPayment extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + public function __construct($config = array()) + { + $this->view_list = 'Payments'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Access check. + $access = JFactory::getUser()->authorise('payment.access', 'com_supportgroups'); + if (!$access) + { + return false; + } + // In the absense of better information, revert to the component permissions. + return JFactory::getUser()->authorise('payment.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + // Access check. + $access = ($user->authorise('payment.access', 'com_supportgroups.payment.' . (int) $recordId) && $user->authorise('payment.access', 'com_supportgroups')); + if (!$access) + { + return false; + } + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('payment.edit', 'com_supportgroups.payment.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + if ($user->authorise('payment.edit.own', 'com_supportgroups.payment.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('payment.edit.own', 'com_supportgroups')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return $user->authorise('payment.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 12.2 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + $tmpl = $this->input->get('tmpl'); + $layout = $this->input->get('layout', 'edit', 'string'); + + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // Setup redirect info. + + $append = ''; + + if ($refid) + { + $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + } + elseif ($ref) + { + $append .= '&ref='.(string)$ref; + } + + if ($tmpl) + { + $append .= '&tmpl=' . $tmpl; + } + + if ($layout) + { + $append .= '&layout=' . $layout; + } + + if ($recordId) + { + $append .= '&' . $urlVar . '=' . $recordId; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Payment', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=payments' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + $cancel = parent::cancel($key); + + if ($cancel) + { + if ($this->refid) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + } + else + { + // Redirect to the items screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referal details + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + if ($this->ref || $this->refid) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + if ($this->refid && $saved) + { + $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref && $saved) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/payments.php b/admin/controllers/payments.php new file mode 100644 index 0000000..4534087 --- /dev/null +++ b/admin/controllers/payments.php @@ -0,0 +1,111 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controlleradmin library +jimport('joomla.application.component.controlleradmin'); + +/** + * Payments Controller + */ +class SupportgroupsControllerPayments extends JControllerAdmin +{ + protected $text_prefix = 'COM_SUPPORTGROUPS_PAYMENTS'; + /** + * Proxy for getModel. + * @since 2.5 + */ + public function getModel($name = 'Payment', $prefix = 'SupportgroupsModel', $config = array()) + { + $model = parent::getModel($name, $prefix, array('ignore_request' => true)); + + return $model; + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('payment.export', 'com_supportgroups') && $user->authorise('core.export', 'com_supportgroups')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + JArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Payments'); + // get the data to export + $data = $model->getExportData($pks); + if (SupportgroupsHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + SupportgroupsHelper::xls($data,'Payments_'.$date->format('jS_F_Y'),'Payments exported ('.$date->format('jS F, Y').')','payments'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SUPPORTGROUPS_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=payments', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('payment.import', 'com_supportgroups') && $user->authorise('core.import', 'com_supportgroups')) + { + // Get the import model + $model = $this->getModel('Payments'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (SupportgroupsHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('payment_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'payments'); + $session->set('dataType_VDM_IMPORTINTO', 'payment'); + // Redirect to import view. + $message = JText::_('COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_PAYMENTS'); + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_SUPPORTGROUPS_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_supportgroups&view=payments', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/region.php b/admin/controllers/region.php index ca12ca0..c8fddad 100644 --- a/admin/controllers/region.php +++ b/admin/controllers/region.php @@ -59,8 +59,15 @@ class SupportgroupsControllerRegion extends JControllerForm * @since 1.6 */ protected function allowAdd($data = array()) - { // In the absense of better information, revert to the component permissions. - return parent::allowAdd($data); + { + // Access check. + $access = JFactory::getUser()->authorise('region.access', 'com_supportgroups'); + if (!$access) + { + return false; + } + // In the absense of better information, revert to the component permissions. + return JFactory::getUser()->authorise('region.create', $this->option); } /** @@ -81,13 +88,20 @@ class SupportgroupsControllerRegion extends JControllerForm $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + // Access check. + $access = ($user->authorise('region.access', 'com_supportgroups.region.' . (int) $recordId) && $user->authorise('region.access', 'com_supportgroups')); + if (!$access) + { + return false; + } + if ($recordId) { // The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit', 'com_supportgroups.region.' . (int) $recordId); + $permission = $user->authorise('region.edit', 'com_supportgroups.region.' . (int) $recordId); if (!$permission && !is_null($permission)) { - if ($user->authorise('core.edit.own', 'com_supportgroups.region.' . $recordId)) + if ($user->authorise('region.edit.own', 'com_supportgroups.region.' . $recordId)) { // Now test the owner is the user. $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; @@ -106,7 +120,7 @@ class SupportgroupsControllerRegion extends JControllerForm // If the owner matches 'me' then allow. if ($ownerId == $user->id) { - if ($user->authorise('core.edit.own', 'com_supportgroups')) + if ($user->authorise('region.edit.own', 'com_supportgroups')) { return true; } @@ -116,7 +130,7 @@ class SupportgroupsControllerRegion extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return parent::allowEdit($data, $key); + return $user->authorise('region.edit', $this->option); } /** diff --git a/admin/controllers/support_group.php b/admin/controllers/support_group.php index 2a118e5..39d4cb2 100644 --- a/admin/controllers/support_group.php +++ b/admin/controllers/support_group.php @@ -59,8 +59,15 @@ class SupportgroupsControllerSupport_group extends JControllerForm * @since 1.6 */ protected function allowAdd($data = array()) - { // In the absense of better information, revert to the component permissions. - return parent::allowAdd($data); + { + // Access check. + $access = JFactory::getUser()->authorise('support_group.access', 'com_supportgroups'); + if (!$access) + { + return false; + } + // In the absense of better information, revert to the component permissions. + return JFactory::getUser()->authorise('support_group.create', $this->option); } /** @@ -81,13 +88,20 @@ class SupportgroupsControllerSupport_group extends JControllerForm $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + // Access check. + $access = ($user->authorise('support_group.access', 'com_supportgroups.support_group.' . (int) $recordId) && $user->authorise('support_group.access', 'com_supportgroups')); + if (!$access) + { + return false; + } + if ($recordId) { // The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit', 'com_supportgroups.support_group.' . (int) $recordId); + $permission = $user->authorise('support_group.edit', 'com_supportgroups.support_group.' . (int) $recordId); if (!$permission && !is_null($permission)) { - if ($user->authorise('core.edit.own', 'com_supportgroups.support_group.' . $recordId)) + if ($user->authorise('support_group.edit.own', 'com_supportgroups.support_group.' . $recordId)) { // Now test the owner is the user. $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; @@ -106,7 +120,7 @@ class SupportgroupsControllerSupport_group extends JControllerForm // If the owner matches 'me' then allow. if ($ownerId == $user->id) { - if ($user->authorise('core.edit.own', 'com_supportgroups')) + if ($user->authorise('support_group.edit.own', 'com_supportgroups')) { return true; } @@ -116,7 +130,7 @@ class SupportgroupsControllerSupport_group extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return parent::allowEdit($data, $key); + return $user->authorise('support_group.edit', $this->option); } /** diff --git a/admin/helpers/negativefinder.php b/admin/helpers/negativefinder.php new file mode 100644 index 0000000..77c7b04 --- /dev/null +++ b/admin/helpers/negativefinder.php @@ -0,0 +1,67 @@ + +* +**/ + +// No direct access. +defined('_JEXEC') or die; + +/** +* Detecting negative numbers +**/ + +class Expression +{ + protected $expression; + protected $result; + + public function __construct($expression) + { + $this->expression = $expression; + } + + public function evaluate() + { + $this->result = eval("return ".$this->expression.";"); + return $this; + } + + public function getResult() + { + return $this->result; + } +} + +class NegativeFinder +{ + protected $expressionObj; + + public function __construct(Expression $expressionObj) + { + $this->expressionObj = $expressionObj; + } + + + public function isItNegative() + { + $result = $this->expressionObj->evaluate()->getResult(); + + if($this->hasMinusSign($result)) + { + return true; + } + else + { + return false; + } + } + + protected function hasMinusSign($value) + { + return (substr(strval($value), 0, 1) == "-"); + } +} diff --git a/admin/helpers/supportgroups.php b/admin/helpers/supportgroups.php index f0a3959..2e73be0 100644 --- a/admin/helpers/supportgroups.php +++ b/admin/helpers/supportgroups.php @@ -30,7 +30,113 @@ defined('_JEXEC') or die('Restricted access'); * Supportgroups component helper. */ abstract class SupportgroupsHelper -{ +{ + + public static function setCurrency($amount,$support_group) + { + // get the currency id + $currency = self::getCurrency($support_group); + // make money + return self::makeMoney($amount,$currency); + } + + protected static $currency = array(); + + public static function getCurrency($support_group) + { + if (!isset(self::$currency[$support_group])) + { + // get the location + $location = self::getVar('support_group', $support_group, 'id', 'location'); + // get the Region + $region = self::getVar('location', $location, 'id', 'region'); + // get the Country + $country = self::getVar('region', $region, 'id', 'country'); + // get the Currency Codethree + $codethree = self::getVar('country', $country, 'id', 'currency'); + // get currency id + self::$currency[$support_group] = self::getVar('currency', $codethree, 'codethree', 'id'); + } + return self::$currency[$support_group]; + } + + protected static $currencyDetails = array(); + + public static function getCurrencyDetails($id = false) + { + if(is_numeric($id)) + { + if (!isset(self::$currencyDetails[$id])) + { + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + + $query->select($db->quoteName( + array( 'a.id','a.name','a.codethree','a.numericcode','a.symbol','a.thousands','a.decimalplace', + 'a.decimalsymbol','a.positivestyle','a.negativestyle'), + array( 'currency_id','currency_name','currency_codethree','currency_numericcode','currency_symbol', + 'currency_thousands','currency_decimalplace','currency_decimalsymbol','currency_positivestyle', + 'currency_negativestyle'))); + $query->from($db->quoteName('#__supportgroups_currency', 'a')); + $query->where($db->quoteName('id') . ' = '.(int) $id); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + self::$currencyDetails[$id] = $db->loadObject(); + } + else + { + self::$currencyDetails[$id] = false; + } + } + return self::$currencyDetails[$id]; + } + return false; + } + + public static function makeMoney($number,$currency = false) + { + // first check if we have a number + if (is_numeric($number)) + { + // make sure to include the negative finder file + include_once 'negativefinder.php'; + // check if the number is negative + $negativeFinderObj = new NegativeFinder(new Expression("$number")); + $negative = $negativeFinderObj->isItNegative() ? TRUE : FALSE; + } + else + { + throw new Exception('ERROR! ('.$number.') is not a number!'); + } + // setup the currency + $currency = self::getCurrencyDetails($currency); + // set the number to currency + if (self::checkObject($currency)) + { + if (!$negative) + { + $format = $currency->currency_positivestyle; + $sign = '+'; + } + else + { + $format = $currency->currency_negativestyle; + $sign = '-'; + $number = abs($number); + } + $setupNumber = number_format((float)$number, (int)$currency->currency_decimalplace, $currency->currency_decimalsymbol, ' '); //$currency->currency_thousands TODO); + $search = array('{sign}', '{number}', '{symbol}'); + $replace = array($sign, $setupNumber, $currency->currency_symbol); + $moneyMade = str_replace ($search,$replace,$format); + + return $moneyMade; + } + return $number; + } /** * Load the Component xml manifest. **/ @@ -79,11 +185,75 @@ abstract class SupportgroupsHelper } /** - * Can be used to build help urls. + * Load the Component Help URLs. **/ public static function getHelpUrl($view) { + $user = JFactory::getUser(); + $groups = $user->get('groups'); + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url')); + $query->from('#__supportgroups_help_document AS a'); + $query->where('a.admin_view = '.$db->quote($view)); + $query->where('a.location = 1'); + $query->where('a.published = 1'); + $db->setQuery($query); + $db->execute(); + if($db->getNumRows()) + { + $helps = $db->loadObjectList(); + if (self::checkArray($helps)) + { + foreach ($helps as $nr => $help) + { + if ($help->target == 1) + { + $targetgroups = json_decode($help->groups, true); + if (!array_intersect($targetgroups, $groups)) + { + // if user not in those target groups then remove the item + unset($helps[$nr]); + continue; + } + } + // set the return type + switch ($help->type) + { + // set joomla article + case 1: + return self::loadArticleLink($help->article); + break; + // set help text + case 2: + return self::loadHelpTextLink($help->id); + break; + // set Link + case 3: + return $help->url; + break; + } + } + } + } return false; + } + + /** + * Get the Article Link. + **/ + protected static function loadArticleLink($id) + { + return JURI::root().'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal'; + } + + /** + * Get the Help Text Link. + **/ + protected static function loadHelpTextLink($id) + { + $token = JSession::getFormToken(); + return 'index.php?option=com_supportgroups&task=help.getText&id=' . (int) $id . '&token=' . $token; } /** @@ -95,16 +265,37 @@ abstract class SupportgroupsHelper $user = JFactory::getUser(); // load the submenus to sidebar JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_DASHBOARD'), 'index.php?option=com_supportgroups&view=supportgroups', $submenu == 'supportgroups'); - JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_SUPPORT_GROUPS'), 'index.php?option=com_supportgroups&view=support_groups', $submenu == 'support_groups'); - JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_LOCATIONS'), 'index.php?option=com_supportgroups&view=locations', $submenu == 'locations'); - JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_REGIONS'), 'index.php?option=com_supportgroups&view=regions', $submenu == 'regions'); - if ($user->authorise('currency.access', 'com_supportgroups') && $user->authorise('currency.submenu', 'com_supportgroups')) + if ($user->authorise('support_group.access', 'com_supportgroups') && $user->authorise('support_group.submenu', 'com_supportgroups')) { - JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_CURRENCIES'), 'index.php?option=com_supportgroups&view=currencies', $submenu == 'currencies'); + JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_SUPPORT_GROUPS'), 'index.php?option=com_supportgroups&view=support_groups', $submenu == 'support_groups'); + } + if ($user->authorise('payment.access', 'com_supportgroups') && $user->authorise('payment.submenu', 'com_supportgroups')) + { + JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_PAYMENTS'), 'index.php?option=com_supportgroups&view=payments', $submenu == 'payments'); + } + if ($user->authorise('clinic.access', 'com_supportgroups') && $user->authorise('clinic.submenu', 'com_supportgroups')) + { + JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_CLINICS'), 'index.php?option=com_supportgroups&view=clinics', $submenu == 'clinics'); + } + if ($user->authorise('location.access', 'com_supportgroups') && $user->authorise('location.submenu', 'com_supportgroups')) + { + JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_LOCATIONS'), 'index.php?option=com_supportgroups&view=locations', $submenu == 'locations'); + } + if ($user->authorise('region.access', 'com_supportgroups') && $user->authorise('region.submenu', 'com_supportgroups')) + { + JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_REGIONS'), 'index.php?option=com_supportgroups&view=regions', $submenu == 'regions'); } if ($user->authorise('country.access', 'com_supportgroups') && $user->authorise('country.submenu', 'com_supportgroups')) { JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_COUNTRIES'), 'index.php?option=com_supportgroups&view=countries', $submenu == 'countries'); + } + if ($user->authorise('currency.access', 'com_supportgroups') && $user->authorise('currency.submenu', 'com_supportgroups')) + { + JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_CURRENCIES'), 'index.php?option=com_supportgroups&view=currencies', $submenu == 'currencies'); + } + if ($user->authorise('help_document.access', 'com_supportgroups') && $user->authorise('help_document.submenu', 'com_supportgroups')) + { + JHtmlSidebar::addEntry(JText::_('COM_SUPPORTGROUPS_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_supportgroups&view=help_documents', $submenu == 'help_documents'); } } diff --git a/admin/language/en-GB/en-GB.com_supportgroups.ini b/admin/language/en-GB/en-GB.com_supportgroups.ini index 084e2b2..aaa14fe 100644 --- a/admin/language/en-GB/en-GB.com_supportgroups.ini +++ b/admin/language/en-GB/en-GB.com_supportgroups.ini @@ -1,6 +1,88 @@ COM_SUPPORTGROUPS="Support Groups" COM_SUPPORTGROUPS_AUTHOR="Author" COM_SUPPORTGROUPS_BACK="Back" +COM_SUPPORTGROUPS_CLINIC="Clinic" +COM_SUPPORTGROUPS_CLINICS="Clinics" +COM_SUPPORTGROUPS_CLINICS_ACCESS="Clinics Access" +COM_SUPPORTGROUPS_CLINICS_ACCESS_DESC="Allows the users in this group to access access clinics" +COM_SUPPORTGROUPS_CLINICS_BATCH_OPTIONS="Batch process the selected Clinics" +COM_SUPPORTGROUPS_CLINICS_BATCH_TIP="All changes will be applied to all selected Clinics" +COM_SUPPORTGROUPS_CLINICS_BATCH_USE="Clinics Batch Use" +COM_SUPPORTGROUPS_CLINICS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch clinics" +COM_SUPPORTGROUPS_CLINICS_CREATE="Clinics Create" +COM_SUPPORTGROUPS_CLINICS_CREATE_DESC="Allows the users in this group to create create clinics" +COM_SUPPORTGROUPS_CLINICS_DASHBOARD_LIST="Clinics Dashboard List" +COM_SUPPORTGROUPS_CLINICS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the clinic" +COM_SUPPORTGROUPS_CLINICS_DELETE="Clinics Delete" +COM_SUPPORTGROUPS_CLINICS_DELETE_DESC="Allows the users in this group to delete delete clinics" +COM_SUPPORTGROUPS_CLINICS_EDIT="Clinics Edit" +COM_SUPPORTGROUPS_CLINICS_EDIT_CREATED_BY="Clinics Edit Created By" +COM_SUPPORTGROUPS_CLINICS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by clinics" +COM_SUPPORTGROUPS_CLINICS_EDIT_CREATED_DATE="Clinics Edit Created Date" +COM_SUPPORTGROUPS_CLINICS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created clinics" +COM_SUPPORTGROUPS_CLINICS_EDIT_DESC="Allows the users in this group to edit the clinic" +COM_SUPPORTGROUPS_CLINICS_EDIT_NAME="Clinics Edit Name" +COM_SUPPORTGROUPS_CLINICS_EDIT_NAME_DESC="Allows the users in this group to update the edit name of the clinic" +COM_SUPPORTGROUPS_CLINICS_EDIT_NOTE_SET_AREA="Clinics Edit Note Set Area" +COM_SUPPORTGROUPS_CLINICS_EDIT_NOTE_SET_AREA_DESC="Allows the users in this group to update the edit note set area of the clinic" +COM_SUPPORTGROUPS_CLINICS_EDIT_OWN="Clinics Edit Own" +COM_SUPPORTGROUPS_CLINICS_EDIT_OWN_DESC="Allows the users in this group to edit edit own clinics created by them" +COM_SUPPORTGROUPS_CLINICS_EDIT_PHONE="Clinics Edit Phone" +COM_SUPPORTGROUPS_CLINICS_EDIT_PHONE_DESC="Allows the users in this group to update the edit phone of the clinic" +COM_SUPPORTGROUPS_CLINICS_EDIT_STATE="Clinics Edit State" +COM_SUPPORTGROUPS_CLINICS_EDIT_STATE_DESC="Allows the users in this group to update the state of the clinic" +COM_SUPPORTGROUPS_CLINICS_EDIT_VERSION="Clinics Edit Version" +COM_SUPPORTGROUPS_CLINICS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version clinics" +COM_SUPPORTGROUPS_CLINICS_EXPORT="Clinics Export" +COM_SUPPORTGROUPS_CLINICS_EXPORT_DESC="Allows the users in this group to export export clinics" +COM_SUPPORTGROUPS_CLINICS_IMPORT="Clinics Import" +COM_SUPPORTGROUPS_CLINICS_IMPORT_DESC="Allows the users in this group to import import clinics" +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_ARCHIVED="%s Clinics archived." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_ARCHIVED_1="%s Clinic archived." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_CHECKED_IN_0="No Clinic successfully checked in." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_CHECKED_IN_1="%d Clinic successfully checked in." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_CHECKED_IN_MORE="%d Clinics successfully checked in." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_DELETED="%s Clinics deleted." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_DELETED_1="%s Clinic deleted." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_FEATURED="%s Clinics featured." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_FEATURED_1="%s Clinic featured." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_PUBLISHED="%s Clinics published." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_PUBLISHED_1="%s Clinic published." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_TRASHED="%s Clinics trashed." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_TRASHED_1="%s Clinic trashed." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_UNFEATURED="%s Clinics unfeatured." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_UNFEATURED_1="%s Clinic unfeatured." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_UNPUBLISHED="%s Clinics unpublished." +COM_SUPPORTGROUPS_CLINICS_N_ITEMS_UNPUBLISHED_1="%s Clinic unpublished." +COM_SUPPORTGROUPS_CLINICS_SUBMENU="Clinics Submenu" +COM_SUPPORTGROUPS_CLINICS_SUBMENU_DESC="Allows the users in this group to update the submenu of the clinic" +COM_SUPPORTGROUPS_CLINIC_AREA="Area" +COM_SUPPORTGROUPS_CLINIC_CREATED_BY_DESC="The user that created the Clinic." +COM_SUPPORTGROUPS_CLINIC_CREATED_BY_LABEL="Created by" +COM_SUPPORTGROUPS_CLINIC_CREATED_DATE_DESC="The date Clinic was created." +COM_SUPPORTGROUPS_CLINIC_CREATED_DATE_LABEL="Created date" +COM_SUPPORTGROUPS_CLINIC_DETAILS="Details" +COM_SUPPORTGROUPS_CLINIC_EDIT="Editing the Clinic" +COM_SUPPORTGROUPS_CLINIC_ERROR_UNIQUE_ALIAS="Another Clinic has the same alias." +COM_SUPPORTGROUPS_CLINIC_ID="Id" +COM_SUPPORTGROUPS_CLINIC_NAME="Name" +COM_SUPPORTGROUPS_CLINIC_NAME_DESCRIPTION="Enter Name Here" +COM_SUPPORTGROUPS_CLINIC_NAME_HINT="Name Here" +COM_SUPPORTGROUPS_CLINIC_NAME_LABEL="Name" +COM_SUPPORTGROUPS_CLINIC_NEW="A New Clinic" +COM_SUPPORTGROUPS_CLINIC_NOTE_SET_AREA_DESCRIPTION="We will add a map here that the location can be drawn on." +COM_SUPPORTGROUPS_CLINIC_NOTE_SET_AREA_LABEL="Set Location" +COM_SUPPORTGROUPS_CLINIC_ORDERING_LABEL="Ordering" +COM_SUPPORTGROUPS_CLINIC_PERMISSION="Permissions" +COM_SUPPORTGROUPS_CLINIC_PHONE="Phone" +COM_SUPPORTGROUPS_CLINIC_PHONE_DESCRIPTION="The phone number of the contact person." +COM_SUPPORTGROUPS_CLINIC_PHONE_HINT="Phone Number Here!" +COM_SUPPORTGROUPS_CLINIC_PHONE_LABEL="Phone Number" +COM_SUPPORTGROUPS_CLINIC_PUBLISHING="Publishing" +COM_SUPPORTGROUPS_CLINIC_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Clinic to customise the alias." +COM_SUPPORTGROUPS_CLINIC_STATUS="Status" +COM_SUPPORTGROUPS_CLINIC_VERSION_DESC="A count of the number of times this Clinic has been revised." +COM_SUPPORTGROUPS_CLINIC_VERSION_LABEL="Revision" COM_SUPPORTGROUPS_CONFIG_ALMOST_FLAT_LOAD="Almost Flat" COM_SUPPORTGROUPS_CONFIG_AUTHOR="Author Info" COM_SUPPORTGROUPS_CONFIG_AUTHOR_EMAIL_DESC="The email address of the author of this component." @@ -219,12 +301,14 @@ COM_SUPPORTGROUPS_CURRENCY_VERSION_DESC="A count of the number of times this Cur COM_SUPPORTGROUPS_CURRENCY_VERSION_LABEL="Revision" COM_SUPPORTGROUPS_DASH="Dashboard" COM_SUPPORTGROUPS_DASHBOARD="Support Groups Dashboard" +COM_SUPPORTGROUPS_DASHBOARD_CLINICS="Clinics

" COM_SUPPORTGROUPS_DASHBOARD_COUNTRIES="Countries

" COM_SUPPORTGROUPS_DASHBOARD_CURRENCIES="Currencies

" +COM_SUPPORTGROUPS_DASHBOARD_HELP_DOCUMENTS="Help Documents

" COM_SUPPORTGROUPS_DASHBOARD_LOCATIONS="Locations

" -COM_SUPPORTGROUPS_DASHBOARD_LOCATION_ADD="Add Location

" +COM_SUPPORTGROUPS_DASHBOARD_PAYMENTS="Payments

" +COM_SUPPORTGROUPS_DASHBOARD_PAYMENT_ADD="Add Payment

" COM_SUPPORTGROUPS_DASHBOARD_REGIONS="Regions

" -COM_SUPPORTGROUPS_DASHBOARD_REGION_ADD="Add Region

" COM_SUPPORTGROUPS_DASHBOARD_SUPPORT_GROUPS="Support Groups

" COM_SUPPORTGROUPS_DASHBOARD_SUPPORT_GROUP_ADD="Add Support Group

" COM_SUPPORTGROUPS_DATE="Date" @@ -237,6 +321,107 @@ COM_SUPPORTGROUPS_EDIT_VERSIONS_DESC=" Allows users in this group to edit versio COM_SUPPORTGROUPS_EXPORT_DATA="Export Data" COM_SUPPORTGROUPS_EXPORT_DATA_DESC=" Allows users in this group to export data." COM_SUPPORTGROUPS_EXPORT_FAILED="Export Failed" +COM_SUPPORTGROUPS_HELP_DOCUMENT="Help Document" +COM_SUPPORTGROUPS_HELP_DOCUMENTS="Help Documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_ACCESS="Help Documents Access" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group to access access help documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_BATCH_OPTIONS="Batch process the selected Help Documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_BATCH_TIP="All changes will be applied to all selected Help Documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch help documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_CREATE="Help Documents Create" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the help document" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_DELETE="Help Documents Delete" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_DELETE_DESC="Allows the users in this group to delete delete help documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EDIT="Help Documents Edit" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EDIT_DESC="Allows the users in this group to edit the help document" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EDIT_OWN="Help Documents Edit Own" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EDIT_OWN_DESC="Allows the users in this group to edit edit own help documents created by them" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EDIT_STATE="Help Documents Edit State" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the help document" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EDIT_VERSION="Help Documents Edit Version" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version help documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EXPORT="Help Documents Export" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_EXPORT_DESC="Allows the users in this group to export export help documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_IMPORT="Help Documents Import" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_IMPORT_DESC="Allows the users in this group to import import help documents" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_ARCHIVED="%s Help Documents archived." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_ARCHIVED_1="%s Help Document archived." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_CHECKED_IN_0="No Help Document successfully checked in." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_CHECKED_IN_1="%d Help Document successfully checked in." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_CHECKED_IN_MORE="%d Help Documents successfully checked in." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_DELETED="%s Help Documents deleted." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_DELETED_1="%s Help Document deleted." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_FEATURED="%s Help Documents featured." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_FEATURED_1="%s Help Document featured." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_PUBLISHED="%s Help Documents published." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_PUBLISHED_1="%s Help Document published." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_TRASHED="%s Help Documents trashed." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_TRASHED_1="%s Help Document trashed." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_UNFEATURED="%s Help Documents unfeatured." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_UNFEATURED_1="%s Help Document unfeatured." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED="%s Help Documents unpublished." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED_1="%s Help Document unpublished." +COM_SUPPORTGROUPS_HELP_DOCUMENTS_SUBMENU="Help Documents Submenu" +COM_SUPPORTGROUPS_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the help document" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ADMIN="Admin" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ADMIN_VIEW="Admin View" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION="Select the view being targeted" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ADMIN_VIEW_LABEL="Admin Views" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ALIAS="Alias" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ALIAS_HINT="Auto-generated from name" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ALL="All" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ARTICLE="Article" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ARTICLE_LABEL="Article" +COM_SUPPORTGROUPS_HELP_DOCUMENT_CONTENT="Content" +COM_SUPPORTGROUPS_HELP_DOCUMENT_CONTENT_LABEL="Content" +COM_SUPPORTGROUPS_HELP_DOCUMENT_CREATED_BY_DESC="The user that created the Help Document." +COM_SUPPORTGROUPS_HELP_DOCUMENT_CREATED_BY_LABEL="Created by" +COM_SUPPORTGROUPS_HELP_DOCUMENT_CREATED_DATE_DESC="The date Help Document was created." +COM_SUPPORTGROUPS_HELP_DOCUMENT_CREATED_DATE_LABEL="Created date" +COM_SUPPORTGROUPS_HELP_DOCUMENT_DETAILS="Details" +COM_SUPPORTGROUPS_HELP_DOCUMENT_EDIT="Editing the Help Document" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS="Another Help Document has the same alias." +COM_SUPPORTGROUPS_HELP_DOCUMENT_GROUPS="Groups" +COM_SUPPORTGROUPS_HELP_DOCUMENT_GROUPS_DESCRIPTION="Select a group/s" +COM_SUPPORTGROUPS_HELP_DOCUMENT_GROUPS_LABEL="Group/s" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ID="Id" +COM_SUPPORTGROUPS_HELP_DOCUMENT_JOOMLA_ARTICLE="Joomla Article" +COM_SUPPORTGROUPS_HELP_DOCUMENT_LOCATION="Location" +COM_SUPPORTGROUPS_HELP_DOCUMENT_LOCATION_DESCRIPTION="Select the help target location." +COM_SUPPORTGROUPS_HELP_DOCUMENT_LOCATION_LABEL="Location" +COM_SUPPORTGROUPS_HELP_DOCUMENT_NEW="A New Help Document" +COM_SUPPORTGROUPS_HELP_DOCUMENT_NOT_REQUIRED="Not Required" +COM_SUPPORTGROUPS_HELP_DOCUMENT_ORDERING_LABEL="Ordering" +COM_SUPPORTGROUPS_HELP_DOCUMENT_PERMISSION="Permissions" +COM_SUPPORTGROUPS_HELP_DOCUMENT_PUBLISHING="Publishing" +COM_SUPPORTGROUPS_HELP_DOCUMENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Help Document to customise the alias." +COM_SUPPORTGROUPS_HELP_DOCUMENT_SELECT_AN_OPTION="Select an option" +COM_SUPPORTGROUPS_HELP_DOCUMENT_SITE="Site" +COM_SUPPORTGROUPS_HELP_DOCUMENT_SITE_VIEW="Site View" +COM_SUPPORTGROUPS_HELP_DOCUMENT_SITE_VIEW_DESCRIPTION="Select the view being targeted" +COM_SUPPORTGROUPS_HELP_DOCUMENT_SITE_VIEW_LABEL="Site Views" +COM_SUPPORTGROUPS_HELP_DOCUMENT_SOME="Some" +COM_SUPPORTGROUPS_HELP_DOCUMENT_STATUS="Status" +COM_SUPPORTGROUPS_HELP_DOCUMENT_TARGET="Target" +COM_SUPPORTGROUPS_HELP_DOCUMENT_TARGET_DESCRIPTION="Select the target option in relation to groups." +COM_SUPPORTGROUPS_HELP_DOCUMENT_TARGET_LABEL="Target Groups" +COM_SUPPORTGROUPS_HELP_DOCUMENT_TEXT="Text" +COM_SUPPORTGROUPS_HELP_DOCUMENT_TITLE="Title" +COM_SUPPORTGROUPS_HELP_DOCUMENT_TITLE_DESCRIPTION="Enter Title Here" +COM_SUPPORTGROUPS_HELP_DOCUMENT_TITLE_HINT="Title Here" +COM_SUPPORTGROUPS_HELP_DOCUMENT_TITLE_LABEL="Title" +COM_SUPPORTGROUPS_HELP_DOCUMENT_TYPE="Type" +COM_SUPPORTGROUPS_HELP_DOCUMENT_TYPE_DESCRIPTION="Select the help type." +COM_SUPPORTGROUPS_HELP_DOCUMENT_TYPE_LABEL="Type" +COM_SUPPORTGROUPS_HELP_DOCUMENT_URL="Url" +COM_SUPPORTGROUPS_HELP_DOCUMENT_URL_DESCRIPTION="Enter url" +COM_SUPPORTGROUPS_HELP_DOCUMENT_URL_HINT="http://www.example.com" +COM_SUPPORTGROUPS_HELP_DOCUMENT_URL_LABEL="URL" +COM_SUPPORTGROUPS_HELP_DOCUMENT_VERSION_DESC="A count of the number of times this Help Document has been revised." +COM_SUPPORTGROUPS_HELP_DOCUMENT_VERSION_LABEL="Revision" COM_SUPPORTGROUPS_HELP_MANAGER="Help" COM_SUPPORTGROUPS_IMPORT_CONTINUE="Continue" COM_SUPPORTGROUPS_IMPORT_DATA="Import Data" @@ -266,9 +451,12 @@ COM_SUPPORTGROUPS_IMPORT_NO_IMPORT_TYPE_FOUND="Import type not found." COM_SUPPORTGROUPS_IMPORT_PLEASE_SELECT_COLUMN="-- Please Select Column --" COM_SUPPORTGROUPS_IMPORT_SELECT_FILE="Select File" COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_DIRECTORY="Set the path to file" +COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_CLINICS="Select the file to import data to clinics." COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_COUNTRIES="Select the file to import data to countries." COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_CURRENCIES="Select the file to import data to currencies." +COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS="Select the file to import data to help_documents." COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_LOCATIONS="Select the file to import data to locations." +COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_PAYMENTS="Select the file to import data to payments." COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_REGIONS="Select the file to import data to regions." COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_FOR_SUPPORT_GROUPS="Select the file to import data to support_groups." COM_SUPPORTGROUPS_IMPORT_SELECT_FILE_URL="Enter file URL" @@ -284,18 +472,32 @@ COM_SUPPORTGROUPS_KEEP_ORIGINAL_STATE="- Keep Original State -" COM_SUPPORTGROUPS_LICENSE="License" COM_SUPPORTGROUPS_LOCATION="Location" COM_SUPPORTGROUPS_LOCATIONS="Locations" +COM_SUPPORTGROUPS_LOCATIONS_ACCESS="Locations Access" +COM_SUPPORTGROUPS_LOCATIONS_ACCESS_DESC="Allows the users in this group to access access locations" COM_SUPPORTGROUPS_LOCATIONS_BATCH_OPTIONS="Batch process the selected Locations" COM_SUPPORTGROUPS_LOCATIONS_BATCH_TIP="All changes will be applied to all selected Locations" COM_SUPPORTGROUPS_LOCATIONS_BATCH_USE="Locations Batch Use" COM_SUPPORTGROUPS_LOCATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch locations" -COM_SUPPORTGROUPS_LOCATIONS_DASHBOARD_ADD="Locations Dashboard Add" -COM_SUPPORTGROUPS_LOCATIONS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the location" +COM_SUPPORTGROUPS_LOCATIONS_CREATE="Locations Create" +COM_SUPPORTGROUPS_LOCATIONS_CREATE_DESC="Allows the users in this group to create create locations" COM_SUPPORTGROUPS_LOCATIONS_DASHBOARD_LIST="Locations Dashboard List" COM_SUPPORTGROUPS_LOCATIONS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the location" +COM_SUPPORTGROUPS_LOCATIONS_DELETE="Locations Delete" +COM_SUPPORTGROUPS_LOCATIONS_DELETE_DESC="Allows the users in this group to delete delete locations" +COM_SUPPORTGROUPS_LOCATIONS_EDIT="Locations Edit" +COM_SUPPORTGROUPS_LOCATIONS_EDIT_CREATED_BY="Locations Edit Created By" +COM_SUPPORTGROUPS_LOCATIONS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by locations" +COM_SUPPORTGROUPS_LOCATIONS_EDIT_CREATED_DATE="Locations Edit Created Date" +COM_SUPPORTGROUPS_LOCATIONS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created locations" +COM_SUPPORTGROUPS_LOCATIONS_EDIT_DESC="Allows the users in this group to edit the location" COM_SUPPORTGROUPS_LOCATIONS_EDIT_NAME="Locations Edit Name" COM_SUPPORTGROUPS_LOCATIONS_EDIT_NAME_DESC="Allows the users in this group to update the edit name of the location" +COM_SUPPORTGROUPS_LOCATIONS_EDIT_OWN="Locations Edit Own" +COM_SUPPORTGROUPS_LOCATIONS_EDIT_OWN_DESC="Allows the users in this group to edit edit own locations created by them" COM_SUPPORTGROUPS_LOCATIONS_EDIT_REGION="Locations Edit Region" COM_SUPPORTGROUPS_LOCATIONS_EDIT_REGION_DESC="Allows the users in this group to update the edit region of the location" +COM_SUPPORTGROUPS_LOCATIONS_EDIT_STATE="Locations Edit State" +COM_SUPPORTGROUPS_LOCATIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the location" COM_SUPPORTGROUPS_LOCATIONS_EDIT_VERSION="Locations Edit Version" COM_SUPPORTGROUPS_LOCATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version locations" COM_SUPPORTGROUPS_LOCATIONS_EXPORT="Locations Export" @@ -326,7 +528,6 @@ COM_SUPPORTGROUPS_LOCATION_CREATED_BY_DESC="The user that created the Location." COM_SUPPORTGROUPS_LOCATION_CREATED_BY_LABEL="Created by" COM_SUPPORTGROUPS_LOCATION_CREATED_DATE_DESC="The date Location was created." COM_SUPPORTGROUPS_LOCATION_CREATED_DATE_LABEL="Created date" -COM_SUPPORTGROUPS_LOCATION_DETAILS="Details" COM_SUPPORTGROUPS_LOCATION_EDIT="Editing the Location" COM_SUPPORTGROUPS_LOCATION_ERROR_UNIQUE_ALIAS="Another Location has the same alias." COM_SUPPORTGROUPS_LOCATION_ID="Id" @@ -344,25 +545,145 @@ COM_SUPPORTGROUPS_LOCATION_REGION="Region" COM_SUPPORTGROUPS_LOCATION_REGION_DESCRIPTION="Please select the region this location belongs to." COM_SUPPORTGROUPS_LOCATION_REGION_LABEL="Region" COM_SUPPORTGROUPS_LOCATION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Location to customise the alias." +COM_SUPPORTGROUPS_LOCATION_SETTINGS="Settings" COM_SUPPORTGROUPS_LOCATION_STATUS="Status" +COM_SUPPORTGROUPS_LOCATION_SUPPORT_GROUPS="Support Groups" COM_SUPPORTGROUPS_LOCATION_VERSION_DESC="A count of the number of times this Location has been revised." COM_SUPPORTGROUPS_LOCATION_VERSION_LABEL="Revision" COM_SUPPORTGROUPS_NEW="New" COM_SUPPORTGROUPS_NO_ACCESS_GRANTED="No Access Granted!" +COM_SUPPORTGROUPS_PAYMENT="Payment" +COM_SUPPORTGROUPS_PAYMENTS="Payments" +COM_SUPPORTGROUPS_PAYMENTS_ACCESS="Payments Access" +COM_SUPPORTGROUPS_PAYMENTS_ACCESS_DESC="Allows the users in this group to access access payments" +COM_SUPPORTGROUPS_PAYMENTS_BATCH_OPTIONS="Batch process the selected Payments" +COM_SUPPORTGROUPS_PAYMENTS_BATCH_TIP="All changes will be applied to all selected Payments" +COM_SUPPORTGROUPS_PAYMENTS_BATCH_USE="Payments Batch Use" +COM_SUPPORTGROUPS_PAYMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch payments" +COM_SUPPORTGROUPS_PAYMENTS_CREATE="Payments Create" +COM_SUPPORTGROUPS_PAYMENTS_CREATE_DESC="Allows the users in this group to create create payments" +COM_SUPPORTGROUPS_PAYMENTS_DASHBOARD_ADD="Payments Dashboard Add" +COM_SUPPORTGROUPS_PAYMENTS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the payment" +COM_SUPPORTGROUPS_PAYMENTS_DASHBOARD_LIST="Payments Dashboard List" +COM_SUPPORTGROUPS_PAYMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the payment" +COM_SUPPORTGROUPS_PAYMENTS_DELETE="Payments Delete" +COM_SUPPORTGROUPS_PAYMENTS_DELETE_DESC="Allows the users in this group to delete delete payments" +COM_SUPPORTGROUPS_PAYMENTS_EDIT="Payments Edit" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_AMOUNT="Payments Edit Amount" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_AMOUNT_DESC="Allows the users in this group to update the edit amount of the payment" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_CREATED_BY="Payments Edit Created By" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by payments" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_CREATED_DATE="Payments Edit Created Date" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created payments" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_DESC="Allows the users in this group to edit the payment" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_OWN="Payments Edit Own" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_OWN_DESC="Allows the users in this group to edit edit own payments created by them" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_STATE="Payments Edit State" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the payment" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_SUPPORT_GROUP="Payments Edit Support Group" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_SUPPORT_GROUP_DESC="Allows the users in this group to update the edit support group of the payment" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_VERSION="Payments Edit Version" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version payments" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_YEAR="Payments Edit Year" +COM_SUPPORTGROUPS_PAYMENTS_EDIT_YEAR_DESC="Allows the users in this group to update the edit year of the payment" +COM_SUPPORTGROUPS_PAYMENTS_EXPORT="Payments Export" +COM_SUPPORTGROUPS_PAYMENTS_EXPORT_DESC="Allows the users in this group to export export payments" +COM_SUPPORTGROUPS_PAYMENTS_IMPORT="Payments Import" +COM_SUPPORTGROUPS_PAYMENTS_IMPORT_DESC="Allows the users in this group to import import payments" +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_ARCHIVED="%s Payments archived." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_ARCHIVED_1="%s Payment archived." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_CHECKED_IN_0="No Payment successfully checked in." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_CHECKED_IN_1="%d Payment successfully checked in." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_CHECKED_IN_MORE="%d Payments successfully checked in." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_DELETED="%s Payments deleted." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_DELETED_1="%s Payment deleted." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_FEATURED="%s Payments featured." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_FEATURED_1="%s Payment featured." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_PUBLISHED="%s Payments published." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_PUBLISHED_1="%s Payment published." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_TRASHED="%s Payments trashed." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_TRASHED_1="%s Payment trashed." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_UNFEATURED="%s Payments unfeatured." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_UNFEATURED_1="%s Payment unfeatured." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_UNPUBLISHED="%s Payments unpublished." +COM_SUPPORTGROUPS_PAYMENTS_N_ITEMS_UNPUBLISHED_1="%s Payment unpublished." +COM_SUPPORTGROUPS_PAYMENTS_SUBMENU="Payments Submenu" +COM_SUPPORTGROUPS_PAYMENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the payment" +COM_SUPPORTGROUPS_PAYMENT_AMOUNT="Amount" +COM_SUPPORTGROUPS_PAYMENT_AMOUNT_DESCRIPTION="The amount paid in this support group." +COM_SUPPORTGROUPS_PAYMENT_AMOUNT_HINT="Only Numbers & dot" +COM_SUPPORTGROUPS_PAYMENT_AMOUNT_LABEL="Amount" +COM_SUPPORTGROUPS_PAYMENT_CREATED_BY_DESC="The user that created the Payment." +COM_SUPPORTGROUPS_PAYMENT_CREATED_BY_LABEL="Created by" +COM_SUPPORTGROUPS_PAYMENT_CREATED_DATE_DESC="The date Payment was created." +COM_SUPPORTGROUPS_PAYMENT_CREATED_DATE_LABEL="Created date" +COM_SUPPORTGROUPS_PAYMENT_DETAILS="Details" +COM_SUPPORTGROUPS_PAYMENT_EDIT="Editing the Payment" +COM_SUPPORTGROUPS_PAYMENT_ERROR_UNIQUE_ALIAS="Another Payment has the same alias." +COM_SUPPORTGROUPS_PAYMENT_ID="Id" +COM_SUPPORTGROUPS_PAYMENT_NEW="A New Payment" +COM_SUPPORTGROUPS_PAYMENT_ORDERING_LABEL="Ordering" +COM_SUPPORTGROUPS_PAYMENT_PERMISSION="Permissions" +COM_SUPPORTGROUPS_PAYMENT_PUBLISHING="Publishing" +COM_SUPPORTGROUPS_PAYMENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Payment to customise the alias." +COM_SUPPORTGROUPS_PAYMENT_SELECT_A_YEAR="Select a year" +COM_SUPPORTGROUPS_PAYMENT_STATUS="Status" +COM_SUPPORTGROUPS_PAYMENT_SUPPORT_GROUP="Support Group" +COM_SUPPORTGROUPS_PAYMENT_SUPPORT_GROUP_DESCRIPTION="Please select the support group this payment is from." +COM_SUPPORTGROUPS_PAYMENT_SUPPORT_GROUP_LABEL="Support Group" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_EIGHTEEN="2018" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_ELEVEN="2011" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FIFTEEN="2015" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FOURTEEN="2014" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_NINETEEN="2019" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SEVENTEEN="2017" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SIXTEEN="2016" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TEN="2010" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTEEN="2013" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTY="2030" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWELVE="2012" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY="2020" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_EIGHT="2028" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FIVE="2025" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FOUR="2024" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_NINE="2029" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_ONE="2021" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SEVEN="2027" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SIX="2026" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_THREE="2023" +COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_TWO="2022" +COM_SUPPORTGROUPS_PAYMENT_VERSION_DESC="A count of the number of times this Payment has been revised." +COM_SUPPORTGROUPS_PAYMENT_VERSION_LABEL="Revision" +COM_SUPPORTGROUPS_PAYMENT_YEAR="Year" +COM_SUPPORTGROUPS_PAYMENT_YEAR_LABEL="Year" COM_SUPPORTGROUPS_REGION="Region" COM_SUPPORTGROUPS_REGIONS="Regions" +COM_SUPPORTGROUPS_REGIONS_ACCESS="Regions Access" +COM_SUPPORTGROUPS_REGIONS_ACCESS_DESC="Allows the users in this group to access access regions" COM_SUPPORTGROUPS_REGIONS_BATCH_OPTIONS="Batch process the selected Regions" COM_SUPPORTGROUPS_REGIONS_BATCH_TIP="All changes will be applied to all selected Regions" COM_SUPPORTGROUPS_REGIONS_BATCH_USE="Regions Batch Use" COM_SUPPORTGROUPS_REGIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch regions" -COM_SUPPORTGROUPS_REGIONS_DASHBOARD_ADD="Regions Dashboard Add" -COM_SUPPORTGROUPS_REGIONS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the region" +COM_SUPPORTGROUPS_REGIONS_CREATE="Regions Create" +COM_SUPPORTGROUPS_REGIONS_CREATE_DESC="Allows the users in this group to create create regions" COM_SUPPORTGROUPS_REGIONS_DASHBOARD_LIST="Regions Dashboard List" COM_SUPPORTGROUPS_REGIONS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the region" +COM_SUPPORTGROUPS_REGIONS_DELETE="Regions Delete" +COM_SUPPORTGROUPS_REGIONS_DELETE_DESC="Allows the users in this group to delete delete regions" +COM_SUPPORTGROUPS_REGIONS_EDIT="Regions Edit" COM_SUPPORTGROUPS_REGIONS_EDIT_COUNTRY="Regions Edit Country" COM_SUPPORTGROUPS_REGIONS_EDIT_COUNTRY_DESC="Allows the users in this group to update the edit country of the region" +COM_SUPPORTGROUPS_REGIONS_EDIT_CREATED_BY="Regions Edit Created By" +COM_SUPPORTGROUPS_REGIONS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by regions" +COM_SUPPORTGROUPS_REGIONS_EDIT_CREATED_DATE="Regions Edit Created Date" +COM_SUPPORTGROUPS_REGIONS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created regions" +COM_SUPPORTGROUPS_REGIONS_EDIT_DESC="Allows the users in this group to edit the region" COM_SUPPORTGROUPS_REGIONS_EDIT_NAME="Regions Edit Name" COM_SUPPORTGROUPS_REGIONS_EDIT_NAME_DESC="Allows the users in this group to update the edit name of the region" +COM_SUPPORTGROUPS_REGIONS_EDIT_OWN="Regions Edit Own" +COM_SUPPORTGROUPS_REGIONS_EDIT_OWN_DESC="Allows the users in this group to edit edit own regions created by them" +COM_SUPPORTGROUPS_REGIONS_EDIT_STATE="Regions Edit State" +COM_SUPPORTGROUPS_REGIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the region" COM_SUPPORTGROUPS_REGIONS_EDIT_VERSION="Regions Edit Version" COM_SUPPORTGROUPS_REGIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version regions" COM_SUPPORTGROUPS_REGIONS_EXPORT="Regions Export" @@ -395,10 +716,10 @@ COM_SUPPORTGROUPS_REGION_CREATED_BY_DESC="The user that created the Region." COM_SUPPORTGROUPS_REGION_CREATED_BY_LABEL="Created by" COM_SUPPORTGROUPS_REGION_CREATED_DATE_DESC="The date Region was created." COM_SUPPORTGROUPS_REGION_CREATED_DATE_LABEL="Created date" -COM_SUPPORTGROUPS_REGION_DETAILS="Details" COM_SUPPORTGROUPS_REGION_EDIT="Editing the Region" COM_SUPPORTGROUPS_REGION_ERROR_UNIQUE_ALIAS="Another Region has the same alias." COM_SUPPORTGROUPS_REGION_ID="Id" +COM_SUPPORTGROUPS_REGION_LOCATIONS="Locations" COM_SUPPORTGROUPS_REGION_NAME="Name" COM_SUPPORTGROUPS_REGION_NAME_DESCRIPTION="Enter Name Here" COM_SUPPORTGROUPS_REGION_NAME_HINT="Name Here" @@ -408,29 +729,65 @@ COM_SUPPORTGROUPS_REGION_ORDERING_LABEL="Ordering" COM_SUPPORTGROUPS_REGION_PERMISSION="Permissions" COM_SUPPORTGROUPS_REGION_PUBLISHING="Publishing" COM_SUPPORTGROUPS_REGION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Region to customise the alias." +COM_SUPPORTGROUPS_REGION_SETTINGS="Settings" COM_SUPPORTGROUPS_REGION_STATUS="Status" COM_SUPPORTGROUPS_REGION_VERSION_DESC="A count of the number of times this Region has been revised." COM_SUPPORTGROUPS_REGION_VERSION_LABEL="Revision" COM_SUPPORTGROUPS_SAVE_SUCCESS="Great! Item successfully saved." COM_SUPPORTGROUPS_SAVE_WARNING="The value already existed so please select another." +COM_SUPPORTGROUPS_SUBMENU_CLINICS="Clinics" COM_SUPPORTGROUPS_SUBMENU_COUNTRIES="Countries" COM_SUPPORTGROUPS_SUBMENU_CURRENCIES="Currencies" COM_SUPPORTGROUPS_SUBMENU_DASHBOARD="Dashboard" +COM_SUPPORTGROUPS_SUBMENU_HELP_DOCUMENTS="Help Documents" COM_SUPPORTGROUPS_SUBMENU_LOCATIONS="Locations" +COM_SUPPORTGROUPS_SUBMENU_PAYMENTS="Payments" COM_SUPPORTGROUPS_SUBMENU_REGIONS="Regions" COM_SUPPORTGROUPS_SUBMENU_SUPPORT_GROUPS="Support Groups" COM_SUPPORTGROUPS_SUPPORT_GROUP="Support Group" COM_SUPPORTGROUPS_SUPPORT_GROUPS="Support Groups" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_ACCESS="Support Groups Access" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_ACCESS_DESC="Allows the users in this group to access access support groups" COM_SUPPORTGROUPS_SUPPORT_GROUPS_BATCH_OPTIONS="Batch process the selected Support Groups" COM_SUPPORTGROUPS_SUPPORT_GROUPS_BATCH_TIP="All changes will be applied to all selected Support Groups" COM_SUPPORTGROUPS_SUPPORT_GROUPS_BATCH_USE="Support Groups Batch Use" COM_SUPPORTGROUPS_SUPPORT_GROUPS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch support groups" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_CREATE="Support Groups Create" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_CREATE_DESC="Allows the users in this group to create create support groups" COM_SUPPORTGROUPS_SUPPORT_GROUPS_DASHBOARD_ADD="Support Groups Dashboard Add" COM_SUPPORTGROUPS_SUPPORT_GROUPS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the support group" COM_SUPPORTGROUPS_SUPPORT_GROUPS_DASHBOARD_LIST="Support Groups Dashboard List" COM_SUPPORTGROUPS_SUPPORT_GROUPS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_DELETE="Support Groups Delete" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_DELETE_DESC="Allows the users in this group to delete delete support groups" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT="Support Groups Edit" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_CLINIC="Support Groups Edit Clinic" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_CLINIC_DESC="Allows the users in this group to update the edit clinic of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_CREATED_BY="Support Groups Edit Created By" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by support groups" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_CREATED_DATE="Support Groups Edit Created Date" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created support groups" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_DESC="Allows the users in this group to edit the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_FEMALE="Support Groups Edit Female" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_FEMALE_ART="Support Groups Edit Female Art" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_FEMALE_ART_DESC="Allows the users in this group to update the edit female art of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_FEMALE_DESC="Allows the users in this group to update the edit female of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_LOCATION="Support Groups Edit Location" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_LOCATION_DESC="Allows the users in this group to update the edit location of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_MALE="Support Groups Edit Male" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_MALE_ART="Support Groups Edit Male Art" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_MALE_ART_DESC="Allows the users in this group to update the edit male art of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_MALE_CHILDREN="Support Groups Edit Male Children" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_MALE_CHILDREN_DESC="Allows the users in this group to update the edit male children of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_MALE_DESC="Allows the users in this group to update the edit male of the support group" COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_NAME="Support Groups Edit Name" COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_NAME_DESC="Allows the users in this group to update the edit name of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_OWN="Support Groups Edit Own" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_OWN_DESC="Allows the users in this group to edit edit own support groups created by them" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_PHONE="Support Groups Edit Phone" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_PHONE_DESC="Allows the users in this group to update the edit phone of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_STATE="Support Groups Edit State" +COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_STATE_DESC="Allows the users in this group to update the state of the support group" COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_VERSION="Support Groups Edit Version" COM_SUPPORTGROUPS_SUPPORT_GROUPS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version support groups" COM_SUPPORTGROUPS_SUPPORT_GROUPS_EXPORT="Support Groups Export" @@ -456,6 +813,10 @@ COM_SUPPORTGROUPS_SUPPORT_GROUPS_N_ITEMS_UNPUBLISHED="%s Support Groups unpublis COM_SUPPORTGROUPS_SUPPORT_GROUPS_N_ITEMS_UNPUBLISHED_1="%s Support Group unpublished." COM_SUPPORTGROUPS_SUPPORT_GROUPS_SUBMENU="Support Groups Submenu" COM_SUPPORTGROUPS_SUPPORT_GROUPS_SUBMENU_DESC="Allows the users in this group to update the submenu of the support group" +COM_SUPPORTGROUPS_SUPPORT_GROUP_AREA="Area" +COM_SUPPORTGROUPS_SUPPORT_GROUP_CLINIC="Clinic" +COM_SUPPORTGROUPS_SUPPORT_GROUP_CLINIC_DESCRIPTION="Please select the nearest clinic." +COM_SUPPORTGROUPS_SUPPORT_GROUP_CLINIC_LABEL="Clinic" COM_SUPPORTGROUPS_SUPPORT_GROUP_CREATED_BY_DESC="The user that created the Support Group." COM_SUPPORTGROUPS_SUPPORT_GROUP_CREATED_BY_LABEL="Created by" COM_SUPPORTGROUPS_SUPPORT_GROUP_CREATED_DATE_DESC="The date Support Group was created." @@ -463,14 +824,46 @@ COM_SUPPORTGROUPS_SUPPORT_GROUP_CREATED_DATE_LABEL="Created date" COM_SUPPORTGROUPS_SUPPORT_GROUP_DETAILS="Details" COM_SUPPORTGROUPS_SUPPORT_GROUP_EDIT="Editing the Support Group" COM_SUPPORTGROUPS_SUPPORT_GROUP_ERROR_UNIQUE_ALIAS="Another Support Group has the same alias." +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE="Female" +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_ART="Female Art" +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_ART_DESCRIPTION="The number of female members on ART in this support group." +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_ART_HINT="Only Numbers" +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_ART_LABEL="Females on ART" +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_CHILDREN="Female Children" +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_CHILDREN_DESCRIPTION="The number of female members between the age of 5 and 14 years in this support group." +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_CHILDREN_HINT="Only Numbers" +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_CHILDREN_LABEL="Females (5-14)" +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_DESCRIPTION="The number of female members in this support group." +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_HINT="Only Numbers" +COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_LABEL="Females" COM_SUPPORTGROUPS_SUPPORT_GROUP_ID="Id" +COM_SUPPORTGROUPS_SUPPORT_GROUP_LOCATION="Location" +COM_SUPPORTGROUPS_SUPPORT_GROUP_LOCATION_DESCRIPTION="Please select the location this support_group belongs to." +COM_SUPPORTGROUPS_SUPPORT_GROUP_LOCATION_LABEL="Location" +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE="Male" +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_ART="Male Art" +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_ART_DESCRIPTION="The number of male members on ART in this support group." +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_ART_HINT="Only Numbers" +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_ART_LABEL="Males on ART" +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_CHILDREN="Male Children" +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_CHILDREN_DESCRIPTION="The number of male members between the age of 5 and 14 years in this support group." +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_CHILDREN_HINT="Only Numbers" +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_CHILDREN_LABEL="Males (5-14)" +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_DESCRIPTION="The number of male members in this support group." +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_HINT="Only Numbers" +COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_LABEL="Males" COM_SUPPORTGROUPS_SUPPORT_GROUP_NAME="Name" COM_SUPPORTGROUPS_SUPPORT_GROUP_NAME_DESCRIPTION="Enter Name Here" COM_SUPPORTGROUPS_SUPPORT_GROUP_NAME_HINT="Name Here" COM_SUPPORTGROUPS_SUPPORT_GROUP_NAME_LABEL="Name" COM_SUPPORTGROUPS_SUPPORT_GROUP_NEW="A New Support Group" COM_SUPPORTGROUPS_SUPPORT_GROUP_ORDERING_LABEL="Ordering" +COM_SUPPORTGROUPS_SUPPORT_GROUP_PAYMENTS="Payments" COM_SUPPORTGROUPS_SUPPORT_GROUP_PERMISSION="Permissions" +COM_SUPPORTGROUPS_SUPPORT_GROUP_PHONE="Phone" +COM_SUPPORTGROUPS_SUPPORT_GROUP_PHONE_DESCRIPTION="The phone number of the contact person." +COM_SUPPORTGROUPS_SUPPORT_GROUP_PHONE_HINT="Phone Number Here!" +COM_SUPPORTGROUPS_SUPPORT_GROUP_PHONE_LABEL="Phone Number" COM_SUPPORTGROUPS_SUPPORT_GROUP_PUBLISHING="Publishing" COM_SUPPORTGROUPS_SUPPORT_GROUP_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Support Group to customise the alias." COM_SUPPORTGROUPS_SUPPORT_GROUP_STATUS="Status" diff --git a/admin/language/en-GB/en-GB.com_supportgroups.sys.ini b/admin/language/en-GB/en-GB.com_supportgroups.sys.ini index 435ce81..e04ea4b 100644 --- a/admin/language/en-GB/en-GB.com_supportgroups.sys.ini +++ b/admin/language/en-GB/en-GB.com_supportgroups.sys.ini @@ -1,6 +1,8 @@ COM_SUPPORTGROUPS="Support Groups" COM_SUPPORTGROUPS_CONFIGURATION="Support Groups Configuration" COM_SUPPORTGROUPS_MENU="» Support Groups" +COM_SUPPORTGROUPS_MENU_CLINICS="Clinics" COM_SUPPORTGROUPS_MENU_LOCATIONS="Locations" +COM_SUPPORTGROUPS_MENU_PAYMENTS="Payments" COM_SUPPORTGROUPS_MENU_REGIONS="Regions" COM_SUPPORTGROUPS_MENU_SUPPORT_GROUPS="Support Groups" diff --git a/admin/layouts/location/details_above.php b/admin/layouts/clinic/details_above.php similarity index 97% rename from admin/layouts/location/details_above.php rename to admin/layouts/clinic/details_above.php index 27bae13..8d2e998 100644 --- a/admin/layouts/location/details_above.php +++ b/admin/layouts/clinic/details_above.php @@ -31,7 +31,7 @@ $form = $displayData->getForm(); $fields = array( 'name', - 'region' + 'phone' ); ?> diff --git a/admin/layouts/location/details_fullwidth.php b/admin/layouts/clinic/details_fullwidth.php similarity index 96% rename from admin/layouts/location/details_fullwidth.php rename to admin/layouts/clinic/details_fullwidth.php index 884fe77..b11cfea 100644 --- a/admin/layouts/location/details_fullwidth.php +++ b/admin/layouts/clinic/details_fullwidth.php @@ -30,8 +30,7 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'note_set_area', - 'area' + 'note_set_area' ); ?> diff --git a/admin/layouts/clinic/details_under.php b/admin/layouts/clinic/details_under.php new file mode 100644 index 0000000..b5bfe87 --- /dev/null +++ b/admin/layouts/clinic/details_under.php @@ -0,0 +1,41 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'area' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/clinic/index.html b/admin/layouts/clinic/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/clinic/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/clinic/metadata.php b/admin/layouts/clinic/metadata.php new file mode 100644 index 0000000..12c0508 --- /dev/null +++ b/admin/layouts/clinic/metadata.php @@ -0,0 +1,56 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +// JLayout for standard handling of metadata fields in the administrator content edit screens. +$fieldSets = $form->getFieldsets('metadata'); +?> + + $fieldSet) : ?> + description) && trim($fieldSet->description)) : ?> +

escape(JText::_($fieldSet->description)); ?>

+ + + renderField('metadesc'); + echo $form->renderField('metakey'); + } + + foreach ($form->getFieldset($name) as $field) + { + if ($field->name != 'jform[metadata][tags][]') + { + echo $field->renderField(); + } + } ?> + diff --git a/admin/layouts/clinic/publishing.php b/admin/layouts/clinic/publishing.php new file mode 100644 index 0000000..1e9db24 --- /dev/null +++ b/admin/layouts/clinic/publishing.php @@ -0,0 +1,64 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$app = JFactory::getApplication(); +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by', + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/country/regions_fullwidth.php b/admin/layouts/country/regions_fullwidth.php index 72a7d9d..59ece1c 100644 --- a/admin/layouts/country/regions_fullwidth.php +++ b/admin/layouts/country/regions_fullwidth.php @@ -28,7 +28,7 @@ defined('_JEXEC') or die('Restricted access'); // set the defaults -$items = $displayData->vvvregions; +$items = $displayData->vvyregions; $user = JFactory::getUser(); $id = $displayData->item->id; $edit = "index.php?option=com_supportgroups&view=regions&task=region.edit"; @@ -38,7 +38,7 @@ $can = SupportgroupsHelper::getActions('region'); ?>
-get('core.create')): ?> +get('region.create')): ?>

@@ -68,7 +68,7 @@ $can = SupportgroupsHelper::getActions('region'); ?> - get('core.edit')): ?> + get('region.edit')): ?> escape($item->name); ?> checked_out): ?> name, $item->checked_out_time, 'regions.', $canCheckin); ?> diff --git a/admin/layouts/help_document/details_above.php b/admin/layouts/help_document/details_above.php new file mode 100644 index 0000000..9880405 --- /dev/null +++ b/admin/layouts/help_document/details_above.php @@ -0,0 +1,42 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'title', + 'alias' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/help_document/details_fullwidth.php b/admin/layouts/help_document/details_fullwidth.php new file mode 100644 index 0000000..9a2b4cc --- /dev/null +++ b/admin/layouts/help_document/details_fullwidth.php @@ -0,0 +1,48 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'content' +); + +?> +
+ +
+
+ getLabel($field); ?> +
+
+ getInput($field); ?> +
+
+ +
diff --git a/admin/layouts/help_document/details_left.php b/admin/layouts/help_document/details_left.php new file mode 100644 index 0000000..462661a --- /dev/null +++ b/admin/layouts/help_document/details_left.php @@ -0,0 +1,58 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'target', + 'groups', + 'location', + 'admin_view', + 'site_view' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/help_document/details_right.php b/admin/layouts/help_document/details_right.php new file mode 100644 index 0000000..0fc5d0e --- /dev/null +++ b/admin/layouts/help_document/details_right.php @@ -0,0 +1,56 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'type', + 'url', + 'article' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/help_document/details_under.php b/admin/layouts/help_document/details_under.php new file mode 100644 index 0000000..ac835f3 --- /dev/null +++ b/admin/layouts/help_document/details_under.php @@ -0,0 +1,41 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'not_required' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/help_document/index.html b/admin/layouts/help_document/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/help_document/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/help_document/publishing.php b/admin/layouts/help_document/publishing.php new file mode 100644 index 0000000..a8d2a6d --- /dev/null +++ b/admin/layouts/help_document/publishing.php @@ -0,0 +1,58 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$app = JFactory::getApplication(); +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/help_document/publlshing.php b/admin/layouts/help_document/publlshing.php new file mode 100644 index 0000000..a93233d --- /dev/null +++ b/admin/layouts/help_document/publlshing.php @@ -0,0 +1,60 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$app = JFactory::getApplication(); +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/location/settings_above.php b/admin/layouts/location/settings_above.php new file mode 100644 index 0000000..d2fd54d --- /dev/null +++ b/admin/layouts/location/settings_above.php @@ -0,0 +1,42 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'name', + 'region' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/location/settings_fullwidth.php b/admin/layouts/location/settings_fullwidth.php new file mode 100644 index 0000000..a0b76e5 --- /dev/null +++ b/admin/layouts/location/settings_fullwidth.php @@ -0,0 +1,49 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'note_set_area', + 'area' +); + +?> +
+ +
+
+ getLabel($field); ?> +
+
+ getInput($field); ?> +
+
+ +
diff --git a/admin/layouts/location/support_groups_fullwidth.php b/admin/layouts/location/support_groups_fullwidth.php new file mode 100644 index 0000000..ad3a4ee --- /dev/null +++ b/admin/layouts/location/support_groups_fullwidth.php @@ -0,0 +1,155 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +// set the defaults +$items = $displayData->vvwsupport_groups; +$user = JFactory::getUser(); +$id = $displayData->item->id; +$edit = "index.php?option=com_supportgroups&view=support_groups&task=support_group.edit"; +$ref = ($id) ? "&ref=location&refid=".$id : ""; +$new = "index.php?option=com_supportgroups&view=support_group&layout=edit".$ref; +$can = SupportgroupsHelper::getActions('support_group'); + +?> +
+get('support_group.create')): ?> +

+ + + + + + + + + + + + + + + + + $item): ?> + authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = SupportgroupsHelper::getActions('support_group',$item,'support_groups'); + ?> + + + + + + + + published == 1):?> + + published == 0):?> + + published == 2):?> + + published == -2):?> + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ get('support_group.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'support_groups.', $canCheckin); ?> + + +
escape($item->name); ?>
+ +
+ escape($item->phone); ?> + + escape($item->location_name); ?> + + authorise('clinic.edit', 'com_supportgroups.clinic.' . (int)$item->clinic)): ?> + escape($item->clinic_name); ?> + +
escape($item->clinic_name); ?>
+ +
+ escape($item->male); ?> + + escape($item->female); ?> + + + + + + + + + + + + + + + + + + id; ?> +
+ +
+ +
+ +
+ +
diff --git a/admin/layouts/payment/details_above.php b/admin/layouts/payment/details_above.php new file mode 100644 index 0000000..c1d0df5 --- /dev/null +++ b/admin/layouts/payment/details_above.php @@ -0,0 +1,41 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'support_group' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/region/details_left.php b/admin/layouts/payment/details_left.php similarity index 97% rename from admin/layouts/region/details_left.php rename to admin/layouts/payment/details_left.php index dce05e7..78a923d 100644 --- a/admin/layouts/region/details_left.php +++ b/admin/layouts/payment/details_left.php @@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'name' + 'year' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/region/details_right.php b/admin/layouts/payment/details_right.php similarity index 97% rename from admin/layouts/region/details_right.php rename to admin/layouts/payment/details_right.php index 5c07834..16a246f 100644 --- a/admin/layouts/region/details_right.php +++ b/admin/layouts/payment/details_right.php @@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'country' + 'amount' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/payment/index.html b/admin/layouts/payment/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/payment/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/payment/publishing.php b/admin/layouts/payment/publishing.php new file mode 100644 index 0000000..a8d2a6d --- /dev/null +++ b/admin/layouts/payment/publishing.php @@ -0,0 +1,58 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$app = JFactory::getApplication(); +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/payment/publlshing.php b/admin/layouts/payment/publlshing.php new file mode 100644 index 0000000..a93233d --- /dev/null +++ b/admin/layouts/payment/publlshing.php @@ -0,0 +1,60 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$app = JFactory::getApplication(); +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/region/locations_fullwidth.php b/admin/layouts/region/locations_fullwidth.php new file mode 100644 index 0000000..f7d1761 --- /dev/null +++ b/admin/layouts/region/locations_fullwidth.php @@ -0,0 +1,127 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +// set the defaults +$items = $displayData->vvxlocations; +$user = JFactory::getUser(); +$id = $displayData->item->id; +$edit = "index.php?option=com_supportgroups&view=locations&task=location.edit"; +$ref = ($id) ? "&ref=region&refid=".$id : ""; +$new = "index.php?option=com_supportgroups&view=location&layout=edit".$ref; +$can = SupportgroupsHelper::getActions('location'); + +?> +
+get('location.create')): ?> +

+ + + + + + + + + + + + + $item): ?> + authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = SupportgroupsHelper::getActions('location',$item,'locations'); + ?> + + + + published == 1):?> + + published == 0):?> + + published == 2):?> + + published == -2):?> + + + + + + + + + + + +
+ + + + + + + +
+ get('location.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'locations.', $canCheckin); ?> + + +
escape($item->name); ?>
+ +
+ escape($item->region_name); ?> + + + + + + + + + + + + + + + + + + id; ?> +
+ +
+ +
+ +
+ +
diff --git a/admin/layouts/region/settings_left.php b/admin/layouts/region/settings_left.php new file mode 100644 index 0000000..4482cc3 --- /dev/null +++ b/admin/layouts/region/settings_left.php @@ -0,0 +1,54 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'name' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/region/settings_right.php b/admin/layouts/region/settings_right.php new file mode 100644 index 0000000..90edc8b --- /dev/null +++ b/admin/layouts/region/settings_right.php @@ -0,0 +1,54 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'country' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/support_group/details_above.php b/admin/layouts/support_group/details_above.php new file mode 100644 index 0000000..97e976a --- /dev/null +++ b/admin/layouts/support_group/details_above.php @@ -0,0 +1,41 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'name' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/support_group/details_left.php b/admin/layouts/support_group/details_left.php index dce05e7..b25fab4 100644 --- a/admin/layouts/support_group/details_left.php +++ b/admin/layouts/support_group/details_left.php @@ -30,7 +30,9 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'name' + 'phone', + 'location', + 'clinic' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/support_group/details_right.php b/admin/layouts/support_group/details_right.php new file mode 100644 index 0000000..6086b0c --- /dev/null +++ b/admin/layouts/support_group/details_right.php @@ -0,0 +1,59 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'male', + 'male_children', + 'male_art', + 'female', + 'female_children', + 'female_art' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/support_group/details_under.php b/admin/layouts/support_group/details_under.php new file mode 100644 index 0000000..b5bfe87 --- /dev/null +++ b/admin/layouts/support_group/details_under.php @@ -0,0 +1,41 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = array( + 'area' +); + +?> +
+ renderField($field); + } ?> +
diff --git a/admin/layouts/support_group/payments_fullwidth.php b/admin/layouts/support_group/payments_fullwidth.php new file mode 100644 index 0000000..2849ce7 --- /dev/null +++ b/admin/layouts/support_group/payments_fullwidth.php @@ -0,0 +1,133 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +// set the defaults +$items = $displayData->vvvpayments; +$user = JFactory::getUser(); +$id = $displayData->item->id; +$edit = "index.php?option=com_supportgroups&view=payments&task=payment.edit"; +$ref = ($id) ? "&ref=support_group&refid=".$id : ""; +$new = "index.php?option=com_supportgroups&view=payment&layout=edit".$ref; +$can = SupportgroupsHelper::getActions('payment'); + +?> +
+get('payment.create')): ?> +

+ + + + + + + + + + + + + + $item): ?> + authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = SupportgroupsHelper::getActions('payment',$item,'payments'); + ?> + + + + + published == 1):?> + + published == 0):?> + + published == 2):?> + + published == -2):?> + + + + + + + + + + + +
+ + + + + + + + + +
+ get('payment.edit')): ?> + escape($item->support_group_name); ?> + checked_out): ?> + name, $item->checked_out_time, 'payments.', $canCheckin); ?> + + +
escape($item->support_group_name); ?>
+ +
+ year); ?> + + escape($item->amount); ?> + + + + + + + + + + + + + + + + + + id; ?> +
+ +
+ +
+ +
+ +
diff --git a/admin/models/clinic.php b/admin/models/clinic.php new file mode 100644 index 0000000..61659bf --- /dev/null +++ b/admin/models/clinic.php @@ -0,0 +1,888 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla modelform library +jimport('joomla.application.component.modeladmin'); + +/** + * Supportgroups Clinic Model + */ +class SupportgroupsModelClinic extends JModelAdmin +{ + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_SUPPORTGROUPS'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_supportgroups.clinic'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'clinic', $prefix = 'SupportgroupsTable', $config = array()) + { + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_supportgroups.clinic'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true) + { // Get the form. + $form = $this->loadForm('com_supportgroups.clinic', 'clinic', array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('clinic.edit.state', 'com_supportgroups.clinic.' . (int) $id)) + || ($id == 0 && !$user->authorise('clinic.edit.state', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('clinic.edit.created_by', 'com_supportgroups.clinic.' . (int) $id)) + || ($id == 0 && !$user->authorise('clinic.edit.created_by', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('clinic.edit.created', 'com_supportgroups.clinic.' . (int) $id)) + || ($id == 0 && !$user->authorise('clinic.edit.created', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('clinic.edit.name', 'com_supportgroups.clinic.' . (int) $id)) + || ($id == 0 && !$user->authorise('clinic.edit.name', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Phone access controls. + if ($id != 0 && (!$user->authorise('clinic.edit.phone', 'com_supportgroups.clinic.' . (int) $id)) + || ($id == 0 && !$user->authorise('clinic.edit.phone', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('phone', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('phone', 'readonly', 'true'); + if (!$form->getValue('phone')) + { + // Disable fields while saving. + $form->setFieldAttribute('phone', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('phone', 'required', 'false'); + } + } + // Modify the form based on Edit Note Set Area access controls. + if ($id != 0 && (!$user->authorise('clinic.edit.note_set_area', 'com_supportgroups.clinic.' . (int) $id)) + || ($id == 0 && !$user->authorise('clinic.edit.note_set_area', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('note_set_area', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('note_set_area', 'readonly', 'true'); + if (!$form->getValue('note_set_area')) + { + // Disable fields while saving. + $form->setFieldAttribute('note_set_area', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('note_set_area', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected field name + $redirectedField = $jinput->get('ref', null, 'STRING'); + // Set redirected field value + $redirectedValue = $jinput->get('refid', 0, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_supportgroups/models/forms/clinic.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('clinic.delete', 'com_supportgroups.clinic.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('clinic.edit.state', 'com_supportgroups.clinic.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('clinic.edit.state', 'com_supportgroups'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('clinic.edit', 'com_supportgroups.clinic.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('clinic.edit', 'com_supportgroups'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__supportgroups_clinic')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_supportgroups.edit.clinic.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SupportgroupsHelper::getActions('clinic'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SupportgroupsHelper::getActions('clinic'); + } + + if (!$this->canDo->get('clinic.create') && !$this->canDo->get('clinic.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('clinic.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + + if (!$this->user->authorise('clinic.edit', $contexts[$pk])) + + { + + // Not fatal error + + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + + continue; + + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + $this->table->name = $this->generateUniqe('name',$this->table->name); + + // insert all set values + if (SupportgroupsHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (SupportgroupsHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SupportgroupsHelper::getActions('clinic'); + } + + if (!$this->canDo->get('clinic.edit') && !$this->canDo->get('clinic.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('clinic.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('clinic.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (SupportgroupsHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' == $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') == 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (SupportgroupsHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title & alias. + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/clinics.php b/admin/models/clinics.php new file mode 100644 index 0000000..05db89e --- /dev/null +++ b/admin/models/clinics.php @@ -0,0 +1,373 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the Joomla modellist library +jimport('joomla.application.component.modellist'); + +/** + * Clinics Model + */ +class SupportgroupsModelClinics extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.phone','phone' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + $this->setState('filter.name', $name); + + $phone = $this->getUserStateFromRequest($this->context . '.filter.phone', 'filter_phone'); + $this->setState('filter.phone', $phone); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('clinic.access', 'com_supportgroups.clinic.' . (int) $item->id) && $user->authorise('clinic.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the supportgroups_item table + $query->from($db->quoteName('#__supportgroups_clinic', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_supportgroups')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search, true) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.phone LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks) + { + // setup the query + if (SupportgroupsHelper::checkArray($pks)) + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the supportgroups_clinic table + $query->from($db->quoteName('#__supportgroups_clinic', 'a')); + $query->where('a.id IN (' . implode(',',$pks) . ')'); + // Implement View Level Access + if (!$user->authorise('core.options', 'com_supportgroups')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('clinic.access', 'com_supportgroups.clinic.' . (int) $item->id) && $user->authorise('clinic.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (SupportgroupsHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__supportgroups_clinic"); + if (SupportgroupsHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.phone'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_supportgroups')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__supportgroups_clinic')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__supportgroups_clinic'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/country.php b/admin/models/country.php index 1152b1e..51de7b7 100644 --- a/admin/models/country.php +++ b/admin/models/country.php @@ -101,7 +101,7 @@ class SupportgroupsModelCountry extends JModelAdmin $item->tags->getTagIds($item->id, 'com_supportgroups.country'); } } - $this->countryvvvv = $item->id; + $this->countryvvvy = $item->id; return $item; } @@ -111,7 +111,7 @@ class SupportgroupsModelCountry extends JModelAdmin * * @return mixed An array of data items on success, false on failure. */ - public function getVvvregions() + public function getVvyregions() { // Get the user object. $user = JFactory::getUser(); @@ -129,15 +129,15 @@ class SupportgroupsModelCountry extends JModelAdmin $query->select($db->quoteName('g.name','country_name')); $query->join('LEFT', $db->quoteName('#__supportgroups_country', 'g') . ' ON (' . $db->quoteName('a.country') . ' = ' . $db->quoteName('g.id') . ')'); - // Filter by countryvvvv global. - $countryvvvv = $this->countryvvvv; - if (is_numeric($countryvvvv )) + // Filter by countryvvvy global. + $countryvvvy = $this->countryvvvy; + if (is_numeric($countryvvvy )) { - $query->where('a.country = ' . (int) $countryvvvv ); + $query->where('a.country = ' . (int) $countryvvvy ); } - elseif (is_string($countryvvvv)) + elseif (is_string($countryvvvy)) { - $query->where('a.country = ' . $db->quote($countryvvvv)); + $query->where('a.country = ' . $db->quote($countryvvvy)); } else { @@ -168,6 +168,23 @@ class SupportgroupsModelCountry extends JModelAdmin if ($db->getNumRows()) { $items = $db->loadObjectList(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('region.access', 'com_supportgroups.region.' . (int) $item->id) && $user->authorise('region.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } return $items; } return false; diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php new file mode 100644 index 0000000..c87a4b6 --- /dev/null +++ b/admin/models/fields/articles.php @@ -0,0 +1,115 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Articles Form Field class for the Supportgroups component + */ +class JFormFieldArticles extends JFormFieldList +{ + /** + * The articles field type. + * + * @var string + */ + public $type = 'articles'; + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $setButton = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($setButton === 'true') + { + $user = JFactory::getUser(); + // only add if user allowed to create article + if ($user->authorise('core.create', 'com_supportgroups')) + { + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referal if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + } + // build the button + $button = ' + ' . JText::_('COM_SUPPORTGROUPS_NEW') . ''; + // return the button attached to input field + return $html . $button; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + public function getOptions() + { + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias'))); + $query->from($db->quoteName('#__content', 'a')); + $query->where($db->quoteName('a.state') . ' = 1'); + $query->order('a.title ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an Article'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')'); + } + } + return $options; + } +} diff --git a/admin/models/fields/clinics.php b/admin/models/fields/clinics.php new file mode 100644 index 0000000..2b6c368 --- /dev/null +++ b/admin/models/fields/clinics.php @@ -0,0 +1,115 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Clinics Form Field class for the Supportgroups component + */ +class JFormFieldClinics extends JFormFieldList +{ + /** + * The clinics field type. + * + * @var string + */ + public $type = 'clinics'; + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $setButton = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($setButton === 'true') + { + $user = JFactory::getUser(); + // only add if user allowed to create clinic + if ($user->authorise('clinic.create', 'com_supportgroups')) + { + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referal if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + } + // build the button + $button = ' + ' . JText::_('COM_SUPPORTGROUPS_NEW') . ''; + // return the button attached to input field + return $html . $button; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + public function getOptions() + { + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','clinic_name'))); + $query->from($db->quoteName('#__supportgroups_clinic', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select a clinic'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->clinic_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/locations.php b/admin/models/fields/locations.php new file mode 100644 index 0000000..ebf8c45 --- /dev/null +++ b/admin/models/fields/locations.php @@ -0,0 +1,119 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Locations Form Field class for the Supportgroups component + */ +class JFormFieldLocations extends JFormFieldList +{ + /** + * The locations field type. + * + * @var string + */ + public $type = 'locations'; + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $setButton = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($setButton === 'true') + { + $user = JFactory::getUser(); + // only add if user allowed to create location + if ($user->authorise('location.create', 'com_supportgroups')) + { + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referal if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + } + // build the button + $button = ' + ' . JText::_('COM_SUPPORTGROUPS_NEW') . ''; + // return the button attached to input field + return $html . $button; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + public function getOptions() + { + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name','b.name','c.codetwo'),array('id','location_name','region','country'))); + $query->from($db->quoteName('#__supportgroups_location', 'a')); + $query->join('LEFT', '#__supportgroups_region AS b ON b.id = a.region'); + $query->join('LEFT', '#__supportgroups_country AS c ON c.id = b.country'); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('c.codetwo ASC'); + $query->order('b.name ASC'); + $query->order('a.name ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select a location'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->location_name.' ('.$item->region.' - '.$item->country.')'); + } + } + return $options; + } +} diff --git a/admin/models/fields/regions.php b/admin/models/fields/regions.php index 8ccd593..615be0f 100644 --- a/admin/models/fields/regions.php +++ b/admin/models/fields/regions.php @@ -59,7 +59,7 @@ class JFormFieldRegions extends JFormFieldList { $user = JFactory::getUser(); // only add if user allowed to create region - if ($user->authorise('core.create', 'com_supportgroups')) + if ($user->authorise('region.create', 'com_supportgroups')) { // get the input from url $jinput = JFactory::getApplication()->input; diff --git a/admin/models/fields/supportgroups.php b/admin/models/fields/supportgroups.php new file mode 100644 index 0000000..ba25a20 --- /dev/null +++ b/admin/models/fields/supportgroups.php @@ -0,0 +1,115 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Supportgroups Form Field class for the Supportgroups component + */ +class JFormFieldSupportgroups extends JFormFieldList +{ + /** + * The supportgroups field type. + * + * @var string + */ + public $type = 'supportgroups'; + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $setButton = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($setButton === 'true') + { + $user = JFactory::getUser(); + // only add if user allowed to create support_group + if ($user->authorise('support_group.create', 'com_supportgroups')) + { + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referal if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + } + // build the button + $button = ' + ' . JText::_('COM_SUPPORTGROUPS_NEW') . ''; + // return the button attached to input field + return $html . $button; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + public function getOptions() + { + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','support_group_name'))); + $query->from($db->quoteName('#__supportgroups_support_group', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select a support group'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->support_group_name); + } + } + return $options; + } +} diff --git a/admin/models/forms/clinic.js b/admin/models/forms/clinic.js new file mode 100644 index 0000000..27fa76f --- /dev/null +++ b/admin/models/forms/clinic.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage clinic.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/admin/models/forms/clinic.xml b/admin/models/forms/clinic.xml new file mode 100644 index 0000000..59e3e1d --- /dev/null +++ b/admin/models/forms/clinic.xml @@ -0,0 +1,196 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + +
+
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/help_document.js b/admin/models/forms/help_document.js new file mode 100644 index 0000000..3ca519c --- /dev/null +++ b/admin/models/forms/help_document.js @@ -0,0 +1,311 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage help_document.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// Some Global Values +jform_vvvvvvyvvz_required = false; +jform_vvvvvvzvwa_required = false; +jform_vvvvvwavwb_required = false; +jform_vvvvvwbvwc_required = false; + +// Initial Script +jQuery(document).ready(function() +{ + var location_vvvvvvw = jQuery("#jform_location input[type='radio']:checked").val(); + vvvvvvw(location_vvvvvvw); + + var location_vvvvvvx = jQuery("#jform_location input[type='radio']:checked").val(); + vvvvvvx(location_vvvvvvx); + + var type_vvvvvvy = jQuery("#jform_type").val(); + vvvvvvy(type_vvvvvvy); + + var type_vvvvvvz = jQuery("#jform_type").val(); + vvvvvvz(type_vvvvvvz); + + var type_vvvvvwa = jQuery("#jform_type").val(); + vvvvvwa(type_vvvvvwa); + + var target_vvvvvwb = jQuery("#jform_target input[type='radio']:checked").val(); + vvvvvwb(target_vvvvvwb); +}); + +// the vvvvvvw function +function vvvvvvw(location_vvvvvvw) +{ + // set the function logic + if (location_vvvvvvw == 1) + { + jQuery('#jform_admin_view').closest('.control-group').show(); + } + else + { + jQuery('#jform_admin_view').closest('.control-group').hide(); + } +} + +// the vvvvvvx function +function vvvvvvx(location_vvvvvvx) +{ + // set the function logic + if (location_vvvvvvx == 2) + { + jQuery('#jform_site_view').closest('.control-group').show(); + } + else + { + jQuery('#jform_site_view').closest('.control-group').hide(); + } +} + +// the vvvvvvy function +function vvvvvvy(type_vvvvvvy) +{ + if (isSet(type_vvvvvvy) && type_vvvvvvy.constructor !== Array) + { + var temp_vvvvvvy = type_vvvvvvy; + var type_vvvvvvy = []; + type_vvvvvvy.push(temp_vvvvvvy); + } + else if (!isSet(type_vvvvvvy)) + { + var type_vvvvvvy = []; + } + var type = type_vvvvvvy.some(type_vvvvvvy_SomeFunc); + + + // set this function logic + if (type) + { + jQuery('#jform_url').closest('.control-group').show(); + if (jform_vvvvvvyvvz_required) + { + updateFieldRequired('url',0); + jQuery('#jform_url').prop('required','required'); + jQuery('#jform_url').attr('aria-required',true); + jQuery('#jform_url').addClass('required'); + jform_vvvvvvyvvz_required = false; + } + + } + else + { + jQuery('#jform_url').closest('.control-group').hide(); + if (!jform_vvvvvvyvvz_required) + { + updateFieldRequired('url',1); + jQuery('#jform_url').removeAttr('required'); + jQuery('#jform_url').removeAttr('aria-required'); + jQuery('#jform_url').removeClass('required'); + jform_vvvvvvyvvz_required = true; + } + } +} + +// the vvvvvvy Some function +function type_vvvvvvy_SomeFunc(type_vvvvvvy) +{ + // set the function logic + if (type_vvvvvvy == 3) + { + return true; + } + return false; +} + +// the vvvvvvz function +function vvvvvvz(type_vvvvvvz) +{ + if (isSet(type_vvvvvvz) && type_vvvvvvz.constructor !== Array) + { + var temp_vvvvvvz = type_vvvvvvz; + var type_vvvvvvz = []; + type_vvvvvvz.push(temp_vvvvvvz); + } + else if (!isSet(type_vvvvvvz)) + { + var type_vvvvvvz = []; + } + var type = type_vvvvvvz.some(type_vvvvvvz_SomeFunc); + + + // set this function logic + if (type) + { + jQuery('#jform_article').closest('.control-group').show(); + if (jform_vvvvvvzvwa_required) + { + updateFieldRequired('article',0); + jQuery('#jform_article').prop('required','required'); + jQuery('#jform_article').attr('aria-required',true); + jQuery('#jform_article').addClass('required'); + jform_vvvvvvzvwa_required = false; + } + + } + else + { + jQuery('#jform_article').closest('.control-group').hide(); + if (!jform_vvvvvvzvwa_required) + { + updateFieldRequired('article',1); + jQuery('#jform_article').removeAttr('required'); + jQuery('#jform_article').removeAttr('aria-required'); + jQuery('#jform_article').removeClass('required'); + jform_vvvvvvzvwa_required = true; + } + } +} + +// the vvvvvvz Some function +function type_vvvvvvz_SomeFunc(type_vvvvvvz) +{ + // set the function logic + if (type_vvvvvvz == 1) + { + return true; + } + return false; +} + +// the vvvvvwa function +function vvvvvwa(type_vvvvvwa) +{ + if (isSet(type_vvvvvwa) && type_vvvvvwa.constructor !== Array) + { + var temp_vvvvvwa = type_vvvvvwa; + var type_vvvvvwa = []; + type_vvvvvwa.push(temp_vvvvvwa); + } + else if (!isSet(type_vvvvvwa)) + { + var type_vvvvvwa = []; + } + var type = type_vvvvvwa.some(type_vvvvvwa_SomeFunc); + + + // set this function logic + if (type) + { + jQuery('#jform_content-lbl').closest('.control-group').show(); + if (jform_vvvvvwavwb_required) + { + updateFieldRequired('content',0); + jQuery('#jform_content').prop('required','required'); + jQuery('#jform_content').attr('aria-required',true); + jQuery('#jform_content').addClass('required'); + jform_vvvvvwavwb_required = false; + } + + } + else + { + jQuery('#jform_content-lbl').closest('.control-group').hide(); + if (!jform_vvvvvwavwb_required) + { + updateFieldRequired('content',1); + jQuery('#jform_content').removeAttr('required'); + jQuery('#jform_content').removeAttr('aria-required'); + jQuery('#jform_content').removeClass('required'); + jform_vvvvvwavwb_required = true; + } + } +} + +// the vvvvvwa Some function +function type_vvvvvwa_SomeFunc(type_vvvvvwa) +{ + // set the function logic + if (type_vvvvvwa == 2) + { + return true; + } + return false; +} + +// the vvvvvwb function +function vvvvvwb(target_vvvvvwb) +{ + // set the function logic + if (target_vvvvvwb == 1) + { + jQuery('#jform_groups').closest('.control-group').show(); + if (jform_vvvvvwbvwc_required) + { + updateFieldRequired('groups',0); + jQuery('#jform_groups').prop('required','required'); + jQuery('#jform_groups').attr('aria-required',true); + jQuery('#jform_groups').addClass('required'); + jform_vvvvvwbvwc_required = false; + } + + } + else + { + jQuery('#jform_groups').closest('.control-group').hide(); + if (!jform_vvvvvwbvwc_required) + { + updateFieldRequired('groups',1); + jQuery('#jform_groups').removeAttr('required'); + jQuery('#jform_groups').removeAttr('aria-required'); + jQuery('#jform_groups').removeClass('required'); + jform_vvvvvwbvwc_required = true; + } + } +} + +// update required fields +function updateFieldRequired(name,status) +{ + var not_required = jQuery('#jform_not_required').val(); + + if(status == 1) + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required+','+name; + } + else + { + not_required = ','+name; + } + } + else + { + if (isSet(not_required) && not_required != 0) + { + not_required = not_required.replace(','+name,''); + } + } + + jQuery('#jform_not_required').val(not_required); +} + +// the isSet function +function isSet(val) +{ + if ((val != undefined) && (val != null) && 0 !== val.length){ + return true; + } + return false; +} diff --git a/admin/models/forms/help_document.xml b/admin/models/forms/help_document.xml new file mode 100644 index 0000000..ef2c63b --- /dev/null +++ b/admin/models/forms/help_document.xml @@ -0,0 +1,253 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/location.xml b/admin/models/forms/location.xml index 2350a18..16853c5 100644 --- a/admin/models/forms/location.xml +++ b/admin/models/forms/location.xml @@ -126,6 +126,7 @@ description="COM_SUPPORTGROUPS_LOCATION_REGION_DESCRIPTION" class="list_class" multiple="false" + required="true" button="true" /> diff --git a/admin/models/forms/payment.js b/admin/models/forms/payment.js new file mode 100644 index 0000000..5bcef89 --- /dev/null +++ b/admin/models/forms/payment.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage payment.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/admin/models/forms/payment.xml b/admin/models/forms/payment.xml new file mode 100644 index 0000000..80e889b --- /dev/null +++ b/admin/models/forms/payment.xml @@ -0,0 +1,190 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/region.xml b/admin/models/forms/region.xml index a8307cf..5a0fe22 100644 --- a/admin/models/forms/region.xml +++ b/admin/models/forms/region.xml @@ -126,6 +126,7 @@ description="COM_SUPPORTGROUPS_REGION_COUNTRY_DESCRIPTION" class="list_class" multiple="false" + required="true" button="false" /> diff --git a/admin/models/forms/support_group.xml b/admin/models/forms/support_group.xml index c002ee7..fdfdf7d 100644 --- a/admin/models/forms/support_group.xml +++ b/admin/models/forms/support_group.xml @@ -118,6 +118,133 @@ message="Error! Please add name here." hint="COM_SUPPORTGROUPS_SUPPORT_GROUP_NAME_HINT" /> + + + + + + + + + + + + + + + + + + + + diff --git a/admin/models/help_document.php b/admin/models/help_document.php new file mode 100644 index 0000000..e5d4055 --- /dev/null +++ b/admin/models/help_document.php @@ -0,0 +1,942 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla modelform library +jimport('joomla.application.component.modeladmin'); + +/** + * Supportgroups Help_document Model + */ +class SupportgroupsModelHelp_document extends JModelAdmin +{ + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_SUPPORTGROUPS'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_supportgroups.help_document'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'help_document', $prefix = 'SupportgroupsTable', $config = array()) + { + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->groups)) + { + // JSON Decode groups. + $item->groups = json_decode($item->groups,true); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_supportgroups.help_document'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true) + { // Get the form. + $form = $this->loadForm('com_supportgroups.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('help_document.edit.state', 'com_supportgroups.help_document.' . (int) $id)) + || ($id == 0 && !$user->authorise('help_document.edit.state', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_supportgroups')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_supportgroups')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected field name + $redirectedField = $jinput->get('ref', null, 'STRING'); + // Set redirected field value + $redirectedValue = $jinput->get('refid', 0, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_supportgroups/models/forms/help_document.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('help_document.delete', 'com_supportgroups.help_document.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('help_document.edit.state', 'com_supportgroups.help_document.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('help_document.edit.state', 'com_supportgroups'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('help_document.edit', 'com_supportgroups.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_supportgroups'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__supportgroups_help_document')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_supportgroups.edit.help_document.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to validate the form data. + * + * @param JForm $form The form to validate against. + * @param array $data The data to validate. + * @param string $group The name of the field group to validate. + * + * @return mixed Array of filtered data if valid, false otherwise. + * + * @see JFormRule + * @see JFilterInput + * @since 12.2 + */ + public function validate($form, $data, $group = null) + { + // check if the not_required field is set + if (SupportgroupsHelper::checkString($data['not_required'])) + { + $requiredFields = (array) explode(',',(string) $data['not_required']); + $requiredFields = array_unique($requiredFields); + // now change the required field attributes value + foreach ($requiredFields as $requiredField) + { + // make sure there is a string value + if (SupportgroupsHelper::checkString($requiredField)) + { + // change to false + $form->setFieldAttribute($requiredField, 'required', 'false'); + // also clear the data set + $data[$requiredField] = ''; + } + } + } + return parent::validate($form, $data, $group); + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SupportgroupsHelper::getActions('help_document'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SupportgroupsHelper::getActions('help_document'); + } + + if (!$this->canDo->get('help_document.create') && !$this->canDo->get('help_document.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('help_document.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + + if (!$this->user->authorise('help_document.edit', $contexts[$pk])) + + { + + // Not fatal error + + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + + continue; + + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + list($this->table->title, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->title); + + // insert all set values + if (SupportgroupsHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (SupportgroupsHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SupportgroupsHelper::getActions('help_document'); + } + + if (!$this->canDo->get('help_document.edit') && !$this->canDo->get('help_document.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('help_document.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('help_document.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (SupportgroupsHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' == $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the groups string to JSON string. + if (isset($data['groups'])) + { + $data['groups'] = (string) json_encode($data['groups']); + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the title for save as copy + if ($input->get('task') == 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['title'] == $origTable->title) + { + list($title, $alias) = $this->_generateNewTitle($data['alias'], $data['title']); + $data['title'] = $title; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['title']); + } + + $table = JTable::getInstance('help_document', 'supportgroupsTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_SAVE_WARNING'); + } + + list($title, $alias) = $this->_generateNewTitle($data['alias'], $data['title']); + $data['alias'] = $alias; + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the uniqe field for save as copy + if ($input->get('task') == 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (SupportgroupsHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title & alias. + * + * @param string $alias The alias. + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($alias, $title) + { + + // Alter the title & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + $title = JString::increment($title); + $alias = JString::increment($alias, 'dash'); + } + + return array($title, $alias); + } +} diff --git a/admin/models/help_documents.php b/admin/models/help_documents.php new file mode 100644 index 0000000..a9ab8ac --- /dev/null +++ b/admin/models/help_documents.php @@ -0,0 +1,479 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the Joomla modellist library +jimport('joomla.application.component.modellist'); + +/** + * Help_documents Model + */ +class SupportgroupsModelHelp_documents extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.title','title', + 'a.type','type', + 'a.location','location', + 'a.admin_view','admin_view', + 'a.site_view','site_view' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $title = $this->getUserStateFromRequest($this->context . '.filter.title', 'filter_title'); + $this->setState('filter.title', $title); + + $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); + $this->setState('filter.type', $type); + + $location = $this->getUserStateFromRequest($this->context . '.filter.location', 'filter_location'); + $this->setState('filter.location', $location); + + $admin_view = $this->getUserStateFromRequest($this->context . '.filter.admin_view', 'filter_admin_view'); + $this->setState('filter.admin_view', $admin_view); + + $site_view = $this->getUserStateFromRequest($this->context . '.filter.site_view', 'filter_site_view'); + $this->setState('filter.site_view', $site_view); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('help_document.access', 'com_supportgroups.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + // decode groups + $groupsArray = json_decode($item->groups, true); + if (SupportgroupsHelper::checkArray($groupsArray)) + { + $groupsNames = ''; + $counter = 0; + foreach ($groupsArray as $groups) + { + if ($counter == 0) + { + $groupsNames .= SupportgroupsHelper::getGroupName($groups); + } + else + { + $groupsNames .= ', '.SupportgroupsHelper::getGroupName($groups); + } + $counter++; + } + $item->groups = $groupsNames; + } + } + } + + // set selection value to a translatable value + if (SupportgroupsHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert type + $item->type = $this->selectionTranslation($item->type, 'type'); + // convert location + $item->location = $this->selectionTranslation($item->location, 'location'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of type language strings + if ($name == 'type') + { + $typeArray = array( + 0 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_SELECT_AN_OPTION', + 1 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_JOOMLA_ARTICLE', + 2 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_TEXT', + 3 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_URL' + ); + // Now check if value is found in this array + if (isset($typeArray[$value]) && SupportgroupsHelper::checkString($typeArray[$value])) + { + return $typeArray[$value]; + } + } + // Array of location language strings + if ($name == 'location') + { + $locationArray = array( + 1 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_ADMIN', + 2 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_SITE' + ); + // Now check if value is found in this array + if (isset($locationArray[$value]) && SupportgroupsHelper::checkString($locationArray[$value])) + { + return $locationArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the supportgroups_item table + $query->from($db->quoteName('#__supportgroups_help_document', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_supportgroups')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search, true) . '%'); + $query->where('(a.title LIKE '.$search.' OR a.type LIKE '.$search.' OR a.location LIKE '.$search.' OR a.admin_view LIKE '.$search.' OR a.site_view LIKE '.$search.')'); + } + } + + // Filter by Type. + if ($type = $this->getState('filter.type')) + { + $query->where('a.type = ' . $db->quote($db->escape($type, true))); + } + // Filter by Location. + if ($location = $this->getState('filter.location')) + { + $query->where('a.location = ' . $db->quote($db->escape($location, true))); + } + // Filter by Admin_view. + if ($admin_view = $this->getState('filter.admin_view')) + { + $query->where('a.admin_view = ' . $db->quote($db->escape($admin_view, true))); + } + // Filter by Site_view. + if ($site_view = $this->getState('filter.site_view')) + { + $query->where('a.site_view = ' . $db->quote($db->escape($site_view, true))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks) + { + // setup the query + if (SupportgroupsHelper::checkArray($pks)) + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the supportgroups_help_document table + $query->from($db->quoteName('#__supportgroups_help_document', 'a')); + $query->where('a.id IN (' . implode(',',$pks) . ')'); + // Implement View Level Access + if (!$user->authorise('core.options', 'com_supportgroups')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('help_document.access', 'com_supportgroups.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (SupportgroupsHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__supportgroups_help_document"); + if (SupportgroupsHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.title'); + $id .= ':' . $this->getState('filter.type'); + $id .= ':' . $this->getState('filter.location'); + $id .= ':' . $this->getState('filter.admin_view'); + $id .= ':' . $this->getState('filter.site_view'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_supportgroups')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__supportgroups_help_document')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__supportgroups_help_document'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/location.php b/admin/models/location.php index 5b33a15..ed35ded 100644 --- a/admin/models/location.php +++ b/admin/models/location.php @@ -100,9 +100,98 @@ class SupportgroupsModelLocation extends JModelAdmin $item->tags = new JHelperTags; $item->tags->getTagIds($item->id, 'com_supportgroups.location'); } - } + } + $this->locationvvvw = $item->id; return $item; + } + + /** + * Method to get list data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getVvwsupport_groups() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the supportgroups_support_group table + $query->from($db->quoteName('#__supportgroups_support_group', 'a')); + + // From the supportgroups_location table. + $query->select($db->quoteName('g.name','location_name')); + $query->join('LEFT', $db->quoteName('#__supportgroups_location', 'g') . ' ON (' . $db->quoteName('a.location') . ' = ' . $db->quoteName('g.id') . ')'); + + // From the supportgroups_clinic table. + $query->select($db->quoteName('h.name','clinic_name')); + $query->join('LEFT', $db->quoteName('#__supportgroups_clinic', 'h') . ' ON (' . $db->quoteName('a.clinic') . ' = ' . $db->quoteName('h.id') . ')'); + + // Filter by locationvvvw global. + $locationvvvw = $this->locationvvvw; + if (is_numeric($locationvvvw )) + { + $query->where('a.location = ' . (int) $locationvvvw ); + } + elseif (is_string($locationvvvw)) + { + $query->where('a.location = ' . $db->quote($locationvvvw)); + } + else + { + $query->where('a.location = -5'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_supportgroups')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('support_group.access', 'com_supportgroups.support_group.' . (int) $item->id) && $user->authorise('support_group.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + return $items; + } + return false; } /** @@ -141,8 +230,8 @@ class SupportgroupsModelLocation extends JModelAdmin // Check for existing item. // Modify the form based on Edit State access controls. - if ($id != 0 && (!$user->authorise('core.edit.state', 'com_supportgroups.location.' . (int) $id)) - || ($id == 0 && !$user->authorise('core.edit.state', 'com_supportgroups'))) + if ($id != 0 && (!$user->authorise('location.edit.state', 'com_supportgroups.location.' . (int) $id)) + || ($id == 0 && !$user->authorise('location.edit.state', 'com_supportgroups'))) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); @@ -158,7 +247,8 @@ class SupportgroupsModelLocation extends JModelAdmin $form->setValue('created_by', null, $user->id); } // Modify the form based on Edit Creaded By access controls. - if (!$user->authorise('core.edit.created_by', 'com_supportgroups')) + if ($id != 0 && (!$user->authorise('location.edit.created_by', 'com_supportgroups.location.' . (int) $id)) + || ($id == 0 && !$user->authorise('location.edit.created_by', 'com_supportgroups'))) { // Disable fields for display. $form->setFieldAttribute('created_by', 'disabled', 'true'); @@ -168,7 +258,8 @@ class SupportgroupsModelLocation extends JModelAdmin $form->setFieldAttribute('created_by', 'filter', 'unset'); } // Modify the form based on Edit Creaded Date access controls. - if (!$user->authorise('core.edit.created', 'com_supportgroups')) + if ($id != 0 && (!$user->authorise('location.edit.created', 'com_supportgroups.location.' . (int) $id)) + || ($id == 0 && !$user->authorise('location.edit.created', 'com_supportgroups'))) { // Disable fields for display. $form->setFieldAttribute('created', 'disabled', 'true'); @@ -254,7 +345,7 @@ class SupportgroupsModelLocation extends JModelAdmin $user = JFactory::getUser(); // The record has been set. Check the record permissions. - return $user->authorise('core.delete', 'com_supportgroups.location.' . (int) $record->id); + return $user->authorise('location.delete', 'com_supportgroups.location.' . (int) $record->id); } return false; } @@ -276,14 +367,14 @@ class SupportgroupsModelLocation extends JModelAdmin if ($recordId) { // The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit.state', 'com_supportgroups.location.' . (int) $recordId); + $permission = $user->authorise('location.edit.state', 'com_supportgroups.location.' . (int) $recordId); if (!$permission && !is_null($permission)) { return false; } } // In the absense of better information, revert to the component permissions. - return parent::canEditState($record); + return $user->authorise('location.edit.state', 'com_supportgroups'); } /** @@ -298,8 +389,9 @@ class SupportgroupsModelLocation extends JModelAdmin protected function allowEdit($data = array(), $key = 'id') { // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); - return JFactory::getUser()->authorise('core.edit', 'com_supportgroups.location.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + return $user->authorise('location.edit', 'com_supportgroups.location.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('location.edit', 'com_supportgroups'); } /** @@ -531,7 +623,7 @@ class SupportgroupsModelLocation extends JModelAdmin $this->canDo = SupportgroupsHelper::getActions('location'); } - if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + if (!$this->canDo->get('location.create') && !$this->canDo->get('location.batch')) { return false; } @@ -546,7 +638,7 @@ class SupportgroupsModelLocation extends JModelAdmin { $values['published'] = 0; } - elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + elseif (isset($values['published']) && !$this->canDo->get('location.edit.state')) { $values['published'] = 0; } @@ -563,7 +655,7 @@ class SupportgroupsModelLocation extends JModelAdmin // only allow copy if user may edit this item. - if (!$this->user->authorise('core.edit', $contexts[$pk])) + if (!$this->user->authorise('location.edit', $contexts[$pk])) { @@ -680,14 +772,14 @@ class SupportgroupsModelLocation extends JModelAdmin $this->canDo = SupportgroupsHelper::getActions('location'); } - if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + if (!$this->canDo->get('location.edit') && !$this->canDo->get('location.batch')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } // make sure published only updates if user has the permission. - if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + if (isset($values['published']) && !$this->canDo->get('location.edit.state')) { unset($values['published']); } @@ -697,7 +789,7 @@ class SupportgroupsModelLocation extends JModelAdmin // Parent exists so we proceed foreach ($pks as $pk) { - if (!$this->user->authorise('core.edit', $contexts[$pk])) + if (!$this->user->authorise('location.edit', $contexts[$pk])) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); diff --git a/admin/models/locations.php b/admin/models/locations.php index 367adab..36aa57a 100644 --- a/admin/models/locations.php +++ b/admin/models/locations.php @@ -105,7 +105,24 @@ class SupportgroupsModelLocations extends JModelList $this->checkInNow(); // load parent items - $items = parent::getItems(); + $items = parent::getItems(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('location.access', 'com_supportgroups.location.' . (int) $item->id) && $user->authorise('location.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } // return items return $items; @@ -233,8 +250,17 @@ class SupportgroupsModelLocations extends JModelList // set values to display correctly. if (SupportgroupsHelper::checkArray($items)) { + // get user object. + $user = JFactory::getUser(); foreach ($items as $nr => &$item) { + $access = ($user->authorise('location.access', 'com_supportgroups.location.' . (int) $item->id) && $user->authorise('location.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); diff --git a/admin/models/payment.php b/admin/models/payment.php new file mode 100644 index 0000000..bc123e2 --- /dev/null +++ b/admin/models/payment.php @@ -0,0 +1,888 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla modelform library +jimport('joomla.application.component.modeladmin'); + +/** + * Supportgroups Payment Model + */ +class SupportgroupsModelPayment extends JModelAdmin +{ + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_SUPPORTGROUPS'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_supportgroups.payment'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'payment', $prefix = 'SupportgroupsTable', $config = array()) + { + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_supportgroups.payment'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true) + { // Get the form. + $form = $this->loadForm('com_supportgroups.payment', 'payment', array('control' => 'jform', 'load_data' => $loadData)); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('payment.edit.state', 'com_supportgroups.payment.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment.edit.state', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if ($id != 0 && (!$user->authorise('payment.edit.created_by', 'com_supportgroups.payment.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment.edit.created_by', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if ($id != 0 && (!$user->authorise('payment.edit.created', 'com_supportgroups.payment.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment.edit.created', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Support Group access controls. + if ($id != 0 && (!$user->authorise('payment.edit.support_group', 'com_supportgroups.payment.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment.edit.support_group', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('support_group', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('support_group', 'readonly', 'true'); + if (!$form->getValue('support_group')) + { + // Disable fields while saving. + $form->setFieldAttribute('support_group', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('support_group', 'required', 'false'); + } + } + // Modify the form based on Edit Year access controls. + if ($id != 0 && (!$user->authorise('payment.edit.year', 'com_supportgroups.payment.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment.edit.year', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('year', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('year', 'readonly', 'true'); + if (!$form->getValue('year')) + { + // Disable fields while saving. + $form->setFieldAttribute('year', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('year', 'required', 'false'); + } + } + // Modify the form based on Edit Amount access controls. + if ($id != 0 && (!$user->authorise('payment.edit.amount', 'com_supportgroups.payment.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment.edit.amount', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('amount', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('amount', 'readonly', 'true'); + if (!$form->getValue('amount')) + { + // Disable fields while saving. + $form->setFieldAttribute('amount', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('amount', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected field name + $redirectedField = $jinput->get('ref', null, 'STRING'); + // Set redirected field value + $redirectedValue = $jinput->get('refid', 0, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'administrator/components/com_supportgroups/models/forms/payment.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('payment.delete', 'com_supportgroups.payment.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('payment.edit.state', 'com_supportgroups.payment.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return $user->authorise('payment.edit.state', 'com_supportgroups'); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); + + return $user->authorise('payment.edit', 'com_supportgroups.payment.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('payment.edit', 'com_supportgroups'); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__supportgroups_payment')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_supportgroups.edit.payment.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqeFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + JArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SupportgroupsHelper::getActions('payment'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SupportgroupsHelper::getActions('payment'); + } + + if (!$this->canDo->get('payment.create') && !$this->canDo->get('payment.batch')) + { + return false; + } + + // get list of uniqe fields + $uniqeFields = $this->getUniqeFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('payment.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + + if (!$this->user->authorise('payment.edit', $contexts[$pk])) + + { + + // Not fatal error + + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + + continue; + + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + $this->table->support_group = $this->generateUniqe('support_group',$this->table->support_group); + + // insert all set values + if (SupportgroupsHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all uniqe fields + if (SupportgroupsHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = SupportgroupsHelper::getActions('payment'); + } + + if (!$this->canDo->get('payment.edit') && !$this->canDo->get('payment.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('payment.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('payment.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (SupportgroupsHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' == $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the uniqe field for save as copy + if ($input->get('task') == 'save2copy') + { + // Automatic handling of other uniqe fields + $uniqeFields = $this->getUniqeFields(); + if (SupportgroupsHelper::checkArray($uniqeFields)) + { + foreach ($uniqeFields as $uniqeField) + { + $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUniqe($field,$value) + { + + // set field value uniqe + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = JString::increment($value); + } + + return $value; + } + + /** + * Method to change the title & alias. + * + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + */ + protected function _generateNewTitle($title) + { + + // Alter the title + $table = $this->getTable(); + + while ($table->load(array('title' => $title))) + { + $title = JString::increment($title); + } + + return $title; + } +} diff --git a/admin/models/payments.php b/admin/models/payments.php new file mode 100644 index 0000000..3f322aa --- /dev/null +++ b/admin/models/payments.php @@ -0,0 +1,466 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the Joomla modellist library +jimport('joomla.application.component.modellist'); + +/** + * Payments Model + */ +class SupportgroupsModelPayments extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.support_group','support_group', + 'a.year','year', + 'a.amount','amount' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * @return void + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + $support_group = $this->getUserStateFromRequest($this->context . '.filter.support_group', 'filter_support_group'); + $this->setState('filter.support_group', $support_group); + + $year = $this->getUserStateFromRequest($this->context . '.filter.year', 'filter_year'); + $this->setState('filter.year', $year); + + $amount = $this->getUserStateFromRequest($this->context . '.filter.amount', 'filter_amount'); + $this->setState('filter.amount', $amount); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $this->setState('filter.access', $access); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('payment.access', 'com_supportgroups.payment.' . (int) $item->id) && $user->authorise('payment.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // Try Convert the Amount to the Currency value + if (SupportgroupsHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert to currency here + $item->amount = SupportgroupsHelper::setCurrency($item->amount, $item->support_group); + } + } + + // set selection value to a translatable value + if (SupportgroupsHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert year + $item->year = $this->selectionTranslation($item->year, 'year'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of year language strings + if ($name == 'year') + { + $yearArray = array( + 0 => 'COM_SUPPORTGROUPS_PAYMENT_SELECT_A_YEAR', + 2010 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TEN', + 2011 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_ELEVEN', + 2012 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWELVE', + 2013 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTEEN', + 2014 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FOURTEEN', + 2015 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FIFTEEN', + 2016 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SIXTEEN', + 2017 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SEVENTEEN', + 2018 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_EIGHTEEN', + 2019 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_NINETEEN', + 2020 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY', + 2021 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_ONE', + 2022 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_TWO', + 2023 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_THREE', + 2024 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FOUR', + 2025 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FIVE', + 2026 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SIX', + 2027 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SEVEN', + 2028 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_EIGHT', + 2029 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_NINE', + 2030 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTY' + ); + // Now check if value is found in this array + if (isset($yearArray[$value]) && SupportgroupsHelper::checkString($yearArray[$value])) + { + return $yearArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the supportgroups_item table + $query->from($db->quoteName('#__supportgroups_payment', 'a')); + + // From the supportgroups_support_group table. + $query->select($db->quoteName('g.name','support_group_name')); + $query->join('LEFT', $db->quoteName('#__supportgroups_support_group', 'g') . ' ON (' . $db->quoteName('a.support_group') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_supportgroups')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search, true) . '%'); + $query->where('(a.support_group LIKE '.$search.' OR g.name LIKE '.$search.' OR a.year LIKE '.$search.' OR a.amount LIKE '.$search.')'); + } + } + + // Filter by support_group. + if ($support_group = $this->getState('filter.support_group')) + { + $query->where('a.support_group = ' . $db->quote($db->escape($support_group, true))); + } + // Filter by Year. + if ($year = $this->getState('filter.year')) + { + $query->where('a.year = ' . $db->quote($db->escape($year, true))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks) + { + // setup the query + if (SupportgroupsHelper::checkArray($pks)) + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the supportgroups_payment table + $query->from($db->quoteName('#__supportgroups_payment', 'a')); + $query->where('a.id IN (' . implode(',',$pks) . ')'); + // Implement View Level Access + if (!$user->authorise('core.options', 'com_supportgroups')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('payment.access', 'com_supportgroups.payment.' . (int) $item->id) && $user->authorise('payment.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (SupportgroupsHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + + // Try Convert the Amount to the Currency value + if (SupportgroupsHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert to currency here + $item->amount = SupportgroupsHelper::setCurrency($item->amount, $item->support_group); + } + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__supportgroups_payment"); + if (SupportgroupsHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.support_group'); + $id .= ':' . $this->getState('filter.year'); + $id .= ':' . $this->getState('filter.amount'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_supportgroups')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__supportgroups_payment')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__supportgroups_payment'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/region.php b/admin/models/region.php index 38ec27e..e80060c 100644 --- a/admin/models/region.php +++ b/admin/models/region.php @@ -100,9 +100,94 @@ class SupportgroupsModelRegion extends JModelAdmin $item->tags = new JHelperTags; $item->tags->getTagIds($item->id, 'com_supportgroups.region'); } - } + } + $this->regionvvvx = $item->id; return $item; + } + + /** + * Method to get list data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getVvxlocations() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the supportgroups_location table + $query->from($db->quoteName('#__supportgroups_location', 'a')); + + // From the supportgroups_region table. + $query->select($db->quoteName('g.name','region_name')); + $query->join('LEFT', $db->quoteName('#__supportgroups_region', 'g') . ' ON (' . $db->quoteName('a.region') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by regionvvvx global. + $regionvvvx = $this->regionvvvx; + if (is_numeric($regionvvvx )) + { + $query->where('a.region = ' . (int) $regionvvvx ); + } + elseif (is_string($regionvvvx)) + { + $query->where('a.region = ' . $db->quote($regionvvvx)); + } + else + { + $query->where('a.region = -5'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_supportgroups')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('location.access', 'com_supportgroups.location.' . (int) $item->id) && $user->authorise('location.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + return $items; + } + return false; } /** @@ -141,8 +226,8 @@ class SupportgroupsModelRegion extends JModelAdmin // Check for existing item. // Modify the form based on Edit State access controls. - if ($id != 0 && (!$user->authorise('core.edit.state', 'com_supportgroups.region.' . (int) $id)) - || ($id == 0 && !$user->authorise('core.edit.state', 'com_supportgroups'))) + if ($id != 0 && (!$user->authorise('region.edit.state', 'com_supportgroups.region.' . (int) $id)) + || ($id == 0 && !$user->authorise('region.edit.state', 'com_supportgroups'))) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); @@ -158,7 +243,8 @@ class SupportgroupsModelRegion extends JModelAdmin $form->setValue('created_by', null, $user->id); } // Modify the form based on Edit Creaded By access controls. - if (!$user->authorise('core.edit.created_by', 'com_supportgroups')) + if ($id != 0 && (!$user->authorise('region.edit.created_by', 'com_supportgroups.region.' . (int) $id)) + || ($id == 0 && !$user->authorise('region.edit.created_by', 'com_supportgroups'))) { // Disable fields for display. $form->setFieldAttribute('created_by', 'disabled', 'true'); @@ -168,7 +254,8 @@ class SupportgroupsModelRegion extends JModelAdmin $form->setFieldAttribute('created_by', 'filter', 'unset'); } // Modify the form based on Edit Creaded Date access controls. - if (!$user->authorise('core.edit.created', 'com_supportgroups')) + if ($id != 0 && (!$user->authorise('region.edit.created', 'com_supportgroups.region.' . (int) $id)) + || ($id == 0 && !$user->authorise('region.edit.created', 'com_supportgroups'))) { // Disable fields for display. $form->setFieldAttribute('created', 'disabled', 'true'); @@ -254,7 +341,7 @@ class SupportgroupsModelRegion extends JModelAdmin $user = JFactory::getUser(); // The record has been set. Check the record permissions. - return $user->authorise('core.delete', 'com_supportgroups.region.' . (int) $record->id); + return $user->authorise('region.delete', 'com_supportgroups.region.' . (int) $record->id); } return false; } @@ -276,14 +363,14 @@ class SupportgroupsModelRegion extends JModelAdmin if ($recordId) { // The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit.state', 'com_supportgroups.region.' . (int) $recordId); + $permission = $user->authorise('region.edit.state', 'com_supportgroups.region.' . (int) $recordId); if (!$permission && !is_null($permission)) { return false; } } // In the absense of better information, revert to the component permissions. - return parent::canEditState($record); + return $user->authorise('region.edit.state', 'com_supportgroups'); } /** @@ -298,8 +385,9 @@ class SupportgroupsModelRegion extends JModelAdmin protected function allowEdit($data = array(), $key = 'id') { // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); - return JFactory::getUser()->authorise('core.edit', 'com_supportgroups.region.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + return $user->authorise('region.edit', 'com_supportgroups.region.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('region.edit', 'com_supportgroups'); } /** @@ -531,7 +619,7 @@ class SupportgroupsModelRegion extends JModelAdmin $this->canDo = SupportgroupsHelper::getActions('region'); } - if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + if (!$this->canDo->get('region.create') && !$this->canDo->get('region.batch')) { return false; } @@ -546,7 +634,7 @@ class SupportgroupsModelRegion extends JModelAdmin { $values['published'] = 0; } - elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + elseif (isset($values['published']) && !$this->canDo->get('region.edit.state')) { $values['published'] = 0; } @@ -563,7 +651,7 @@ class SupportgroupsModelRegion extends JModelAdmin // only allow copy if user may edit this item. - if (!$this->user->authorise('core.edit', $contexts[$pk])) + if (!$this->user->authorise('region.edit', $contexts[$pk])) { @@ -680,14 +768,14 @@ class SupportgroupsModelRegion extends JModelAdmin $this->canDo = SupportgroupsHelper::getActions('region'); } - if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + if (!$this->canDo->get('region.edit') && !$this->canDo->get('region.batch')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } // make sure published only updates if user has the permission. - if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + if (isset($values['published']) && !$this->canDo->get('region.edit.state')) { unset($values['published']); } @@ -697,7 +785,7 @@ class SupportgroupsModelRegion extends JModelAdmin // Parent exists so we proceed foreach ($pks as $pk) { - if (!$this->user->authorise('core.edit', $contexts[$pk])) + if (!$this->user->authorise('region.edit', $contexts[$pk])) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); diff --git a/admin/models/regions.php b/admin/models/regions.php index 53f0d43..e1e19f0 100644 --- a/admin/models/regions.php +++ b/admin/models/regions.php @@ -105,7 +105,24 @@ class SupportgroupsModelRegions extends JModelList $this->checkInNow(); // load parent items - $items = parent::getItems(); + $items = parent::getItems(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('region.access', 'com_supportgroups.region.' . (int) $item->id) && $user->authorise('region.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } // return items return $items; @@ -233,8 +250,17 @@ class SupportgroupsModelRegions extends JModelList // set values to display correctly. if (SupportgroupsHelper::checkArray($items)) { + // get user object. + $user = JFactory::getUser(); foreach ($items as $nr => &$item) { + $access = ($user->authorise('region.access', 'com_supportgroups.region.' . (int) $item->id) && $user->authorise('region.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); diff --git a/admin/models/support_group.php b/admin/models/support_group.php index e3bfd5a..6c237ef 100644 --- a/admin/models/support_group.php +++ b/admin/models/support_group.php @@ -100,9 +100,158 @@ class SupportgroupsModelSupport_group extends JModelAdmin $item->tags = new JHelperTags; $item->tags->getTagIds($item->id, 'com_supportgroups.support_group'); } - } + } + $this->support_groupvvvv = $item->id; return $item; + } + + /** + * Method to get list data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getVvvpayments() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the supportgroups_payment table + $query->from($db->quoteName('#__supportgroups_payment', 'a')); + + // From the supportgroups_support_group table. + $query->select($db->quoteName('g.name','support_group_name')); + $query->join('LEFT', $db->quoteName('#__supportgroups_support_group', 'g') . ' ON (' . $db->quoteName('a.support_group') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by support_groupvvvv global. + $support_groupvvvv = $this->support_groupvvvv; + if (is_numeric($support_groupvvvv )) + { + $query->where('a.support_group = ' . (int) $support_groupvvvv ); + } + elseif (is_string($support_groupvvvv)) + { + $query->where('a.support_group = ' . $db->quote($support_groupvvvv)); + } + else + { + $query->where('a.support_group = -5'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + $query->where('a.access = ' . (int) $access); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_supportgroups')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('payment.access', 'com_supportgroups.payment.' . (int) $item->id) && $user->authorise('payment.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } + + // Try Convert the Amount to the Currency value + if (SupportgroupsHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert to currency here + $item->amount = SupportgroupsHelper::setCurrency($item->amount, $item->support_group); + } + } + + // set selection value to a translatable value + if (SupportgroupsHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert year + $item->year = $this->selectionTranslationVvvpayments($item->year, 'year'); + } + } + + return $items; + } + return false; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslationVvvpayments($value,$name) + { + // Array of year language strings + if ($name == 'year') + { + $yearArray = array( + 0 => 'COM_SUPPORTGROUPS_PAYMENT_SELECT_A_YEAR', + 2010 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TEN', + 2011 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_ELEVEN', + 2012 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWELVE', + 2013 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTEEN', + 2014 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FOURTEEN', + 2015 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FIFTEEN', + 2016 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SIXTEEN', + 2017 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SEVENTEEN', + 2018 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_EIGHTEEN', + 2019 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_NINETEEN', + 2020 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY', + 2021 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_ONE', + 2022 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_TWO', + 2023 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_THREE', + 2024 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FOUR', + 2025 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FIVE', + 2026 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SIX', + 2027 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SEVEN', + 2028 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_EIGHT', + 2029 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_NINE', + 2030 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTY' + ); + // Now check if value is found in this array + if (isset($yearArray[$value]) && SupportgroupsHelper::checkString($yearArray[$value])) + { + return $yearArray[$value]; + } + } + return $value; } /** @@ -141,8 +290,8 @@ class SupportgroupsModelSupport_group extends JModelAdmin // Check for existing item. // Modify the form based on Edit State access controls. - if ($id != 0 && (!$user->authorise('core.edit.state', 'com_supportgroups.support_group.' . (int) $id)) - || ($id == 0 && !$user->authorise('core.edit.state', 'com_supportgroups'))) + if ($id != 0 && (!$user->authorise('support_group.edit.state', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.state', 'com_supportgroups'))) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); @@ -158,7 +307,8 @@ class SupportgroupsModelSupport_group extends JModelAdmin $form->setValue('created_by', null, $user->id); } // Modify the form based on Edit Creaded By access controls. - if (!$user->authorise('core.edit.created_by', 'com_supportgroups')) + if ($id != 0 && (!$user->authorise('support_group.edit.created_by', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.created_by', 'com_supportgroups'))) { // Disable fields for display. $form->setFieldAttribute('created_by', 'disabled', 'true'); @@ -168,7 +318,8 @@ class SupportgroupsModelSupport_group extends JModelAdmin $form->setFieldAttribute('created_by', 'filter', 'unset'); } // Modify the form based on Edit Creaded Date access controls. - if (!$user->authorise('core.edit.created', 'com_supportgroups')) + if ($id != 0 && (!$user->authorise('support_group.edit.created', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.created', 'com_supportgroups'))) { // Disable fields for display. $form->setFieldAttribute('created', 'disabled', 'true'); @@ -191,6 +342,134 @@ class SupportgroupsModelSupport_group extends JModelAdmin $form->setFieldAttribute('name', 'required', 'false'); } } + // Modify the form based on Edit Phone access controls. + if ($id != 0 && (!$user->authorise('support_group.edit.phone', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.phone', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('phone', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('phone', 'readonly', 'true'); + if (!$form->getValue('phone')) + { + // Disable fields while saving. + $form->setFieldAttribute('phone', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('phone', 'required', 'false'); + } + } + // Modify the form based on Edit Location access controls. + if ($id != 0 && (!$user->authorise('support_group.edit.location', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.location', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('location', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('location', 'readonly', 'true'); + if (!$form->getValue('location')) + { + // Disable fields while saving. + $form->setFieldAttribute('location', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('location', 'required', 'false'); + } + } + // Modify the form based on Edit Clinic access controls. + if ($id != 0 && (!$user->authorise('support_group.edit.clinic', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.clinic', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('clinic', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('clinic', 'readonly', 'true'); + if (!$form->getValue('clinic')) + { + // Disable fields while saving. + $form->setFieldAttribute('clinic', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('clinic', 'required', 'false'); + } + } + // Modify the form based on Edit Male access controls. + if ($id != 0 && (!$user->authorise('support_group.edit.male', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.male', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('male', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('male', 'readonly', 'true'); + if (!$form->getValue('male')) + { + // Disable fields while saving. + $form->setFieldAttribute('male', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('male', 'required', 'false'); + } + } + // Modify the form based on Edit Female access controls. + if ($id != 0 && (!$user->authorise('support_group.edit.female', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.female', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('female', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('female', 'readonly', 'true'); + if (!$form->getValue('female')) + { + // Disable fields while saving. + $form->setFieldAttribute('female', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('female', 'required', 'false'); + } + } + // Modify the form based on Edit Female Art access controls. + if ($id != 0 && (!$user->authorise('support_group.edit.female_art', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.female_art', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('female_art', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('female_art', 'readonly', 'true'); + if (!$form->getValue('female_art')) + { + // Disable fields while saving. + $form->setFieldAttribute('female_art', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('female_art', 'required', 'false'); + } + } + // Modify the form based on Edit Male Art access controls. + if ($id != 0 && (!$user->authorise('support_group.edit.male_art', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.male_art', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('male_art', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('male_art', 'readonly', 'true'); + if (!$form->getValue('male_art')) + { + // Disable fields while saving. + $form->setFieldAttribute('male_art', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('male_art', 'required', 'false'); + } + } + // Modify the form based on Edit Male Children access controls. + if ($id != 0 && (!$user->authorise('support_group.edit.male_children', 'com_supportgroups.support_group.' . (int) $id)) + || ($id == 0 && !$user->authorise('support_group.edit.male_children', 'com_supportgroups'))) + { + // Disable fields for display. + $form->setFieldAttribute('male_children', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('male_children', 'readonly', 'true'); + if (!$form->getValue('male_children')) + { + // Disable fields while saving. + $form->setFieldAttribute('male_children', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('male_children', 'required', 'false'); + } + } // Only load these values if no id is found if (0 == $id) { @@ -238,7 +517,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin $user = JFactory::getUser(); // The record has been set. Check the record permissions. - return $user->authorise('core.delete', 'com_supportgroups.support_group.' . (int) $record->id); + return $user->authorise('support_group.delete', 'com_supportgroups.support_group.' . (int) $record->id); } return false; } @@ -260,14 +539,14 @@ class SupportgroupsModelSupport_group extends JModelAdmin if ($recordId) { // The record has been set. Check the record permissions. - $permission = $user->authorise('core.edit.state', 'com_supportgroups.support_group.' . (int) $recordId); + $permission = $user->authorise('support_group.edit.state', 'com_supportgroups.support_group.' . (int) $recordId); if (!$permission && !is_null($permission)) { return false; } } // In the absense of better information, revert to the component permissions. - return parent::canEditState($record); + return $user->authorise('support_group.edit.state', 'com_supportgroups'); } /** @@ -282,8 +561,9 @@ class SupportgroupsModelSupport_group extends JModelAdmin protected function allowEdit($data = array(), $key = 'id') { // Check specific edit permission then general edit permission. + $user = JFactory::getUser(); - return JFactory::getUser()->authorise('core.edit', 'com_supportgroups.support_group.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + return $user->authorise('support_group.edit', 'com_supportgroups.support_group.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('support_group.edit', 'com_supportgroups'); } /** @@ -515,7 +795,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin $this->canDo = SupportgroupsHelper::getActions('support_group'); } - if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + if (!$this->canDo->get('support_group.create') && !$this->canDo->get('support_group.batch')) { return false; } @@ -530,7 +810,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin { $values['published'] = 0; } - elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + elseif (isset($values['published']) && !$this->canDo->get('support_group.edit.state')) { $values['published'] = 0; } @@ -547,7 +827,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin // only allow copy if user may edit this item. - if (!$this->user->authorise('core.edit', $contexts[$pk])) + if (!$this->user->authorise('support_group.edit', $contexts[$pk])) { @@ -664,14 +944,14 @@ class SupportgroupsModelSupport_group extends JModelAdmin $this->canDo = SupportgroupsHelper::getActions('support_group'); } - if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + if (!$this->canDo->get('support_group.edit') && !$this->canDo->get('support_group.batch')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } // make sure published only updates if user has the permission. - if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + if (isset($values['published']) && !$this->canDo->get('support_group.edit.state')) { unset($values['published']); } @@ -681,7 +961,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin // Parent exists so we proceed foreach ($pks as $pk) { - if (!$this->user->authorise('core.edit', $contexts[$pk])) + if (!$this->user->authorise('support_group.edit', $contexts[$pk])) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); diff --git a/admin/models/support_groups.php b/admin/models/support_groups.php index cf55bf3..b7a4285 100644 --- a/admin/models/support_groups.php +++ b/admin/models/support_groups.php @@ -44,7 +44,12 @@ class SupportgroupsModelSupport_groups extends JModelList 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.name','name' + 'a.name','name', + 'a.phone','phone', + 'a.location','location', + 'a.clinic','clinic', + 'a.male','male', + 'a.female','female' ); } @@ -66,7 +71,22 @@ class SupportgroupsModelSupport_groups extends JModelList $this->context .= '.' . $layout; } $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + $this->setState('filter.name', $name); + + $phone = $this->getUserStateFromRequest($this->context . '.filter.phone', 'filter_phone'); + $this->setState('filter.phone', $phone); + + $location = $this->getUserStateFromRequest($this->context . '.filter.location', 'filter_location'); + $this->setState('filter.location', $location); + + $clinic = $this->getUserStateFromRequest($this->context . '.filter.clinic', 'filter_clinic'); + $this->setState('filter.clinic', $clinic); + + $male = $this->getUserStateFromRequest($this->context . '.filter.male', 'filter_male'); + $this->setState('filter.male', $male); + + $female = $this->getUserStateFromRequest($this->context . '.filter.female', 'filter_female'); + $this->setState('filter.female', $female); $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); $this->setState('filter.sorting', $sorting); @@ -101,7 +121,24 @@ class SupportgroupsModelSupport_groups extends JModelList $this->checkInNow(); // load parent items - $items = parent::getItems(); + $items = parent::getItems(); + + // set values to display correctly. + if (SupportgroupsHelper::checkArray($items)) + { + // get user object. + $user = JFactory::getUser(); + foreach ($items as $nr => &$item) + { + $access = ($user->authorise('support_group.access', 'com_supportgroups.support_group.' . (int) $item->id) && $user->authorise('support_group.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + + } + } // return items return $items; @@ -126,6 +163,14 @@ class SupportgroupsModelSupport_groups extends JModelList // From the supportgroups_item table $query->from($db->quoteName('#__supportgroups_support_group', 'a')); + // From the supportgroups_location table. + $query->select($db->quoteName('g.name','location_name')); + $query->join('LEFT', $db->quoteName('#__supportgroups_location', 'g') . ' ON (' . $db->quoteName('a.location') . ' = ' . $db->quoteName('g.id') . ')'); + + // From the supportgroups_clinic table. + $query->select($db->quoteName('h.name','clinic_name')); + $query->join('LEFT', $db->quoteName('#__supportgroups_clinic', 'h') . ' ON (' . $db->quoteName('a.clinic') . ' = ' . $db->quoteName('h.id') . ')'); + // Filter by published state $published = $this->getState('filter.published'); if (is_numeric($published)) @@ -162,10 +207,20 @@ class SupportgroupsModelSupport_groups extends JModelList else { $search = $db->quote('%' . $db->escape($search, true) . '%'); - $query->where('(a.name LIKE '.$search.')'); + $query->where('(a.name LIKE '.$search.' OR a.phone LIKE '.$search.' OR a.location LIKE '.$search.' OR g.name LIKE '.$search.' OR a.clinic LIKE '.$search.' OR h.name LIKE '.$search.')'); } } + // Filter by location. + if ($location = $this->getState('filter.location')) + { + $query->where('a.location = ' . $db->quote($db->escape($location, true))); + } + // Filter by clinic. + if ($clinic = $this->getState('filter.clinic')) + { + $query->where('a.clinic = ' . $db->quote($db->escape($clinic, true))); + } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); @@ -220,8 +275,17 @@ class SupportgroupsModelSupport_groups extends JModelList // set values to display correctly. if (SupportgroupsHelper::checkArray($items)) { + // get user object. + $user = JFactory::getUser(); foreach ($items as $nr => &$item) { + $access = ($user->authorise('support_group.access', 'com_supportgroups.support_group.' . (int) $item->id) && $user->authorise('support_group.access', 'com_supportgroups')); + if (!$access) + { + unset($items[$nr]); + continue; + } + // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); @@ -282,7 +346,12 @@ class SupportgroupsModelSupport_groups extends JModelList $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.phone'); + $id .= ':' . $this->getState('filter.location'); + $id .= ':' . $this->getState('filter.clinic'); + $id .= ':' . $this->getState('filter.male'); + $id .= ':' . $this->getState('filter.female'); return parent::getStoreId($id); } diff --git a/admin/models/supportgroups.php b/admin/models/supportgroups.php index 8737ed0..60a23e1 100644 --- a/admin/models/supportgroups.php +++ b/admin/models/supportgroups.php @@ -43,29 +43,52 @@ class SupportgroupsModelSupportgroups extends JModelList $icons = array(); // view groups array $viewGroups = array( - 'main' => array('png.support_group.add', 'png.support_groups', 'png.location.add', 'png.locations', 'png.region.add', 'png.regions', 'png.currencies', 'png.countries') + 'main' => array('png.support_group.add', 'png.support_groups', 'png.payment.add', 'png.payments', 'png.clinics', 'png.locations', 'png.regions', 'png.countries', 'png.currencies', 'png.help_documents') ); // view access array $viewAccess = array( + 'support_group.create' => 'support_group.create', + 'support_groups.access' => 'support_group.access', + 'support_group.access' => 'support_group.access', 'support_groups.submenu' => 'support_group.submenu', 'support_groups.dashboard_list' => 'support_group.dashboard_list', 'support_group.dashboard_add' => 'support_group.dashboard_add', + 'payment.create' => 'payment.create', + 'payments.access' => 'payment.access', + 'payment.access' => 'payment.access', + 'payments.submenu' => 'payment.submenu', + 'payments.dashboard_list' => 'payment.dashboard_list', + 'payment.dashboard_add' => 'payment.dashboard_add', + 'clinic.create' => 'clinic.create', + 'clinics.access' => 'clinic.access', + 'clinic.access' => 'clinic.access', + 'clinics.submenu' => 'clinic.submenu', + 'clinics.dashboard_list' => 'clinic.dashboard_list', + 'location.create' => 'location.create', + 'locations.access' => 'location.access', + 'location.access' => 'location.access', 'locations.submenu' => 'location.submenu', 'locations.dashboard_list' => 'location.dashboard_list', - 'location.dashboard_add' => 'location.dashboard_add', + 'region.create' => 'region.create', + 'regions.access' => 'region.access', + 'region.access' => 'region.access', 'regions.submenu' => 'region.submenu', 'regions.dashboard_list' => 'region.dashboard_list', - 'region.dashboard_add' => 'region.dashboard_add', + 'country.create' => 'country.create', + 'countries.access' => 'country.access', + 'country.access' => 'country.access', + 'countries.submenu' => 'country.submenu', + 'countries.dashboard_list' => 'country.dashboard_list', 'currency.create' => 'currency.create', 'currencies.access' => 'currency.access', 'currency.access' => 'currency.access', 'currencies.submenu' => 'currency.submenu', 'currencies.dashboard_list' => 'currency.dashboard_list', - 'country.create' => 'country.create', - 'countries.access' => 'country.access', - 'country.access' => 'country.access', - 'countries.submenu' => 'country.submenu', - 'countries.dashboard_list' => 'country.dashboard_list'); + 'help_document.create' => 'help_document.create', + 'help_documents.access' => 'help_document.access', + 'help_document.access' => 'help_document.access', + 'help_documents.submenu' => 'help_document.submenu', + 'help_documents.dashboard_list' => 'help_document.dashboard_list'); foreach($viewGroups as $group => $views) { $i = 0; diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index c061d5c..02aee11 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -1,7 +1,83 @@ CREATE TABLE IF NOT EXISTS `#__supportgroups_support_group` ( `id` int(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', + `area` TEXT NOT NULL DEFAULT '', + `clinic` INT(11) NOT NULL DEFAULT '0', + `female` INT(11) NOT NULL DEFAULT '0', + `female_art` INT(11) NOT NULL DEFAULT '0', + `female_children` INT(11) NOT NULL DEFAULT '0', + `location` INT(11) NOT NULL DEFAULT '0', + `male` INT(11) NOT NULL DEFAULT '0', + `male_art` INT(11) NOT NULL DEFAULT '0', + `male_children` INT(11) NOT NULL DEFAULT '0', `name` VARCHAR(255) NOT NULL DEFAULT '', + `phone` VARCHAR(64) NOT NULL DEFAULT '', + `params` TEXT NOT NULL DEFAULT '', + `published` tinyint(1) NOT NULL DEFAULT '1', + `created_by` int(11) NOT NULL DEFAULT '0', + `modified_by` int(11) NOT NULL DEFAULT '0', + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) NOT NULL, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` int(11) NOT NULL DEFAULT '1', + `hits` int(11) NOT NULL DEFAULT '0', + `access` int(11) DEFAULT NULL, + `ordering` int(11) NOT NULL DEFAULT '0', + `metakey` TEXT NOT NULL DEFAULT '', + `metadesc` TEXT NOT NULL DEFAULT '', + `metadata` TEXT NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_location` (`location`), + KEY `idx_clinic` (`clinic`), + KEY `idx_male` (`male`), + KEY `idx_female` (`female`), + KEY `idx_female_art` (`female_art`), + KEY `idx_male_art` (`male_art`), + KEY `idx_female_children` (`female_children`), + KEY `idx_male_children` (`male_children`) +) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__supportgroups_payment` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', + `amount` VARCHAR(100) NOT NULL DEFAULT '0', + `support_group` INT(11) NOT NULL DEFAULT '0', + `year` INT(11) NOT NULL DEFAULT '0', + `params` TEXT NOT NULL DEFAULT '', + `published` tinyint(1) NOT NULL DEFAULT '1', + `created_by` int(11) NOT NULL DEFAULT '0', + `modified_by` int(11) NOT NULL DEFAULT '0', + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) NOT NULL, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` int(11) NOT NULL DEFAULT '1', + `hits` int(11) NOT NULL DEFAULT '0', + `access` int(11) DEFAULT NULL, + `ordering` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_support_group` (`support_group`), + KEY `idx_year` (`year`) +) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `#__supportgroups_clinic` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', + `area` TEXT NOT NULL DEFAULT '', + `name` VARCHAR(255) NOT NULL DEFAULT '', + `phone` VARCHAR(64) NOT NULL DEFAULT '', `params` TEXT NOT NULL DEFAULT '', `published` tinyint(1) NOT NULL DEFAULT '1', `created_by` int(11) NOT NULL DEFAULT '0', @@ -87,6 +163,44 @@ CREATE TABLE IF NOT EXISTS `#__supportgroups_region` ( KEY `idx_country` (`country`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; +CREATE TABLE IF NOT EXISTS `#__supportgroups_country` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', + `alias` CHAR(64) NOT NULL DEFAULT '', + `codethree` CHAR(7) NOT NULL DEFAULT '', + `codetwo` CHAR(7) NOT NULL DEFAULT '', + `currency` CHAR(7) NOT NULL DEFAULT '', + `name` VARCHAR(255) NOT NULL DEFAULT '', + `worldzone` VARCHAR(255) NOT NULL DEFAULT '', + `params` TEXT NOT NULL DEFAULT '', + `published` tinyint(1) NOT NULL DEFAULT '1', + `created_by` int(11) NOT NULL DEFAULT '0', + `modified_by` int(11) NOT NULL DEFAULT '0', + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) NOT NULL, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` int(11) NOT NULL DEFAULT '1', + `hits` int(11) NOT NULL DEFAULT '0', + `access` int(11) DEFAULT NULL, + `ordering` int(11) NOT NULL DEFAULT '0', + `metakey` TEXT NOT NULL DEFAULT '', + `metadesc` TEXT NOT NULL DEFAULT '', + `metadata` TEXT NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`), + KEY `idx_name` (`name`), + KEY `idx_currency` (`currency`), + KEY `idx_worldzone` (`worldzone`), + KEY `idx_codethree` (`codethree`), + KEY `idx_codetwo` (`codetwo`), + KEY `idx_alias` (`alias`) +) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + CREATE TABLE IF NOT EXISTS `#__supportgroups_currency` ( `id` int(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', @@ -127,15 +241,21 @@ CREATE TABLE IF NOT EXISTS `#__supportgroups_currency` ( KEY `idx_alias` (`alias`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; -CREATE TABLE IF NOT EXISTS `#__supportgroups_country` ( +CREATE TABLE IF NOT EXISTS `#__supportgroups_help_document` ( `id` int(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0', + `admin_view` CHAR(255) NOT NULL DEFAULT '', `alias` CHAR(64) NOT NULL DEFAULT '', - `codethree` CHAR(7) NOT NULL DEFAULT '', - `codetwo` CHAR(7) NOT NULL DEFAULT '', - `currency` CHAR(7) NOT NULL DEFAULT '', - `name` VARCHAR(255) NOT NULL DEFAULT '', - `worldzone` VARCHAR(255) NOT NULL DEFAULT '', + `article` TINYINT(1) NOT NULL DEFAULT '0', + `content` TEXT NOT NULL DEFAULT '', + `groups` TEXT NOT NULL DEFAULT '', + `location` TINYINT(1) NOT NULL DEFAULT '0', + `not_required` INT(1) NOT NULL DEFAULT '0', + `site_view` CHAR(255) NOT NULL DEFAULT '', + `target` TINYINT(1) NOT NULL DEFAULT '0', + `title` CHAR(64) NOT NULL DEFAULT '', + `type` TINYINT(1) NOT NULL DEFAULT '0', + `url` VARCHAR(255) NOT NULL DEFAULT '', `params` TEXT NOT NULL DEFAULT '', `published` tinyint(1) NOT NULL DEFAULT '1', `created_by` int(11) NOT NULL DEFAULT '0', @@ -148,195 +268,22 @@ CREATE TABLE IF NOT EXISTS `#__supportgroups_country` ( `hits` int(11) NOT NULL DEFAULT '0', `access` int(11) DEFAULT NULL, `ordering` int(11) NOT NULL DEFAULT '0', - `metakey` TEXT NOT NULL DEFAULT '', - `metadesc` TEXT NOT NULL DEFAULT '', - `metadata` TEXT NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `idx_access` (`access`), KEY `idx_checkout` (`checked_out`), KEY `idx_createdby` (`created_by`), KEY `idx_modifiedby` (`modified_by`), KEY `idx_state` (`published`), - KEY `idx_name` (`name`), - KEY `idx_currency` (`currency`), - KEY `idx_worldzone` (`worldzone`), - KEY `idx_codethree` (`codethree`), - KEY `idx_codetwo` (`codetwo`), - KEY `idx_alias` (`alias`) + KEY `idx_title` (`title`), + KEY `idx_type` (`type`), + KEY `idx_location` (`location`), + KEY `idx_target` (`target`), + KEY `idx_alias` (`alias`), + KEY `idx_article` (`article`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; --- --- Dumping data for table `#__supportgroups_currency` --- - -INSERT INTO `#__supportgroups_currency` (`id`, `alias`, `codethree`, `decimalplace`, `decimalsymbol`, `name`, `negativestyle`, `numericcode`, `positivestyle`, `symbol`, `thousands`, `params`, `published`, `created_by`, `modified_by`, `created`, `modified`, `checked_out`, `checked_out_time`, `version`, `hits`, `access`, `ordering`) VALUES -(1, '', 'AED', 2, ',', 'United Arab Emirates dirham', '{sign}{number} {symbol}', 784, '{number} {symbol}', 'د.إ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 23), -(2, '', 'AFN', 2, ',', 'Afghan afghani', '{sign}{number} {symbol}', 971, '{number} {symbol}', '؋', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 24), -(3, '', 'ALL', 2, ',', 'Albanian lek', '{sign}{number} {symbol}', 8, '{number} {symbol}', 'Lek', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 25), -(4, '', 'AMD', 2, ',', 'Armenian dram', '{sign}{number} {symbol}', 51, '{number} {symbol}', 'դր.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 26), -(5, '', 'ANG', 2, ',', 'Netherlands Antillean gulden', '{sign}{number} {symbol}', 532, '{number} {symbol}', 'ƒ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 27), -(6, '', 'AOA', 2, ',', 'Angolan kwanza', '{sign}{number} {symbol}', 973, '{number} {symbol}', 'Kz', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 28), -(7, '', 'ARS', 2, ',', 'Argentine peso', '{sign}{number} {symbol}', 32, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 29), -(8, '', 'AUD', 2, '.', 'Australian dollar', '{sign}{symbol} {number}', 36, '{symbol} {number}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 5), -(9, '', 'AWG', 2, ',', 'Aruban florin', '{sign}{number} {symbol}', 533, '{number} {symbol}', 'ƒ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 30), -(10, '', 'AZN', 2, ',', 'Azerbaijani manat', '{sign}{number} {symbol}', 934, '{number} {symbol}', 'ман', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 31), -(11, '', 'BAM', 2, ',', 'Bosnia and Herzegovina convert', '{sign}{number} {symbol}', 977, '{number} {symbol}', 'KM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 32), -(12, '', 'BBD', 2, ',', 'Barbadian dollar', '{sign}{number} {symbol}', 52, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 33), -(13, '', 'BDT', 2, ',', 'Bangladeshi taka', '{sign}{number} {symbol}', 50, '{number} {symbol}', '৳', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 34), -(14, '', 'BGN', 2, ',', 'Bulgarian lev', '{sign}{number} {symbol}', 975, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 35), -(15, '', 'BHD', 2, ',', 'Bahraini dinar', '{sign}{number} {symbol}', 48, '{number} {symbol}', 'ب.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 36), -(16, '', 'BIF', '', '', 'Burundian franc', '{sign}{number} {symbol}', 108, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 37), -(17, '', 'BMD', 2, ',', 'Bermudian dollar', '{sign}{number} {symbol}', 60, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 38), -(18, '', 'BND', 2, ',', 'Brunei dollar', '{sign}{number} {symbol}', 96, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 39), -(19, '', 'BOB', 2, ',', 'Bolivian boliviano', '{sign}{number} {symbol}', 68, '{number} {symbol}', '$b', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 40), -(20, '', 'BOV', 2, ',', 'Mvdol', '{sign}{number} {symbol}', 984, '{number} {symbol}', 'BOV', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 41), -(21, '', 'BRL', 2, '.', 'Brazilian real', '{symbol} {sign}{number}', 986, '{symbol} {number}', 'R$', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 17), -(22, '', 'BSD', 2, ',', 'Bahamian dollar', '{sign}{number} {symbol}', 44, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 42), -(23, '', 'BTN', 2, ',', 'Bhutanese ngultrum', '{sign}{number} {symbol}', 64, '{number} {symbol}', 'BTN', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 43), -(24, '', 'BWP', 2, ',', 'Botswana pula', '{sign}{number} {symbol}', 72, '{number} {symbol}', 'P', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 44), -(25, '', 'BYR', '', '', 'Belarusian ruble', '{sign}{number} {symbol}', 974, '{number} {symbol}', 'p.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 45), -(26, '', 'BZD', 2, ',', 'Belize dollar', '{sign}{number} {symbol}', 84, '{number} {symbol}', 'BZ$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 46), -(27, '', 'CAD', 2, '.', 'Canadian dollar', '{symbol}{sign}{number}', 124, '{symbol}{number}', '$', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 7), -(28, '', 'CDF', 2, ',', 'Congolese franc', '{sign}{number} {symbol}', 976, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 47), -(29, '', 'CHE', 2, ',', 'WIR Euro', '{sign}{number} {symbol}', 947, '{number} {symbol}', '€', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 48), -(30, '', 'CHF', 2, ',', 'Swiss franc', '{sign}{number} {symbol}', 756, '{number} {symbol}', 'CHF', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 6), -(31, '', 'CHW', 2, ',', 'WIR Franc', '{sign}{number} {symbol}', 948, '{number} {symbol}', 'CHW', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 49), -(32, '', 'CLF', '', ',', 'Unidad de Fomento', '{sign}{number} {symbol}', 990, '{number} {symbol}', 'CLF', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 50), -(33, '', 'CLP', 2, ',', 'Chilean peso', '{sign}{number} {symbol}', 152, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 51), -(34, '', 'CNY', 2, ',', 'Chinese renminbi yuan', '{sign}{number} {symbol}', 156, '{number} {symbol}', '元', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 9), -(35, '', 'COP', 2, ',', 'Colombian peso', '{sign}{number} {symbol}', 170, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 52), -(36, '', 'COU', 2, ',', 'Unidad de Valor Real', '{sign}{number} {symbol}', 970, '{number} {symbol}', 'COU', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 53), -(37, '', 'CRC', 2, ',', 'Costa Rican colón', '{sign}{number} {symbol}', 188, '{number} {symbol}', '₡', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 54), -(38, '', 'CZK', 2, ',', 'Czech koruna', '{sign}{number} {symbol}', 203, '{number} {symbol}', 'Kč', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 57), -(39, '', 'CUP', 2, ',', 'Cuban peso', '{sign}{number} {symbol}', 192, '{number} {symbol}', '₱', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 55), -(40, '', 'CVE', '', '', 'Cape Verdean escudo', '{sign}{number} {symbol}', 132, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 56), -(41, '', 'DJF', '', '', 'Djiboutian franc', '{sign}{number} {symbol}', 262, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 58), -(42, '', 'DKK', 2, '.', 'Danish krone', '{symbol}{sign}{number}', 208, '{symbol}{number}', 'kr', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 19), -(43, '', 'DOP', 2, ',', 'Dominican peso', '{sign}{number} {symbol}', 214, '{number} {symbol}', 'RD$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 59), -(44, '', 'DZD', 2, ',', 'Algerian dinar', '{sign}{number} {symbol}', 12, '{number} {symbol}', 'د.ج', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 60), -(45, '', 'EGP', 2, ',', 'Egyptian pound', '{sign}{number} {symbol}', 818, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 61), -(46, '', 'ERN', 2, ',', 'Eritrean nakfa', '{sign}{number} {symbol}', 232, '{number} {symbol}', 'Nfk', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 62), -(47, '', 'ETB', 2, ',', 'Ethiopian birr', '{sign}{number} {symbol}', 230, '{number} {symbol}', 'ETB', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 63), -(48, '', 'EUR', 2, ',', 'Euro', '{sign}{number} {symbol}', 978, '{number} {symbol}', '€', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 2), -(49, '', 'FJD', 2, ',', 'Fijian dollar', '{sign}{number} {symbol}', 242, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 64), -(50, '', 'FKP', 2, ',', 'Falkland pound', '{sign}{number} {symbol}', 238, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 65), -(51, '', 'GBP', 2, '.', 'British pound', '{symbol}{sign}{number}', 826, '{symbol}{number}', '£', ',', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 4), -(52, '', 'GEL', 2, ',', 'Georgian lari', '{sign}{number} {symbol}', 981, '{number} {symbol}', 'ლ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 66), -(53, '', 'GHS', 2, ',', 'Ghanaian cedi', '{sign}{number} {symbol}', 936, '{number} {symbol}', '₵', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 67), -(54, '', 'GIP', 2, ',', 'Gibraltar pound', '{sign}{number} {symbol}', 292, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 68), -(55, '', 'GMD', 2, ',', 'Gambian dalasi', '{sign}{number} {symbol}', 270, '{number} {symbol}', 'D', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 69), -(56, '', 'GNF', '', '', 'Guinean franc', '{sign}{number} {symbol}', 324, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 70), -(57, '', 'GTQ', 2, ',', 'Guatemalan quetzal', '{sign}{number} {symbol}', 320, '{number} {symbol}', 'Q', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 71), -(58, '', 'GYD', 2, ',', 'Guyanese dollar', '{sign}{number} {symbol}', 328, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 72), -(59, '', 'HKD', 2, ',', 'Hong Kong dollar', '{sign}{number} {symbol}', 344, '{number} {symbol}', '元', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 13), -(60, '', 'HNL', 2, ',', 'Honduran lempira', '{sign}{number} {symbol}', 340, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 73), -(61, '', 'HRK', 2, ',', 'Croatian kuna', '{sign}{number} {symbol}', 191, '{number} {symbol}', 'kn', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 74), -(62, '', 'HTG', 2, ',', 'Haitian gourde', '{sign}{number} {symbol}', 332, '{number} {symbol}', 'G', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 75), -(63, '', 'HUF', 2, ',', 'Hungarian forint', '{sign}{number} {symbol}', 348, '{number} {symbol}', 'Ft', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 76), -(64, '', 'IDR', '', '', 'Indonesian rupiah', '{symbol}{sign}{number}', 360, '{symbol}{number}', 'Rp', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 77), -(65, '', 'ILS', 2, ',', 'Israeli new sheqel', '{sign}{number} {symbol}', 376, '{number} {symbol}', '₪', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 20), -(66, '', 'INR', 2, ',', 'Indian rupee', '{sign}{number} {symbol}', 356, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 16), -(67, '', 'IQD', '', '', 'Iraqi dinar', '{sign}{number} {symbol}', 368, '{number} {symbol}', 'ع.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 78), -(68, '', 'IRR', 2, ',', 'Iranian rial', '{sign}{number}{symb0l}', 364, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 79), -(69, '', 'ISK', 2, ',', 'Icelandic króna', '{sign}{number} {symbol}', 352, '{number} {symbol}', 'kr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 80), -(70, '', 'JMD', 2, ',', 'Jamaican dollar', '{sign}{number} {symbol}', 388, '{number} {symbol}', 'J$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 81), -(71, '', 'JOD', 2, ',', 'Jordanian dinar', '{sign}{number} {symbol}', 400, '{number} {symbol}', 'د.ا', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 82), -(72, '', 'JPY', 2, ',', 'Japanese yen', '{sign}{number} {symbol}', 392, '{number} {symbol}', '¥', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 3), -(73, '', 'KES', 2, ',', 'Kenyan shilling', '{sign}{number} {symbol}', 404, '{number} {symbol}', 'Sh', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 83), -(74, '', 'KGS', 2, ',', 'Kyrgyzstani som', '{sign}{number} {symbol}', 417, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 84), -(75, '', 'KHR', 2, ',', 'Cambodian riel', '{sign}{number} {symbol}', 116, '{number} {symbol}', '៛', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 85), -(76, '', 'KMF', '', '', 'Comorian franc', '{sign}{number} {symbol}', 174, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 86), -(77, '', 'KPW', '', '', 'North Korean won', '{sign}{number} {symbol}', 408, '{number} {symbol}', '₩', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 87), -(78, '', 'KRW', '', '', 'South Korean won', '{sign}{number} {symbol}', 410, '{number} {symbol}', '₩', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 21), -(79, '', 'KWD', 2, ',', 'Kuwaiti dinar', '{sign}{number} {symbol}', 414, '{number} {symbol}', 'د.ك', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 88), -(80, '', 'KYD', 2, ',', 'Cayman Islands dollar', '{sign}{number} {symbol}', 136, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 89), -(81, '', 'KZT', 2, ',', 'Kazakhstani tenge', '{sign}{number} {symbol}', 398, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 90), -(82, '', 'LAK', '', '', 'Lao kip', '{sign}{number} {symbol}', 418, '{number} {symbol}', '₭', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 91), -(83, '', 'LBP', '', '', 'Lebanese pound', '{sign}{number} {symbol}', 422, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 92), -(84, '', 'LKR', 2, ',', 'Sri Lankan rupee', '{sign}{number} {symbol}', 144, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 93), -(85, '', 'LRD', 2, ',', 'Liberian dollar', '{sign}{number} {symbol}', 430, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 94), -(86, '', 'LSL', 2, ',', 'Lesotho loti', '{sign}{number} {symbol}', 426, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 95), -(87, '', 'LTL', 2, ',', 'Lithuanian litas', '{sign}{number} {symbol}', 440, '{number} {symbol}', 'Lt', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 96), -(88, '', 'LVL', 2, ',', 'Latvian lats', '{sign}{number} {symbol}', 428, '{number} {symbol}', 'Ls', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 97), -(89, '', 'LYD', 3, ',', 'Libyan dinar', '{sign}{number} {symbol}', 434, '{number} {symbol}', 'ل.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 98), -(90, '', 'MAD', 2, ',', 'Moroccan dirham', '{sign}{number} {symbol}', 504, '{number} {symbol}', 'د.م.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 99), -(91, '', 'MDL', 2, ',', 'Moldovan leu', '{sign}{number} {symbol}', 498, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 100), -(92, '', 'MGA', 2, ',', 'Malagasy ariary', '{sign}{number} {symbol}', 969, '{number} {symbol}', 'MGA', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 101), -(93, '', 'MKD', 2, ',', 'Macedonian denar', '{sign}{number} {symbol}', 807, '{number} {symbol}', 'ден', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 102), -(94, '', 'MMK', 2, ',', 'Myanmar kyat', '{symbol} {sign}{number}', 104, '{number} {symbol}', 'K', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 103), -(95, '', 'MNT', 2, ',', 'Mongolian tögrög', '{sign}{number} {symbol}', 496, '{number} {symbol}', '₮', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 104), -(96, '', 'MOP', 1, ',', 'Macanese pataca', '{symbol}{sign}{number}', 446, '{symbol}{number}', 'P', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 105), -(97, '', 'MRO', 2, ',', 'Mauritanian ouguiya', '{sign}{number} {symbol}', 478, '{number} {symbol}', 'UM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 106), -(98, '', 'MUR', 2, ',', 'Mauritian rupee', '{sign}{number} {symbol}', 480, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 107), -(99, '', 'MVR', 2, ',', 'Maldivian rufiyaa', '{sign}{number} {symbol}', 462, '{number} {symbol}', 'ރ.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 108), -(100, '', 'MWK', 2, ',', 'Malawian kwacha', '{sign}{number} {symbol}', 454, '{number} {symbol}', 'MK', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 109), -(101, '', 'MXN', 2, ',', 'Mexican peso', '{sign}{number} {symbol}', 484, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 8), -(102, '', 'MXV', 2, ',', 'Mexican Unid', '{sign}{number} {symbol}', 979, '{number} {symbol}', 'MXV', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 110), -(103, '', 'MYR', 2, ',', 'Malaysian ringgit', '{sign}{number} {symbol}', 458, '{number} {symbol}', 'RM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 111), -(104, '', 'MZN', 2, ',', 'Mozambican metical', '{sign}{number} {symbol}', 943, '{number} {symbol}', 'MT', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 112), -(105, '', 'NAD', 2, ',', 'Namibian dollar', '{symbol} {sign}{number}', 516, '{symbol} {number}', 'N$', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 113), -(106, '', 'NGN', 2, ',', 'Nigerian naira', '{sign}{number} {symbol}', 566, '{number} {symbol}', '₦', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 114), -(107, '', 'NIO', 2, ',', 'Nicaraguan córdoba', '{sign}{number} {symbol}', 558, '{number} {symbol}', 'C$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 115), -(108, '', 'NOK', 2, ',', 'Norwegian krone', '{symbol}{sign}{number}', 578, '{symbol}{number}', 'kr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 18), -(109, '', 'NPR', 2, ',', 'Nepalese rupee', '{sign}{number} {symbol}', 524, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 116), -(110, '', 'NZD', 2, ',', 'New Zealand dollar', '{symbol}{sign}{number}', 554, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 10), -(111, '', 'OMR', 3, '.', 'Omani rial', '{sign}{number} {symbol}', 512, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 117), -(112, '', 'PAB', 2, ',', 'Panamanian balboa', '{sign}{number} {symbol}', 590, '{number} {symbol}', 'B/.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 118), -(113, '', 'PEN', 2, ',', 'Peruvian nuevo sol', '{sign}{number} {symbol}', 604, '{number} {symbol}', 'S/.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 119), -(114, '', 'PGK', 2, ',', 'Papua New Guinean kina', '{sign}{number} {symbol}', 598, '{number} {symbol}', 'K', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 120), -(115, '', 'PHP', 2, ',', 'Philippine peso', '{sign}{number} {symbol}', 608, '{number} {symbol}', '₱', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 121), -(116, '', 'PKR', 2, ',', 'Pakistani rupee', '{sign}{number} {symbol}', 586, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 122), -(117, '', 'PLN', 2, ',', 'Polish Złoty', '{sign}{number} {symbol}', 985, '{number} {symbol}', 'zł', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 123), -(118, '', 'PYG', '', '', 'Paraguayan guaraní', '{symbol} {sign}{number}', 600, '{symbol} {number}', '₲', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 124), -(119, '', 'QAR', 2, ',', 'Qatari riyal', '{sign}{number} {symbol}', 634, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 125), -(120, '', 'RON', 2, ',', 'Romanian leu', '{sign}{number} {symbol}', 946, '{number} {symbol}', 'lei', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 126), -(121, '', 'RWF', 2, ',', 'Rwandan franc', '{sign}{number} {symbol}', 646, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 128), -(122, '', 'SAR', 2, ',', 'Saudi riyal', '{sign}{number} {symbol}', 682, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 129), -(123, '', 'SBD', 2, ',', 'Solomon Islands dollar', '{sign}{number} {symbol}', 90, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 130), -(124, '', 'SCR', 2, ',', 'Seychellois rupee', '{sign}{number} {symbol}', 690, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 131), -(125, '', 'SDG', 2, ',', 'Sudanese pound', '{sign}{number} {symbol}', 938, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 132), -(126, '', 'SEK', 2, ',', 'Swedish krona', '{sign}{number} {symbol}', 752, '{number} {symbol}', 'kr', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 11), -(127, '', 'SGD', 2, ',', 'Singapore dollar', '{sign}{number} {symbol}', 702, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 14), -(128, '', 'SHP', 2, ',', 'Saint Helenian pound', '{sign}{number} {symbol}', 654, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 133), -(129, '', 'SLL', 2, ',', 'Sierra Leonean leone', '{sign}{number} {symbol}', 694, '{number} {symbol}', 'Le', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 134), -(130, '', 'SOS', 2, ',', 'Somali shilling', '{sign}{number} {symbol}', 706, '{number} {symbol}', 'S', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 135), -(131, '', 'SRD', 2, ',', 'Surinamese dollar', '{sign}{number} {symbol}', 968, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 136), -(132, '', 'STD', '', '', 'São Tomé and Príncipe dobra', '{sign}{number} {symbol}', 678, '{number} {symbol}', 'Db', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 137), -(133, '', 'RUB', 2, ',', 'Russian ruble', '{sign}{number} {symbol}', 643, '{number} {symbol}', 'руб', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 12), -(134, '', 'SVC', 2, ',', 'Salvadoran colón', '{sign}{number} {symbol}', 222, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 138), -(135, '', 'SYP', 2, ',', 'Syrian pound', '{sign}{number} {symbol}', 760, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 139), -(136, '', 'SZL', 2, ',', 'Swazi lilangeni', '{sign}{number} {symbol}', 748, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 140), -(137, '', 'THB', 2, ',', 'Thai baht', '{sign}{number} {symbol}', 764, '{number} {symbol}', '฿', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 141), -(138, '', 'TJS', 2, ',', 'Tajikistani somoni', '{sign}{number} {symbol}', 972, '{number} {symbol}', 'ЅМ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 142), -(139, '', 'TND', 3, ',', 'Tunisian dinar', '{sign}{number} {symbol}', 788, '{number} {symbol}', 'د.ت', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 143), -(140, '', 'TOP', 2, ',', 'Tongan paʻanga', '{sign}{number} {symbol}', 776, '{number} {symbol}', 'T$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 144), -(141, '', 'TRY', 2, ',', 'Turkish new lira', '{sign}{number} {symbol}', 949, '{number} {symbol}', 'YTL', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 15), -(142, '', 'TTD', 2, ',', 'Trinidad and Tobago dollar', '{sign}{number} {symbol}', 780, '{number} {symbol}', 'TT$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 145), -(143, '', 'TWD', 2, ',', 'New Taiwan dollar', '{sign}{number} {symbol}', 901, '{number} {symbol}', 'NT$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 146), -(144, '', 'TZS', 2, ',', 'Tanzanian shilling', '{sign}{number} {symbol}', 834, '{number} {symbol}', 'Sh', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 147), -(145, '', 'UAH', 2, ',', 'Ukrainian hryvnia', '{sign}{number} {symbol}', 980, '{number} {symbol}', '₴', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 148), -(146, '', 'UGX', 2, ',', 'Ugandan shilling', '{sign}{number} {symbol}', 800, '{number} {symbol}', 'Sh', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 149), -(147, '', 'USD', 2, '.', 'United States dollar', '{symbol}{sign}{number}', 840, '{symbol}{number}', '$', ',', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 1), -(148, '', 'UYI', 2, ',', 'Uruguay Peso', '{sign}{number} {symbol}', 940, '{number} {symbol}', 'UYI', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 150), -(149, '', 'UYU', '', '', 'Uruguayan peso', '{symbol}{sign}{number}', 858, '{symbol} {number}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 151), -(150, '', 'UZS', 2, ',', 'Uzbekistani som', '{sign}{number} {symbol}', 860, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 152), -(151, '', 'VEF', 2, ',', 'Venezuelan bolívar', '{sign}{number} {symbol}', 937, '{number} {symbol}', 'Bs', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 153), -(152, '', 'VND', '', '', 'Vietnamese Dong', '{sign}{number} {symbol}', 704, '{number} {symbol}', '₫', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 154), -(153, '', 'VUV', 2, ',', 'Vanuatu vatu', '{sign}{number} {symbol}', 548, '{number} {symbol}', 'Vt', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 155), -(154, '', 'WST', 2, ',', 'Samoan tala', '{sign}{number} {symbol}', 882, '{number} {symbol}', 'T', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 156), -(155, '', 'XAF', '', '', 'Central African CFA franc', '{sign}{number} {symbol}', 950, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 157), -(156, '', 'XCD', 2, ',', 'East Caribbean dollar', '{sign}{number} {symbol}', 951, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 158), -(157, '', 'XOF', 2, ',', 'West African CFA franc', '{sign}{number} {symbol}', 952, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 159), -(158, '', 'XPF', 2, ',', 'CFP franc', '{sign}{number} {symbol}', 953, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 160), -(159, '', 'YER', 2, ',', 'Yemeni rial', '{sign}{number} {symbol}', 886, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 161), -(160, '', 'RSD', 2, ',', 'Serbian dinar', '{sign}{number} {symbol}', 941, '{number} {symbol}', 'Дин.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 127), -(161, 'south-african-rand', 'ZAR', 2, ',', 'South African rand', '{symbol} {sign}{number}', 710, '{symbol} {number}', 'R', '', '', 1, '', 845, '0000-00-00 00:00:00', '2015-08-30 22:07:36', '', '0000-00-00 00:00:00', 2, '', 5, 22), -(162, '', 'ZMK', 2, ',', 'Zambian kwacha', '{sign}{number} {symbol}', 894, '{number} {symbol}', 'ZK', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 162), -(163, '', 'ZWD', 2, ',', 'Zimbabwean dollar', '{sign}{number} {symbol}', 932, '{number} {symbol}', 'Z$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 163), -(164, '', 'ZZZ', 2, ',', 'Reserved', '', '', '', 'O', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 164); - -- -- Dumping data for table `#__supportgroups_country` -- @@ -587,4 +534,174 @@ INSERT INTO `#__supportgroups_country` (`id`, `asset_id`, `alias`, `codethree`, (243, '', '', 'SRB', 'RS', 'SRB', 'Serbia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), (244, '', '', 'MAF', 'MF', 'EUR', 'Sint Maarten (French Antilles)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), (245, '', '', 'SXM', 'SX', 'ANG', 'Sint Maarten (Netherlands Antilles)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(246, '', '', 'ZZZ', 'ZZ', 'ZZZ', 'Reserved', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''); \ No newline at end of file +(246, '', '', 'ZZZ', 'ZZ', 'ZZZ', 'Reserved', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''); + +-- +-- Dumping data for table `#__supportgroups_currency` +-- + +INSERT INTO `#__supportgroups_currency` (`id`, `alias`, `codethree`, `decimalplace`, `decimalsymbol`, `name`, `negativestyle`, `numericcode`, `positivestyle`, `symbol`, `thousands`, `params`, `published`, `created_by`, `modified_by`, `created`, `modified`, `checked_out`, `checked_out_time`, `version`, `hits`, `access`, `ordering`) VALUES +(1, '', 'AED', 2, ',', 'United Arab Emirates dirham', '{sign}{number} {symbol}', 784, '{number} {symbol}', 'د.إ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 23), +(2, '', 'AFN', 2, ',', 'Afghan afghani', '{sign}{number} {symbol}', 971, '{number} {symbol}', '؋', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 24), +(3, '', 'ALL', 2, ',', 'Albanian lek', '{sign}{number} {symbol}', 8, '{number} {symbol}', 'Lek', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 25), +(4, '', 'AMD', 2, ',', 'Armenian dram', '{sign}{number} {symbol}', 51, '{number} {symbol}', 'դր.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 26), +(5, '', 'ANG', 2, ',', 'Netherlands Antillean gulden', '{sign}{number} {symbol}', 532, '{number} {symbol}', 'ƒ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 27), +(6, '', 'AOA', 2, ',', 'Angolan kwanza', '{sign}{number} {symbol}', 973, '{number} {symbol}', 'Kz', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 28), +(7, '', 'ARS', 2, ',', 'Argentine peso', '{sign}{number} {symbol}', 32, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 29), +(8, '', 'AUD', 2, '.', 'Australian dollar', '{sign}{symbol} {number}', 36, '{symbol} {number}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 5), +(9, '', 'AWG', 2, ',', 'Aruban florin', '{sign}{number} {symbol}', 533, '{number} {symbol}', 'ƒ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 30), +(10, '', 'AZN', 2, ',', 'Azerbaijani manat', '{sign}{number} {symbol}', 934, '{number} {symbol}', 'ман', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 31), +(11, '', 'BAM', 2, ',', 'Bosnia and Herzegovina convert', '{sign}{number} {symbol}', 977, '{number} {symbol}', 'KM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 32), +(12, '', 'BBD', 2, ',', 'Barbadian dollar', '{sign}{number} {symbol}', 52, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 33), +(13, '', 'BDT', 2, ',', 'Bangladeshi taka', '{sign}{number} {symbol}', 50, '{number} {symbol}', '৳', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 34), +(14, '', 'BGN', 2, ',', 'Bulgarian lev', '{sign}{number} {symbol}', 975, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 35), +(15, '', 'BHD', 2, ',', 'Bahraini dinar', '{sign}{number} {symbol}', 48, '{number} {symbol}', 'ب.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 36), +(16, '', 'BIF', '', '', 'Burundian franc', '{sign}{number} {symbol}', 108, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 37), +(17, '', 'BMD', 2, ',', 'Bermudian dollar', '{sign}{number} {symbol}', 60, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 38), +(18, '', 'BND', 2, ',', 'Brunei dollar', '{sign}{number} {symbol}', 96, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 39), +(19, '', 'BOB', 2, ',', 'Bolivian boliviano', '{sign}{number} {symbol}', 68, '{number} {symbol}', '$b', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 40), +(20, '', 'BOV', 2, ',', 'Mvdol', '{sign}{number} {symbol}', 984, '{number} {symbol}', 'BOV', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 41), +(21, '', 'BRL', 2, '.', 'Brazilian real', '{symbol} {sign}{number}', 986, '{symbol} {number}', 'R$', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 17), +(22, '', 'BSD', 2, ',', 'Bahamian dollar', '{sign}{number} {symbol}', 44, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 42), +(23, '', 'BTN', 2, ',', 'Bhutanese ngultrum', '{sign}{number} {symbol}', 64, '{number} {symbol}', 'BTN', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 43), +(24, '', 'BWP', 2, ',', 'Botswana pula', '{sign}{number} {symbol}', 72, '{number} {symbol}', 'P', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 44), +(25, '', 'BYR', '', '', 'Belarusian ruble', '{sign}{number} {symbol}', 974, '{number} {symbol}', 'p.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 45), +(26, '', 'BZD', 2, ',', 'Belize dollar', '{sign}{number} {symbol}', 84, '{number} {symbol}', 'BZ$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 46), +(27, '', 'CAD', 2, '.', 'Canadian dollar', '{symbol}{sign}{number}', 124, '{symbol}{number}', '$', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 7), +(28, '', 'CDF', 2, ',', 'Congolese franc', '{sign}{number} {symbol}', 976, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 47), +(29, '', 'CHE', 2, ',', 'WIR Euro', '{sign}{number} {symbol}', 947, '{number} {symbol}', '€', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 48), +(30, '', 'CHF', 2, ',', 'Swiss franc', '{sign}{number} {symbol}', 756, '{number} {symbol}', 'CHF', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 6), +(31, '', 'CHW', 2, ',', 'WIR Franc', '{sign}{number} {symbol}', 948, '{number} {symbol}', 'CHW', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 49), +(32, '', 'CLF', '', ',', 'Unidad de Fomento', '{sign}{number} {symbol}', 990, '{number} {symbol}', 'CLF', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 50), +(33, '', 'CLP', 2, ',', 'Chilean peso', '{sign}{number} {symbol}', 152, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 51), +(34, '', 'CNY', 2, ',', 'Chinese renminbi yuan', '{sign}{number} {symbol}', 156, '{number} {symbol}', '元', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 9), +(35, '', 'COP', 2, ',', 'Colombian peso', '{sign}{number} {symbol}', 170, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 52), +(36, '', 'COU', 2, ',', 'Unidad de Valor Real', '{sign}{number} {symbol}', 970, '{number} {symbol}', 'COU', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 53), +(37, '', 'CRC', 2, ',', 'Costa Rican colón', '{sign}{number} {symbol}', 188, '{number} {symbol}', '₡', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 54), +(38, '', 'CZK', 2, ',', 'Czech koruna', '{sign}{number} {symbol}', 203, '{number} {symbol}', 'Kč', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 57), +(39, '', 'CUP', 2, ',', 'Cuban peso', '{sign}{number} {symbol}', 192, '{number} {symbol}', '₱', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 55), +(40, '', 'CVE', '', '', 'Cape Verdean escudo', '{sign}{number} {symbol}', 132, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 56), +(41, '', 'DJF', '', '', 'Djiboutian franc', '{sign}{number} {symbol}', 262, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 58), +(42, '', 'DKK', 2, '.', 'Danish krone', '{symbol}{sign}{number}', 208, '{symbol}{number}', 'kr', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 19), +(43, '', 'DOP', 2, ',', 'Dominican peso', '{sign}{number} {symbol}', 214, '{number} {symbol}', 'RD$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 59), +(44, '', 'DZD', 2, ',', 'Algerian dinar', '{sign}{number} {symbol}', 12, '{number} {symbol}', 'د.ج', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 60), +(45, '', 'EGP', 2, ',', 'Egyptian pound', '{sign}{number} {symbol}', 818, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 61), +(46, '', 'ERN', 2, ',', 'Eritrean nakfa', '{sign}{number} {symbol}', 232, '{number} {symbol}', 'Nfk', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 62), +(47, '', 'ETB', 2, ',', 'Ethiopian birr', '{sign}{number} {symbol}', 230, '{number} {symbol}', 'ETB', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 63), +(48, '', 'EUR', 2, ',', 'Euro', '{sign}{number} {symbol}', 978, '{number} {symbol}', '€', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 2), +(49, '', 'FJD', 2, ',', 'Fijian dollar', '{sign}{number} {symbol}', 242, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 64), +(50, '', 'FKP', 2, ',', 'Falkland pound', '{sign}{number} {symbol}', 238, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 65), +(51, '', 'GBP', 2, '.', 'British pound', '{symbol}{sign}{number}', 826, '{symbol}{number}', '£', ',', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 4), +(52, '', 'GEL', 2, ',', 'Georgian lari', '{sign}{number} {symbol}', 981, '{number} {symbol}', 'ლ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 66), +(53, '', 'GHS', 2, ',', 'Ghanaian cedi', '{sign}{number} {symbol}', 936, '{number} {symbol}', '₵', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 67), +(54, '', 'GIP', 2, ',', 'Gibraltar pound', '{sign}{number} {symbol}', 292, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 68), +(55, '', 'GMD', 2, ',', 'Gambian dalasi', '{sign}{number} {symbol}', 270, '{number} {symbol}', 'D', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 69), +(56, '', 'GNF', '', '', 'Guinean franc', '{sign}{number} {symbol}', 324, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 70), +(57, '', 'GTQ', 2, ',', 'Guatemalan quetzal', '{sign}{number} {symbol}', 320, '{number} {symbol}', 'Q', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 71), +(58, '', 'GYD', 2, ',', 'Guyanese dollar', '{sign}{number} {symbol}', 328, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 72), +(59, '', 'HKD', 2, ',', 'Hong Kong dollar', '{sign}{number} {symbol}', 344, '{number} {symbol}', '元', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 13), +(60, '', 'HNL', 2, ',', 'Honduran lempira', '{sign}{number} {symbol}', 340, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 73), +(61, '', 'HRK', 2, ',', 'Croatian kuna', '{sign}{number} {symbol}', 191, '{number} {symbol}', 'kn', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 74), +(62, '', 'HTG', 2, ',', 'Haitian gourde', '{sign}{number} {symbol}', 332, '{number} {symbol}', 'G', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 75), +(63, '', 'HUF', 2, ',', 'Hungarian forint', '{sign}{number} {symbol}', 348, '{number} {symbol}', 'Ft', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 76), +(64, '', 'IDR', '', '', 'Indonesian rupiah', '{symbol}{sign}{number}', 360, '{symbol}{number}', 'Rp', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 77), +(65, '', 'ILS', 2, ',', 'Israeli new sheqel', '{sign}{number} {symbol}', 376, '{number} {symbol}', '₪', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 20), +(66, '', 'INR', 2, ',', 'Indian rupee', '{sign}{number} {symbol}', 356, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 16), +(67, '', 'IQD', '', '', 'Iraqi dinar', '{sign}{number} {symbol}', 368, '{number} {symbol}', 'ع.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 78), +(68, '', 'IRR', 2, ',', 'Iranian rial', '{sign}{number}{symb0l}', 364, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 79), +(69, '', 'ISK', 2, ',', 'Icelandic króna', '{sign}{number} {symbol}', 352, '{number} {symbol}', 'kr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 80), +(70, '', 'JMD', 2, ',', 'Jamaican dollar', '{sign}{number} {symbol}', 388, '{number} {symbol}', 'J$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 81), +(71, '', 'JOD', 2, ',', 'Jordanian dinar', '{sign}{number} {symbol}', 400, '{number} {symbol}', 'د.ا', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 82), +(72, '', 'JPY', 2, ',', 'Japanese yen', '{sign}{number} {symbol}', 392, '{number} {symbol}', '¥', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 3), +(73, '', 'KES', 2, ',', 'Kenyan shilling', '{sign}{number} {symbol}', 404, '{number} {symbol}', 'Sh', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 83), +(74, '', 'KGS', 2, ',', 'Kyrgyzstani som', '{sign}{number} {symbol}', 417, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 84), +(75, '', 'KHR', 2, ',', 'Cambodian riel', '{sign}{number} {symbol}', 116, '{number} {symbol}', '៛', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 85), +(76, '', 'KMF', '', '', 'Comorian franc', '{sign}{number} {symbol}', 174, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 86), +(77, '', 'KPW', '', '', 'North Korean won', '{sign}{number} {symbol}', 408, '{number} {symbol}', '₩', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 87), +(78, '', 'KRW', '', '', 'South Korean won', '{sign}{number} {symbol}', 410, '{number} {symbol}', '₩', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 21), +(79, '', 'KWD', 2, ',', 'Kuwaiti dinar', '{sign}{number} {symbol}', 414, '{number} {symbol}', 'د.ك', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 88), +(80, '', 'KYD', 2, ',', 'Cayman Islands dollar', '{sign}{number} {symbol}', 136, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 89), +(81, '', 'KZT', 2, ',', 'Kazakhstani tenge', '{sign}{number} {symbol}', 398, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 90), +(82, '', 'LAK', '', '', 'Lao kip', '{sign}{number} {symbol}', 418, '{number} {symbol}', '₭', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 91), +(83, '', 'LBP', '', '', 'Lebanese pound', '{sign}{number} {symbol}', 422, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 92), +(84, '', 'LKR', 2, ',', 'Sri Lankan rupee', '{sign}{number} {symbol}', 144, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 93), +(85, '', 'LRD', 2, ',', 'Liberian dollar', '{sign}{number} {symbol}', 430, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 94), +(86, '', 'LSL', 2, ',', 'Lesotho loti', '{sign}{number} {symbol}', 426, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 95), +(87, '', 'LTL', 2, ',', 'Lithuanian litas', '{sign}{number} {symbol}', 440, '{number} {symbol}', 'Lt', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 96), +(88, '', 'LVL', 2, ',', 'Latvian lats', '{sign}{number} {symbol}', 428, '{number} {symbol}', 'Ls', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 97), +(89, '', 'LYD', 3, ',', 'Libyan dinar', '{sign}{number} {symbol}', 434, '{number} {symbol}', 'ل.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 98), +(90, '', 'MAD', 2, ',', 'Moroccan dirham', '{sign}{number} {symbol}', 504, '{number} {symbol}', 'د.م.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 99), +(91, '', 'MDL', 2, ',', 'Moldovan leu', '{sign}{number} {symbol}', 498, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 100), +(92, '', 'MGA', 2, ',', 'Malagasy ariary', '{sign}{number} {symbol}', 969, '{number} {symbol}', 'MGA', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 101), +(93, '', 'MKD', 2, ',', 'Macedonian denar', '{sign}{number} {symbol}', 807, '{number} {symbol}', 'ден', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 102), +(94, '', 'MMK', 2, ',', 'Myanmar kyat', '{symbol} {sign}{number}', 104, '{number} {symbol}', 'K', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 103), +(95, '', 'MNT', 2, ',', 'Mongolian tögrög', '{sign}{number} {symbol}', 496, '{number} {symbol}', '₮', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 104), +(96, '', 'MOP', 1, ',', 'Macanese pataca', '{symbol}{sign}{number}', 446, '{symbol}{number}', 'P', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 105), +(97, '', 'MRO', 2, ',', 'Mauritanian ouguiya', '{sign}{number} {symbol}', 478, '{number} {symbol}', 'UM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 106), +(98, '', 'MUR', 2, ',', 'Mauritian rupee', '{sign}{number} {symbol}', 480, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 107), +(99, '', 'MVR', 2, ',', 'Maldivian rufiyaa', '{sign}{number} {symbol}', 462, '{number} {symbol}', 'ރ.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 108), +(100, '', 'MWK', 2, ',', 'Malawian kwacha', '{sign}{number} {symbol}', 454, '{number} {symbol}', 'MK', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 109), +(101, '', 'MXN', 2, ',', 'Mexican peso', '{sign}{number} {symbol}', 484, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 8), +(102, '', 'MXV', 2, ',', 'Mexican Unid', '{sign}{number} {symbol}', 979, '{number} {symbol}', 'MXV', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 110), +(103, '', 'MYR', 2, ',', 'Malaysian ringgit', '{sign}{number} {symbol}', 458, '{number} {symbol}', 'RM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 111), +(104, '', 'MZN', 2, ',', 'Mozambican metical', '{sign}{number} {symbol}', 943, '{number} {symbol}', 'MT', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 112), +(105, '', 'NAD', 2, ',', 'Namibian dollar', '{symbol} {sign}{number}', 516, '{symbol} {number}', 'N$', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 113), +(106, '', 'NGN', 2, ',', 'Nigerian naira', '{sign}{number} {symbol}', 566, '{number} {symbol}', '₦', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 114), +(107, '', 'NIO', 2, ',', 'Nicaraguan córdoba', '{sign}{number} {symbol}', 558, '{number} {symbol}', 'C$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 115), +(108, '', 'NOK', 2, ',', 'Norwegian krone', '{symbol}{sign}{number}', 578, '{symbol}{number}', 'kr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 18), +(109, '', 'NPR', 2, ',', 'Nepalese rupee', '{sign}{number} {symbol}', 524, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 116), +(110, '', 'NZD', 2, ',', 'New Zealand dollar', '{symbol}{sign}{number}', 554, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 10), +(111, '', 'OMR', 3, '.', 'Omani rial', '{sign}{number} {symbol}', 512, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 117), +(112, '', 'PAB', 2, ',', 'Panamanian balboa', '{sign}{number} {symbol}', 590, '{number} {symbol}', 'B/.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 118), +(113, '', 'PEN', 2, ',', 'Peruvian nuevo sol', '{sign}{number} {symbol}', 604, '{number} {symbol}', 'S/.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 119), +(114, '', 'PGK', 2, ',', 'Papua New Guinean kina', '{sign}{number} {symbol}', 598, '{number} {symbol}', 'K', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 120), +(115, '', 'PHP', 2, ',', 'Philippine peso', '{sign}{number} {symbol}', 608, '{number} {symbol}', '₱', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 121), +(116, '', 'PKR', 2, ',', 'Pakistani rupee', '{sign}{number} {symbol}', 586, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 122), +(117, '', 'PLN', 2, ',', 'Polish Złoty', '{sign}{number} {symbol}', 985, '{number} {symbol}', 'zł', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 123), +(118, '', 'PYG', '', '', 'Paraguayan guaraní', '{symbol} {sign}{number}', 600, '{symbol} {number}', '₲', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 124), +(119, '', 'QAR', 2, ',', 'Qatari riyal', '{sign}{number} {symbol}', 634, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 125), +(120, '', 'RON', 2, ',', 'Romanian leu', '{sign}{number} {symbol}', 946, '{number} {symbol}', 'lei', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 126), +(121, '', 'RWF', 2, ',', 'Rwandan franc', '{sign}{number} {symbol}', 646, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 128), +(122, '', 'SAR', 2, ',', 'Saudi riyal', '{sign}{number} {symbol}', 682, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 129), +(123, '', 'SBD', 2, ',', 'Solomon Islands dollar', '{sign}{number} {symbol}', 90, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 130), +(124, '', 'SCR', 2, ',', 'Seychellois rupee', '{sign}{number} {symbol}', 690, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 131), +(125, '', 'SDG', 2, ',', 'Sudanese pound', '{sign}{number} {symbol}', 938, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 132), +(126, '', 'SEK', 2, ',', 'Swedish krona', '{sign}{number} {symbol}', 752, '{number} {symbol}', 'kr', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 11), +(127, '', 'SGD', 2, ',', 'Singapore dollar', '{sign}{number} {symbol}', 702, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 14), +(128, '', 'SHP', 2, ',', 'Saint Helenian pound', '{sign}{number} {symbol}', 654, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 133), +(129, '', 'SLL', 2, ',', 'Sierra Leonean leone', '{sign}{number} {symbol}', 694, '{number} {symbol}', 'Le', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 134), +(130, '', 'SOS', 2, ',', 'Somali shilling', '{sign}{number} {symbol}', 706, '{number} {symbol}', 'S', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 135), +(131, '', 'SRD', 2, ',', 'Surinamese dollar', '{sign}{number} {symbol}', 968, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 136), +(132, '', 'STD', '', '', 'São Tomé and Príncipe dobra', '{sign}{number} {symbol}', 678, '{number} {symbol}', 'Db', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 137), +(133, '', 'RUB', 2, ',', 'Russian ruble', '{sign}{number} {symbol}', 643, '{number} {symbol}', 'руб', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 12), +(134, '', 'SVC', 2, ',', 'Salvadoran colón', '{sign}{number} {symbol}', 222, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 138), +(135, '', 'SYP', 2, ',', 'Syrian pound', '{sign}{number} {symbol}', 760, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 139), +(136, '', 'SZL', 2, ',', 'Swazi lilangeni', '{sign}{number} {symbol}', 748, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 140), +(137, '', 'THB', 2, ',', 'Thai baht', '{sign}{number} {symbol}', 764, '{number} {symbol}', '฿', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 141), +(138, '', 'TJS', 2, ',', 'Tajikistani somoni', '{sign}{number} {symbol}', 972, '{number} {symbol}', 'ЅМ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 142), +(139, '', 'TND', 3, ',', 'Tunisian dinar', '{sign}{number} {symbol}', 788, '{number} {symbol}', 'د.ت', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 143), +(140, '', 'TOP', 2, ',', 'Tongan paʻanga', '{sign}{number} {symbol}', 776, '{number} {symbol}', 'T$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 144), +(141, '', 'TRY', 2, ',', 'Turkish new lira', '{sign}{number} {symbol}', 949, '{number} {symbol}', 'YTL', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 15), +(142, '', 'TTD', 2, ',', 'Trinidad and Tobago dollar', '{sign}{number} {symbol}', 780, '{number} {symbol}', 'TT$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 145), +(143, '', 'TWD', 2, ',', 'New Taiwan dollar', '{sign}{number} {symbol}', 901, '{number} {symbol}', 'NT$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 146), +(144, '', 'TZS', 2, ',', 'Tanzanian shilling', '{sign}{number} {symbol}', 834, '{number} {symbol}', 'Sh', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 147), +(145, '', 'UAH', 2, ',', 'Ukrainian hryvnia', '{sign}{number} {symbol}', 980, '{number} {symbol}', '₴', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 148), +(146, '', 'UGX', 2, ',', 'Ugandan shilling', '{sign}{number} {symbol}', 800, '{number} {symbol}', 'Sh', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 149), +(147, '', 'USD', 2, '.', 'United States dollar', '{symbol}{sign}{number}', 840, '{symbol}{number}', '$', ',', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 1), +(148, '', 'UYI', 2, ',', 'Uruguay Peso', '{sign}{number} {symbol}', 940, '{number} {symbol}', 'UYI', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 150), +(149, '', 'UYU', '', '', 'Uruguayan peso', '{symbol}{sign}{number}', 858, '{symbol} {number}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 151), +(150, '', 'UZS', 2, ',', 'Uzbekistani som', '{sign}{number} {symbol}', 860, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 152), +(151, '', 'VEF', 2, ',', 'Venezuelan bolívar', '{sign}{number} {symbol}', 937, '{number} {symbol}', 'Bs', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 153), +(152, '', 'VND', '', '', 'Vietnamese Dong', '{sign}{number} {symbol}', 704, '{number} {symbol}', '₫', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 154), +(153, '', 'VUV', 2, ',', 'Vanuatu vatu', '{sign}{number} {symbol}', 548, '{number} {symbol}', 'Vt', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 155), +(154, '', 'WST', 2, ',', 'Samoan tala', '{sign}{number} {symbol}', 882, '{number} {symbol}', 'T', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 156), +(155, '', 'XAF', '', '', 'Central African CFA franc', '{sign}{number} {symbol}', 950, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 157), +(156, '', 'XCD', 2, ',', 'East Caribbean dollar', '{sign}{number} {symbol}', 951, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 158), +(157, '', 'XOF', 2, ',', 'West African CFA franc', '{sign}{number} {symbol}', 952, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 159), +(158, '', 'XPF', 2, ',', 'CFP franc', '{sign}{number} {symbol}', 953, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 160), +(159, '', 'YER', 2, ',', 'Yemeni rial', '{sign}{number} {symbol}', 886, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 161), +(160, '', 'RSD', 2, ',', 'Serbian dinar', '{sign}{number} {symbol}', 941, '{number} {symbol}', 'Дин.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 127), +(161, 'south-african-rand', 'ZAR', 2, ',', 'South African rand', '{symbol} {sign}{number}', 710, '{symbol} {number}', 'R', '', '', 1, '', 845, '0000-00-00 00:00:00', '2015-08-30 22:07:36', '', '0000-00-00 00:00:00', 2, '', 5, 22), +(162, '', 'ZMK', 2, ',', 'Zambian kwacha', '{sign}{number} {symbol}', 894, '{number} {symbol}', 'ZK', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 162), +(163, '', 'ZWD', 2, ',', 'Zimbabwean dollar', '{sign}{number} {symbol}', 932, '{number} {symbol}', 'Z$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 163), +(164, '', 'ZZZ', 2, ',', 'Reserved', '', '', '', 'O', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 164); \ No newline at end of file diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index cb295c5..0c2aa88 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -1,5 +1,8 @@ DROP TABLE IF EXISTS `#__supportgroups_support_group`; +DROP TABLE IF EXISTS `#__supportgroups_payment`; +DROP TABLE IF EXISTS `#__supportgroups_clinic`; DROP TABLE IF EXISTS `#__supportgroups_location`; DROP TABLE IF EXISTS `#__supportgroups_region`; -DROP TABLE IF EXISTS `#__supportgroups_currency`; DROP TABLE IF EXISTS `#__supportgroups_country`; +DROP TABLE IF EXISTS `#__supportgroups_currency`; +DROP TABLE IF EXISTS `#__supportgroups_help_document`; diff --git a/admin/tables/clinic.php b/admin/tables/clinic.php new file mode 100644 index 0000000..2729e62 --- /dev/null +++ b/admin/tables/clinic.php @@ -0,0 +1,351 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla table library +jimport('joomla.database.table'); + +/** + * Clinics Table class + */ +class SupportgroupsTableClinic extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__supportgroups_clinic', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_supportgroups.clinic')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Clinic table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New clinic. A clinic created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('clinic', 'SupportgroupsTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_SUPPORTGROUPS_CLINIC_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('clinic', 'supportgroupsTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_supportgroups.clinic.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count($_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_supportgroups.clinic.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_supportgroups'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); + } + + return $this->alias; + } + +} diff --git a/admin/tables/help_document.php b/admin/tables/help_document.php new file mode 100644 index 0000000..648353d --- /dev/null +++ b/admin/tables/help_document.php @@ -0,0 +1,351 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla table library +jimport('joomla.database.table'); + +/** + * Help_documents Table class + */ +class SupportgroupsTableHelp_document extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__supportgroups_help_document', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_supportgroups.help_document')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Help_document table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New help_document. A help_document created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('help_document', 'SupportgroupsTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('help_document', 'supportgroupsTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_supportgroups.help_document.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count($_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_supportgroups.help_document.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_supportgroups'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); + } + + return $this->alias; + } + +} diff --git a/admin/tables/payment.php b/admin/tables/payment.php new file mode 100644 index 0000000..d816df6 --- /dev/null +++ b/admin/tables/payment.php @@ -0,0 +1,351 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +use Joomla\Registry\Registry; + +// import Joomla table library +jimport('joomla.database.table'); + +/** + * Payments Table class + */ +class SupportgroupsTablePayment extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__supportgroups_payment', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_supportgroups.payment')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Payment table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New payment. A payment created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('payment', 'SupportgroupsTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_SUPPORTGROUPS_PAYMENT_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('payment', 'supportgroupsTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = JString::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_supportgroups.payment.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset alread set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count($_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_supportgroups.payment.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_supportgroups'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); + } + + return $this->alias; + } + +} diff --git a/admin/views/clinic/submitbutton.js b/admin/views/clinic/submitbutton.js new file mode 100644 index 0000000..9bcccff --- /dev/null +++ b/admin/views/clinic/submitbutton.js @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var isValid=true; + var action = task.split('.'); + if (action[1] != 'cancel' && action[1] != 'close'){ + var forms = $$('form.form-validate'); + for (var i=0;i + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = JComponentHelper::getParams('com_supportgroups'); +?> + +
+ +
+ + 'details')); ?> + + +
+
+
+
+ +
+
+ + + canDo->get('clinic.delete') || $this->canDo->get('clinic.edit.created_by') || $this->canDo->get('clinic.edit.state') || $this->canDo->get('clinic.edit.created')) : ?> + +
+
+ +
+
+ +
+
+ + + + canDo->get('core.admin')) : ?> + +
+
+
+
+ form->getFieldset('accesscontrol') as $field): ?> +
+ label; echo $field->input;?> +
+
+ +
+
+
+
+ + + + + +
+ + +
+
+ +
+ +
diff --git a/admin/views/clinic/tmpl/index.html b/admin/views/clinic/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/clinic/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/clinic/view.html.php b/admin/views/clinic/view.html.php new file mode 100644 index 0000000..5e0a94a --- /dev/null +++ b/admin/views/clinic/view.html.php @@ -0,0 +1,200 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Clinic View class + */ +class SupportgroupsViewClinic extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = SupportgroupsHelper::getActions('clinic',$this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $this->referral = ''; + if ($this->refid) + { + // return to the item that refered to this item + $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that refered to this item + $this->referral = '&ref='.(string)$this->ref; + } + + // Set the toolbar + $this->addToolBar(); + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_SUPPORTGROUPS_CLINIC_NEW' : 'COM_SUPPORTGROUPS_CLINIC_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if ($this->refid || $this->ref) + { + if ($this->canDo->get('clinic.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('clinic.edit')) + { + // We can save the record. + JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('clinic.create')) + { + JToolBarHelper::apply('clinic.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('clinic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('clinic.edit')) + { + // We can save the new record + JToolBarHelper::apply('clinic.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('clinic.create')) + { + JToolBarHelper::custom('clinic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('clinic.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('clinic.edit') && $canVersion) + { + JToolbarHelper::versions('com_supportgroups.clinic', $this->item->id); + } + if ($this->canDo->get('clinic.create')) + { + JToolBarHelper::custom('clinic.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = SupportgroupsHelper::getHelpUrl('clinic'); + if (SupportgroupsHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SUPPORTGROUPS_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return SupportgroupsHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return SupportgroupsHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + $document = JFactory::getDocument(); + $document->setTitle(JText::_($isNew ? 'COM_SUPPORTGROUPS_CLINIC_NEW' : 'COM_SUPPORTGROUPS_CLINIC_EDIT')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/clinic.css"); + $document->addScript(JURI::root() . $this->script); + $document->addScript(JURI::root() . "administrator/components/com_supportgroups/views/clinic/submitbutton.js"); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/clinics/index.html b/admin/views/clinics/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/clinics/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default.php b/admin/views/clinics/tmpl/default.php new file mode 100644 index 0000000..b87186f --- /dev/null +++ b/admin/views/clinics/tmpl/default.php @@ -0,0 +1,99 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_supportgroups&task=clinics.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'clinicList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +items)): ?> + loadTemplate('toolbar');?> +
+ +
+ + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_SUPPORTGROUPS_CLINICS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
+ + + + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_batch_body.php b/admin/views/clinics/tmpl/default_batch_body.php new file mode 100644 index 0000000..0bfc18d --- /dev/null +++ b/admin/views/clinics/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_batch_footer.php b/admin/views/clinics/tmpl/default_batch_footer.php new file mode 100644 index 0000000..3d1745a --- /dev/null +++ b/admin/views/clinics/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_body.php b/admin/views/clinics/tmpl/default_body.php new file mode 100644 index 0000000..ee31a00 --- /dev/null +++ b/admin/views/clinics/tmpl/default_body.php @@ -0,0 +1,111 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_supportgroups&view=clinics&task=clinic.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = SupportgroupsHelper::getActions('clinic',$item,'clinics'); + ?> + + + get('clinic.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('clinic.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + + get('clinic.edit')): ?> +
+ escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'clinics.', $canCheckin); ?> + +
+ +
escape($item->name); ?>
+ + + + escape($item->phone); ?> + + + get('clinic.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'clinics.', true, 'cb'); ?> + + published, $i, 'clinics.', false, 'cb'); ?> + + + published, $i, 'clinics.', true, 'cb'); ?> + + + published, $i, 'clinics.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_foot.php b/admin/views/clinics/tmpl/default_foot.php new file mode 100644 index 0000000..a1195e8 --- /dev/null +++ b/admin/views/clinics/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_head.php b/admin/views/clinics/tmpl/default_head.php new file mode 100644 index 0000000..bc41afe --- /dev/null +++ b/admin/views/clinics/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_toolbar.php b/admin/views/clinics/tmpl/default_toolbar.php new file mode 100644 index 0000000..847c958 --- /dev/null +++ b/admin/views/clinics/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/clinics/tmpl/index.html b/admin/views/clinics/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/clinics/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/clinics/view.html.php b/admin/views/clinics/view.html.php new file mode 100644 index 0000000..6602a8b --- /dev/null +++ b/admin/views/clinics/view.html.php @@ -0,0 +1,251 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Supportgroups View class for the Clinics + */ +class SupportgroupsViewClinics extends JViewLegacy +{ + /** + * Clinics view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + SupportgroupsHelper::addSubmenu('clinics'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // get global action permissions + $this->canDo = SupportgroupsHelper::getActions('clinic'); + $this->canEdit = $this->canDo->get('clinic.edit'); + $this->canState = $this->canDo->get('clinic.edit.state'); + $this->canCreate = $this->canDo->get('clinic.create'); + $this->canDelete = $this->canDo->get('clinic.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_SUPPORTGROUPS_CLINICS'), 'health'); + JHtmlSidebar::setAction('index.php?option=com_supportgroups&view=clinics'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('clinic.add'); + } + + // Only load if there are items + if (SupportgroupsHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('clinic.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('clinics.publish'); + JToolBarHelper::unpublishList('clinics.unpublish'); + JToolBarHelper::archiveList('clinics.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('clinics.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'clinics.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('clinics.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('clinic.export')) + { + JToolBarHelper::custom('clinics.exportData', 'download', '', 'COM_SUPPORTGROUPS_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('clinic.import')) + { + JToolBarHelper::custom('clinics.importData', 'upload', '', 'COM_SUPPORTGROUPS_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = SupportgroupsHelper::getHelpUrl('clinics'); + if (SupportgroupsHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SUPPORTGROUPS_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_supportgroups'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SUPPORTGROUPS_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SUPPORTGROUPS_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $document = JFactory::getDocument(); + $document->setTitle(JText::_('COM_SUPPORTGROUPS_CLINICS')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/clinics.css"); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return SupportgroupsHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return SupportgroupsHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_SUPPORTGROUPS_CLINIC_NAME_LABEL'), + 'a.phone' => JText::_('COM_SUPPORTGROUPS_CLINIC_PHONE_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/country/tmpl/edit.php b/admin/views/country/tmpl/edit.php index 7c1acb8..3cf1a2f 100644 --- a/admin/views/country/tmpl/edit.php +++ b/admin/views/country/tmpl/edit.php @@ -51,6 +51,7 @@ $componentParams = JComponentHelper::getParams('com_supportgroups');
+ canDo->get('region.access')) : ?>
@@ -60,6 +61,7 @@ $componentParams = JComponentHelper::getParams('com_supportgroups');
+ canDo->get('country.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('country.edit.state') || $this->canDo->get('core.edit.created')) : ?> diff --git a/admin/views/country/view.html.php b/admin/views/country/view.html.php index dd7c41c..d3eca6e 100644 --- a/admin/views/country/view.html.php +++ b/admin/views/country/view.html.php @@ -71,7 +71,7 @@ class SupportgroupsViewCountry extends JViewLegacy } // Get Linked view data - $this->vvvregions = $this->get('Vvvregions'); + $this->vvyregions = $this->get('Vvyregions'); // Set the toolbar $this->addToolBar(); diff --git a/admin/views/help_document/submitbutton.js b/admin/views/help_document/submitbutton.js new file mode 100644 index 0000000..cefd160 --- /dev/null +++ b/admin/views/help_document/submitbutton.js @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var isValid=true; + var action = task.split('.'); + if (action[1] != 'cancel' && action[1] != 'close'){ + var forms = $$('form.form-validate'); + for (var i=0;i + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = JComponentHelper::getParams('com_supportgroups'); +?> + +
+ +
+ + 'details')); ?> + + +
+
+ +
+
+ +
+
+
+
+ +
+
+ + + canDo->get('help_document.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('help_document.edit.state') || $this->canDo->get('core.edit.created')) : ?> + +
+
+ +
+
+ +
+
+ + + + canDo->get('core.admin')) : ?> + +
+
+
+
+ form->getFieldset('accesscontrol') as $field): ?> +
+ label; echo $field->input;?> +
+
+ +
+
+
+
+ + + + + +
+ + +
+
+ +
+ +
+ + diff --git a/admin/views/help_document/tmpl/index.html b/admin/views/help_document/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/help_document/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/help_document/view.html.php b/admin/views/help_document/view.html.php new file mode 100644 index 0000000..93bee6d --- /dev/null +++ b/admin/views/help_document/view.html.php @@ -0,0 +1,200 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Help_document View class + */ +class SupportgroupsViewHelp_document extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = SupportgroupsHelper::getActions('help_document',$this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $this->referral = ''; + if ($this->refid) + { + // return to the item that refered to this item + $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that refered to this item + $this->referral = '&ref='.(string)$this->ref; + } + + // Set the toolbar + $this->addToolBar(); + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_SUPPORTGROUPS_HELP_DOCUMENT_NEW' : 'COM_SUPPORTGROUPS_HELP_DOCUMENT_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if ($this->refid || $this->ref) + { + if ($this->canDo->get('help_document.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('help_document.edit')) + { + // We can save the record. + JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('help_document.create')) + { + JToolBarHelper::apply('help_document.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('help_document.edit')) + { + // We can save the new record + JToolBarHelper::apply('help_document.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('help_document.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('help_document.create')) + { + JToolBarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('help_document.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('help_document.edit') && $canVersion) + { + JToolbarHelper::versions('com_supportgroups.help_document', $this->item->id); + } + if ($this->canDo->get('help_document.create')) + { + JToolBarHelper::custom('help_document.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('help_document.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = SupportgroupsHelper::getHelpUrl('help_document'); + if (SupportgroupsHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SUPPORTGROUPS_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return SupportgroupsHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return SupportgroupsHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + $document = JFactory::getDocument(); + $document->setTitle(JText::_($isNew ? 'COM_SUPPORTGROUPS_HELP_DOCUMENT_NEW' : 'COM_SUPPORTGROUPS_HELP_DOCUMENT_EDIT')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/help_document.css"); + $document->addScript(JURI::root() . $this->script); + $document->addScript(JURI::root() . "administrator/components/com_supportgroups/views/help_document/submitbutton.js"); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/help_documents/index.html b/admin/views/help_documents/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/help_documents/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default.php b/admin/views/help_documents/tmpl/default.php new file mode 100644 index 0000000..9eaab87 --- /dev/null +++ b/admin/views/help_documents/tmpl/default.php @@ -0,0 +1,99 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_supportgroups&task=help_documents.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'help_documentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +items)): ?> + loadTemplate('toolbar');?> +
+ +
+ + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
+ + + + \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default_batch_body.php b/admin/views/help_documents/tmpl/default_batch_body.php new file mode 100644 index 0000000..3dafc36 --- /dev/null +++ b/admin/views/help_documents/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default_batch_footer.php b/admin/views/help_documents/tmpl/default_batch_footer.php new file mode 100644 index 0000000..ee8ecb7 --- /dev/null +++ b/admin/views/help_documents/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default_body.php b/admin/views/help_documents/tmpl/default_body.php new file mode 100644 index 0000000..40be124 --- /dev/null +++ b/admin/views/help_documents/tmpl/default_body.php @@ -0,0 +1,123 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_supportgroups&view=help_documents&task=help_document.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = SupportgroupsHelper::getActions('help_document',$item,'help_documents'); + ?> + + + get('help_document.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('help_document.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + + get('help_document.edit')): ?> +
+ escape($item->title); ?> + checked_out): ?> + name, $item->checked_out_time, 'help_documents.', $canCheckin); ?> + +
+ +
escape($item->title); ?>
+ + + + type); ?> + + + escape($item->groups); ?> + + + location); ?> + + + escape($item->admin_view); ?> + + + escape($item->site_view); ?> + + + get('help_document.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'help_documents.', true, 'cb'); ?> + + published, $i, 'help_documents.', false, 'cb'); ?> + + + published, $i, 'help_documents.', true, 'cb'); ?> + + + published, $i, 'help_documents.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default_foot.php b/admin/views/help_documents/tmpl/default_foot.php new file mode 100644 index 0000000..13fe521 --- /dev/null +++ b/admin/views/help_documents/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default_head.php b/admin/views/help_documents/tmpl/default_head.php new file mode 100644 index 0000000..06a700b --- /dev/null +++ b/admin/views/help_documents/tmpl/default_head.php @@ -0,0 +1,76 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/help_documents/tmpl/default_toolbar.php b/admin/views/help_documents/tmpl/default_toolbar.php new file mode 100644 index 0000000..abe7083 --- /dev/null +++ b/admin/views/help_documents/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/help_documents/tmpl/index.html b/admin/views/help_documents/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/help_documents/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/help_documents/view.html.php b/admin/views/help_documents/view.html.php new file mode 100644 index 0000000..46ea6b2 --- /dev/null +++ b/admin/views/help_documents/view.html.php @@ -0,0 +1,478 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Supportgroups View class for the Help_documents + */ +class SupportgroupsViewHelp_documents extends JViewLegacy +{ + /** + * Help_documents view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + SupportgroupsHelper::addSubmenu('help_documents'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // get global action permissions + $this->canDo = SupportgroupsHelper::getActions('help_document'); + $this->canEdit = $this->canDo->get('help_document.edit'); + $this->canState = $this->canDo->get('help_document.edit.state'); + $this->canCreate = $this->canDo->get('help_document.create'); + $this->canDelete = $this->canDo->get('help_document.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENTS'), 'support'); + JHtmlSidebar::setAction('index.php?option=com_supportgroups&view=help_documents'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('help_document.add'); + } + + // Only load if there are items + if (SupportgroupsHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('help_document.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('help_documents.publish'); + JToolBarHelper::unpublishList('help_documents.unpublish'); + JToolBarHelper::archiveList('help_documents.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('help_documents.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('help_documents.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('help_document.export')) + { + JToolBarHelper::custom('help_documents.exportData', 'download', '', 'COM_SUPPORTGROUPS_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('help_document.import')) + { + JToolBarHelper::custom('help_documents.importData', 'upload', '', 'COM_SUPPORTGROUPS_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = SupportgroupsHelper::getHelpUrl('help_documents'); + if (SupportgroupsHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SUPPORTGROUPS_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_supportgroups'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SUPPORTGROUPS_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SUPPORTGROUPS_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Type Selection + $this->typeOptions = $this->getTheTypeSelections(); + if ($this->typeOptions) + { + // Type Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_TYPE_LABEL').' -', + 'filter_type', + JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_TYPE_LABEL').' -', + 'batch[type]', + JHtml::_('select.options', $this->typeOptions, 'value', 'text') + ); + } + } + + // Set Location Selection + $this->locationOptions = $this->getTheLocationSelections(); + if ($this->locationOptions) + { + // Location Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_LOCATION_LABEL').' -', + 'filter_location', + JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Location Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_LOCATION_LABEL').' -', + 'batch[location]', + JHtml::_('select.options', $this->locationOptions, 'value', 'text') + ); + } + } + + // Set Admin View Selection + $this->admin_viewOptions = $this->getTheAdmin_viewSelections(); + if ($this->admin_viewOptions) + { + // Admin View Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', + 'filter_admin_view', + JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text', $this->state->get('filter.admin_view')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Admin View Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', + 'batch[admin_view]', + JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text') + ); + } + } + + // Set Site View Selection + $this->site_viewOptions = $this->getTheSite_viewSelections(); + if ($this->site_viewOptions) + { + // Site View Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', + 'filter_site_view', + JHtml::_('select.options', $this->site_viewOptions, 'value', 'text', $this->state->get('filter.site_view')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Site View Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', + 'batch[site_view]', + JHtml::_('select.options', $this->site_viewOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $document = JFactory::getDocument(); + $document->setTitle(JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENTS')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/help_documents.css"); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return SupportgroupsHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return SupportgroupsHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.title' => JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_TITLE_LABEL'), + 'a.type' => JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_TYPE_LABEL'), + 'a.location' => JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_LOCATION_LABEL'), + 'a.admin_view' => JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_ADMIN_VIEW_LABEL'), + 'a.site_view' => JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_SITE_VIEW_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } + + protected function getTheTypeSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('type')); + $query->from($db->quoteName('#__supportgroups_help_document')); + $query->order($db->quoteName('type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $filter = array(); + foreach ($results as $type) + { + // Translate the type selection + $text = $model->selectionTranslation($type,'type'); + // Now add the type and its text to the options array + $filter[] = JHtml::_('select.option', $type, JText::_($text)); + } + return $filter; + } + return false; + } + + protected function getTheLocationSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('location')); + $query->from($db->quoteName('#__supportgroups_help_document')); + $query->order($db->quoteName('location') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $filter = array(); + foreach ($results as $location) + { + // Translate the location selection + $text = $model->selectionTranslation($location,'location'); + // Now add the location and its text to the options array + $filter[] = JHtml::_('select.option', $location, JText::_($text)); + } + return $filter; + } + return false; + } + + protected function getTheAdmin_viewSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('admin_view')); + $query->from($db->quoteName('#__supportgroups_help_document')); + $query->order($db->quoteName('admin_view') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + $results = array_unique($results); + $filter = array(); + foreach ($results as $admin_view) + { + // Now add the admin_view and its text to the options array + $filter[] = JHtml::_('select.option', $admin_view, $admin_view); + } + return $filter; + } + return false; + } + + protected function getTheSite_viewSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('site_view')); + $query->from($db->quoteName('#__supportgroups_help_document')); + $query->order($db->quoteName('site_view') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + $results = array_unique($results); + $filter = array(); + foreach ($results as $site_view) + { + // Now add the site_view and its text to the options array + $filter[] = JHtml::_('select.option', $site_view, $site_view); + } + return $filter; + } + return false; + } +} diff --git a/admin/views/location/tmpl/edit.php b/admin/views/location/tmpl/edit.php index 4af536c..e4671ee 100644 --- a/admin/views/location/tmpl/edit.php +++ b/admin/views/location/tmpl/edit.php @@ -36,21 +36,33 @@ $componentParams = JComponentHelper::getParams('com_supportgroups');
-
+
- 'details')); ?> + 'settings')); ?> - +
- +
- canDo->get('core.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('core.edit.state') || $this->canDo->get('core.edit.created')) : ?> + canDo->get('support_group.access')) : ?> + +
+
+
+
+ +
+
+ + + + canDo->get('location.delete') || $this->canDo->get('location.edit.created_by') || $this->canDo->get('location.edit.state') || $this->canDo->get('location.edit.created')) : ?>
diff --git a/admin/views/location/view.html.php b/admin/views/location/view.html.php index 0eb443c..2915ce8 100644 --- a/admin/views/location/view.html.php +++ b/admin/views/location/view.html.php @@ -68,7 +68,10 @@ class SupportgroupsViewLocation extends JViewLegacy { // return to the list view that refered to this item $this->referral = '&ref='.(string)$this->ref; - } + } + + // Get Linked view data + $this->vvwsupport_groups = $this->get('Vvwsupport_groups'); // Set the toolbar $this->addToolBar(); @@ -95,12 +98,12 @@ class SupportgroupsViewLocation extends JViewLegacy // Built the actions for new and existing records. if ($this->refid || $this->ref) { - if ($this->canDo->get('core.create') && $isNew) + if ($this->canDo->get('location.create') && $isNew) { // We can create the record. JToolBarHelper::save('location.save', 'JTOOLBAR_SAVE'); } - elseif ($this->canDo->get('core.edit')) + elseif ($this->canDo->get('location.edit')) { // We can save the record. JToolBarHelper::save('location.save', 'JTOOLBAR_SAVE'); @@ -121,7 +124,7 @@ class SupportgroupsViewLocation extends JViewLegacy if ($isNew) { // For new records, check the create permission. - if ($this->canDo->get('core.create')) + if ($this->canDo->get('location.create')) { JToolBarHelper::apply('location.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('location.save', 'JTOOLBAR_SAVE'); @@ -131,24 +134,24 @@ class SupportgroupsViewLocation extends JViewLegacy } else { - if ($this->canDo->get('core.edit')) + if ($this->canDo->get('location.edit')) { // We can save the new record JToolBarHelper::apply('location.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('location.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. - if ($this->canDo->get('core.create')) + if ($this->canDo->get('location.create')) { JToolBarHelper::custom('location.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('location.version')); - if ($this->state->params->get('save_history', 1) && $this->canDo->get('') && $canVersion) + if ($this->state->params->get('save_history', 1) && $this->canDo->get('location.edit') && $canVersion) { JToolbarHelper::versions('com_supportgroups.location', $this->item->id); } - if ($this->canDo->get('core.create')) + if ($this->canDo->get('location.create')) { JToolBarHelper::custom('location.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } @@ -192,7 +195,31 @@ class SupportgroupsViewLocation extends JViewLegacy $isNew = ($this->item->id < 1); $document = JFactory::getDocument(); $document->setTitle(JText::_($isNew ? 'COM_SUPPORTGROUPS_LOCATION_NEW' : 'COM_SUPPORTGROUPS_LOCATION_EDIT')); - $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/location.css"); + $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/location.css"); + + // Add the CSS for Footable. + $document->addStyleSheet(JURI::root() .'media/com_supportgroups/footable/css/footable.core.min.css'); + + // Use the Metro Style + if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) + { + $document->addStyleSheet(JURI::root() .'media/com_supportgroups/footable/css/footable.metro.min.css'); + } + // Use the Legacy Style. + elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) + { + $document->addStyleSheet(JURI::root() .'media/com_supportgroups/footable/css/footable.standalone.min.css'); + } + + // Add the JavaScript for Footable + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.js'); + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.sort.js'); + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.filter.js'); + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.paginate.js'); + + $footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('.footable').footable(); }); jQuery('.nav-tabs').on('click', 'li', function() { setTimeout(tableFix, 10); }); }); function tableFix() { jQuery('.footable').trigger('footable_resize'); }"; + $document->addScriptDeclaration($footable); + $document->addScript(JURI::root() . $this->script); $document->addScript(JURI::root() . "administrator/components/com_supportgroups/views/location/submitbutton.js"); JText::script('view not acceptable. Error'); diff --git a/admin/views/locations/tmpl/default_body.php b/admin/views/locations/tmpl/default_body.php index bc58ad5..84dfb98 100644 --- a/admin/views/locations/tmpl/default_body.php +++ b/admin/views/locations/tmpl/default_body.php @@ -37,7 +37,7 @@ $edit = "index.php?option=com_supportgroups&view=locations&task=location.edit"; ?> - get('core.edit.state')): ?> + get('location.edit.state')): ?> saveOrder) { @@ -60,7 +60,7 @@ $edit = "index.php?option=com_supportgroups&view=locations&task=location.edit"; - get('core.edit')): ?> + get('location.edit')): ?> checked_out) : ?> id); ?> @@ -75,7 +75,7 @@ $edit = "index.php?option=com_supportgroups&view=locations&task=location.edit"; - get('core.edit')): ?> + get('location.edit')): ?>
escape($item->name); ?> checked_out): ?> @@ -87,7 +87,7 @@ $edit = "index.php?option=com_supportgroups&view=locations&task=location.edit"; - user->authorise('core.edit', 'com_supportgroups.region.' . (int)$item->region)): ?> + user->authorise('region.edit', 'com_supportgroups.region.' . (int)$item->region)): ?> @@ -96,7 +96,7 @@ $edit = "index.php?option=com_supportgroups&view=locations&task=location.edit"; - get('core.edit.state')) : ?> + get('location.edit.state')) : ?> checked_out) : ?> published, $i, 'locations.', true, 'cb'); ?> diff --git a/admin/views/locations/view.html.php b/admin/views/locations/view.html.php index 30f74ea..f38be22 100644 --- a/admin/views/locations/view.html.php +++ b/admin/views/locations/view.html.php @@ -63,10 +63,10 @@ class SupportgroupsViewLocations extends JViewLegacy $this->saveOrder = $this->listOrder == 'ordering'; // get global action permissions $this->canDo = SupportgroupsHelper::getActions('location'); - $this->canEdit = $this->canDo->get('core.edit'); - $this->canState = $this->canDo->get('core.edit.state'); - $this->canCreate = $this->canDo->get('core.create'); - $this->canDelete = $this->canDo->get('core.delete'); + $this->canEdit = $this->canDo->get('location.edit'); + $this->canState = $this->canDo->get('location.edit.state'); + $this->canCreate = $this->canDo->get('location.create'); + $this->canDelete = $this->canDo->get('location.delete'); $this->canBatch = $this->canDo->get('core.batch'); // We don't need toolbar in the modal window. diff --git a/admin/views/payment/submitbutton.js b/admin/views/payment/submitbutton.js new file mode 100644 index 0000000..e73ab84 --- /dev/null +++ b/admin/views/payment/submitbutton.js @@ -0,0 +1,49 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.3 + @build 6th March, 2016 + @created 24th February, 2016 + @package Support Groups + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var isValid=true; + var action = task.split('.'); + if (action[1] != 'cancel' && action[1] != 'close'){ + var forms = $$('form.form-validate'); + for (var i=0;i + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = JComponentHelper::getParams('com_supportgroups'); +?> + + + +
+ + 'details')); ?> + + +
+
+ +
+
+ +
+
+ + + canDo->get('payment.delete') || $this->canDo->get('payment.edit.created_by') || $this->canDo->get('payment.edit.state') || $this->canDo->get('payment.edit.created')) : ?> + +
+
+ +
+
+ +
+
+ + + + canDo->get('core.admin')) : ?> + +
+
+
+
+ form->getFieldset('accesscontrol') as $field): ?> +
+ label; echo $field->input;?> +
+
+ +
+
+
+
+ + + + + +
+ + +
+
+ diff --git a/admin/views/payment/tmpl/index.html b/admin/views/payment/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payment/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payment/view.html.php b/admin/views/payment/view.html.php new file mode 100644 index 0000000..1aa7760 --- /dev/null +++ b/admin/views/payment/view.html.php @@ -0,0 +1,200 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Payment View class + */ +class SupportgroupsViewPayment extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = SupportgroupsHelper::getActions('payment',$this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $this->referral = ''; + if ($this->refid) + { + // return to the item that refered to this item + $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that refered to this item + $this->referral = '&ref='.(string)$this->ref; + } + + // Set the toolbar + $this->addToolBar(); + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_SUPPORTGROUPS_PAYMENT_NEW' : 'COM_SUPPORTGROUPS_PAYMENT_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if ($this->refid || $this->ref) + { + if ($this->canDo->get('payment.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('payment.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('payment.edit')) + { + // We can save the record. + JToolBarHelper::save('payment.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('payment.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('payment.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('payment.create')) + { + JToolBarHelper::apply('payment.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('payment.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('payment.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('payment.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('payment.edit')) + { + // We can save the new record + JToolBarHelper::apply('payment.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('payment.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('payment.create')) + { + JToolBarHelper::custom('payment.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('payment.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('payment.edit') && $canVersion) + { + JToolbarHelper::versions('com_supportgroups.payment', $this->item->id); + } + if ($this->canDo->get('payment.create')) + { + JToolBarHelper::custom('payment.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('payment.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = SupportgroupsHelper::getHelpUrl('payment'); + if (SupportgroupsHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SUPPORTGROUPS_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return SupportgroupsHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return SupportgroupsHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + $document = JFactory::getDocument(); + $document->setTitle(JText::_($isNew ? 'COM_SUPPORTGROUPS_PAYMENT_NEW' : 'COM_SUPPORTGROUPS_PAYMENT_EDIT')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/payment.css"); + $document->addScript(JURI::root() . $this->script); + $document->addScript(JURI::root() . "administrator/components/com_supportgroups/views/payment/submitbutton.js"); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/payments/index.html b/admin/views/payments/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payments/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default.php b/admin/views/payments/tmpl/default.php new file mode 100644 index 0000000..02c6368 --- /dev/null +++ b/admin/views/payments/tmpl/default.php @@ -0,0 +1,99 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// load tooltip behavior +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', 'select'); + +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_supportgroups&task=payments.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'paymentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} + +?> + +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ +items)): ?> + loadTemplate('toolbar');?> +
+ +
+ + loadTemplate('toolbar');?> + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_SUPPORTGROUPS_PAYMENTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + +
+ + + + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_batch_body.php b/admin/views/payments/tmpl/default_batch_body.php new file mode 100644 index 0000000..7417498 --- /dev/null +++ b/admin/views/payments/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_batch_footer.php b/admin/views/payments/tmpl/default_batch_footer.php new file mode 100644 index 0000000..1c8a0dd --- /dev/null +++ b/admin/views/payments/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_body.php b/admin/views/payments/tmpl/default_body.php new file mode 100644 index 0000000..58b1e53 --- /dev/null +++ b/admin/views/payments/tmpl/default_body.php @@ -0,0 +1,114 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$edit = "index.php?option=com_supportgroups&view=payments&task=payment.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = SupportgroupsHelper::getActions('payment',$item,'payments'); + ?> + + + get('payment.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive'; + } + else + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('payment.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + + get('payment.edit')): ?> +
+ escape($item->support_group_name); ?> + checked_out): ?> + name, $item->checked_out_time, 'payments.', $canCheckin); ?> + +
+ +
escape($item->support_group_name); ?>
+ + + + year); ?> + + + escape($item->amount); ?> + + + get('payment.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'payments.', true, 'cb'); ?> + + published, $i, 'payments.', false, 'cb'); ?> + + + published, $i, 'payments.', true, 'cb'); ?> + + + published, $i, 'payments.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_foot.php b/admin/views/payments/tmpl/default_foot.php new file mode 100644 index 0000000..8c58d8c --- /dev/null +++ b/admin/views/payments/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_head.php b/admin/views/payments/tmpl/default_head.php new file mode 100644 index 0000000..e6a09bb --- /dev/null +++ b/admin/views/payments/tmpl/default_head.php @@ -0,0 +1,67 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> + + canEdit&& $this->canState): ?> + + ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_toolbar.php b/admin/views/payments/tmpl/default_toolbar.php new file mode 100644 index 0000000..bb588e2 --- /dev/null +++ b/admin/views/payments/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/payments/tmpl/index.html b/admin/views/payments/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payments/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payments/view.html.php b/admin/views/payments/view.html.php new file mode 100644 index 0000000..2c0618d --- /dev/null +++ b/admin/views/payments/view.html.php @@ -0,0 +1,332 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Supportgroups View class for the Payments + */ +class SupportgroupsViewPayments extends JViewLegacy +{ + /** + * Payments view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + SupportgroupsHelper::addSubmenu('payments'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + return false; + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + $this->listOrder = $this->escape($this->state->get('list.ordering')); + $this->listDirn = $this->escape($this->state->get('list.direction')); + $this->saveOrder = $this->listOrder == 'ordering'; + // get global action permissions + $this->canDo = SupportgroupsHelper::getActions('payment'); + $this->canEdit = $this->canDo->get('payment.edit'); + $this->canState = $this->canDo->get('payment.edit.state'); + $this->canCreate = $this->canDo->get('payment.create'); + $this->canDelete = $this->canDo->get('payment.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_SUPPORTGROUPS_PAYMENTS'), 'archive'); + JHtmlSidebar::setAction('index.php?option=com_supportgroups&view=payments'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('payment.add'); + } + + // Only load if there are items + if (SupportgroupsHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('payment.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('payments.publish'); + JToolBarHelper::unpublishList('payments.unpublish'); + JToolBarHelper::archiveList('payments.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('payments.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'payments.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('payments.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('payment.export')) + { + JToolBarHelper::custom('payments.exportData', 'download', '', 'COM_SUPPORTGROUPS_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('payment.import')) + { + JToolBarHelper::custom('payments.importData', 'upload', '', 'COM_SUPPORTGROUPS_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = SupportgroupsHelper::getHelpUrl('payments'); + if (SupportgroupsHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_SUPPORTGROUPS_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_supportgroups'); + } + + if ($this->canState) + { + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_published', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) + ); + // only load if batch allowed + if ($this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SUPPORTGROUPS_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + } + + JHtmlSidebar::addFilter( + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_SUPPORTGROUPS_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Set Support Group Name Selection + $this->support_groupNameOptions = JFormHelper::loadFieldType('Supportgroups')->getOptions(); + if ($this->support_groupNameOptions) + { + // Support Group Name Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SUPPORTGROUPS_PAYMENT_SUPPORT_GROUP_LABEL').' -', + 'filter_support_group', + JHtml::_('select.options', $this->support_groupNameOptions, 'value', 'text', $this->state->get('filter.support_group')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Support Group Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SUPPORTGROUPS_PAYMENT_SUPPORT_GROUP_LABEL').' -', + 'batch[support_group]', + JHtml::_('select.options', $this->support_groupNameOptions, 'value', 'text') + ); + } + } + + // Set Year Selection + $this->yearOptions = $this->getTheYearSelections(); + if ($this->yearOptions) + { + // Year Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SUPPORTGROUPS_PAYMENT_YEAR_LABEL').' -', + 'filter_year', + JHtml::_('select.options', $this->yearOptions, 'value', 'text', $this->state->get('filter.year')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Year Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SUPPORTGROUPS_PAYMENT_YEAR_LABEL').' -', + 'batch[year]', + JHtml::_('select.options', $this->yearOptions, 'value', 'text') + ); + } + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $document = JFactory::getDocument(); + $document->setTitle(JText::_('COM_SUPPORTGROUPS_PAYMENTS')); + $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/payments.css"); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return SupportgroupsHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return SupportgroupsHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'g.name' => JText::_('COM_SUPPORTGROUPS_PAYMENT_SUPPORT_GROUP_LABEL'), + 'a.year' => JText::_('COM_SUPPORTGROUPS_PAYMENT_YEAR_LABEL'), + 'a.amount' => JText::_('COM_SUPPORTGROUPS_PAYMENT_AMOUNT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } + + protected function getTheYearSelections() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('year')); + $query->from($db->quoteName('#__supportgroups_payment')); + $query->order($db->quoteName('year') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + + if ($results) + { + // get model + $model = $this->getModel(); + $results = array_unique($results); + $filter = array(); + foreach ($results as $year) + { + // Translate the year selection + $text = $model->selectionTranslation($year,'year'); + // Now add the year and its text to the options array + $filter[] = JHtml::_('select.option', $year, JText::_($text)); + } + return $filter; + } + return false; + } +} diff --git a/admin/views/region/tmpl/edit.php b/admin/views/region/tmpl/edit.php index 7f8660d..62ca1b1 100644 --- a/admin/views/region/tmpl/edit.php +++ b/admin/views/region/tmpl/edit.php @@ -37,20 +37,32 @@ $componentParams = JComponentHelper::getParams('com_supportgroups');
- 'details')); ?> + 'settings')); ?> - +
- +
- +
- canDo->get('core.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('core.edit.state') || $this->canDo->get('core.edit.created')) : ?> + canDo->get('location.access')) : ?> + +
+
+
+
+ +
+
+ + + + canDo->get('region.delete') || $this->canDo->get('region.edit.created_by') || $this->canDo->get('region.edit.state') || $this->canDo->get('region.edit.created')) : ?>
diff --git a/admin/views/region/view.html.php b/admin/views/region/view.html.php index c32afb2..bf619ac 100644 --- a/admin/views/region/view.html.php +++ b/admin/views/region/view.html.php @@ -68,7 +68,10 @@ class SupportgroupsViewRegion extends JViewLegacy { // return to the list view that refered to this item $this->referral = '&ref='.(string)$this->ref; - } + } + + // Get Linked view data + $this->vvxlocations = $this->get('Vvxlocations'); // Set the toolbar $this->addToolBar(); @@ -95,12 +98,12 @@ class SupportgroupsViewRegion extends JViewLegacy // Built the actions for new and existing records. if ($this->refid || $this->ref) { - if ($this->canDo->get('core.create') && $isNew) + if ($this->canDo->get('region.create') && $isNew) { // We can create the record. JToolBarHelper::save('region.save', 'JTOOLBAR_SAVE'); } - elseif ($this->canDo->get('core.edit')) + elseif ($this->canDo->get('region.edit')) { // We can save the record. JToolBarHelper::save('region.save', 'JTOOLBAR_SAVE'); @@ -121,7 +124,7 @@ class SupportgroupsViewRegion extends JViewLegacy if ($isNew) { // For new records, check the create permission. - if ($this->canDo->get('core.create')) + if ($this->canDo->get('region.create')) { JToolBarHelper::apply('region.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('region.save', 'JTOOLBAR_SAVE'); @@ -131,24 +134,24 @@ class SupportgroupsViewRegion extends JViewLegacy } else { - if ($this->canDo->get('core.edit')) + if ($this->canDo->get('region.edit')) { // We can save the new record JToolBarHelper::apply('region.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('region.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. - if ($this->canDo->get('core.create')) + if ($this->canDo->get('region.create')) { JToolBarHelper::custom('region.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('region.version')); - if ($this->state->params->get('save_history', 1) && $this->canDo->get('') && $canVersion) + if ($this->state->params->get('save_history', 1) && $this->canDo->get('region.edit') && $canVersion) { JToolbarHelper::versions('com_supportgroups.region', $this->item->id); } - if ($this->canDo->get('core.create')) + if ($this->canDo->get('region.create')) { JToolBarHelper::custom('region.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } @@ -192,7 +195,31 @@ class SupportgroupsViewRegion extends JViewLegacy $isNew = ($this->item->id < 1); $document = JFactory::getDocument(); $document->setTitle(JText::_($isNew ? 'COM_SUPPORTGROUPS_REGION_NEW' : 'COM_SUPPORTGROUPS_REGION_EDIT')); - $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/region.css"); + $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/region.css"); + + // Add the CSS for Footable. + $document->addStyleSheet(JURI::root() .'media/com_supportgroups/footable/css/footable.core.min.css'); + + // Use the Metro Style + if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) + { + $document->addStyleSheet(JURI::root() .'media/com_supportgroups/footable/css/footable.metro.min.css'); + } + // Use the Legacy Style. + elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) + { + $document->addStyleSheet(JURI::root() .'media/com_supportgroups/footable/css/footable.standalone.min.css'); + } + + // Add the JavaScript for Footable + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.js'); + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.sort.js'); + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.filter.js'); + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.paginate.js'); + + $footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('.footable').footable(); }); jQuery('.nav-tabs').on('click', 'li', function() { setTimeout(tableFix, 10); }); }); function tableFix() { jQuery('.footable').trigger('footable_resize'); }"; + $document->addScriptDeclaration($footable); + $document->addScript(JURI::root() . $this->script); $document->addScript(JURI::root() . "administrator/components/com_supportgroups/views/region/submitbutton.js"); JText::script('view not acceptable. Error'); diff --git a/admin/views/regions/tmpl/default_body.php b/admin/views/regions/tmpl/default_body.php index 7db8fbc..9a6d6f5 100644 --- a/admin/views/regions/tmpl/default_body.php +++ b/admin/views/regions/tmpl/default_body.php @@ -37,7 +37,7 @@ $edit = "index.php?option=com_supportgroups&view=regions&task=region.edit"; ?> - get('core.edit.state')): ?> + get('region.edit.state')): ?> saveOrder) { @@ -60,7 +60,7 @@ $edit = "index.php?option=com_supportgroups&view=regions&task=region.edit"; - get('core.edit')): ?> + get('region.edit')): ?> checked_out) : ?> id); ?> @@ -75,7 +75,7 @@ $edit = "index.php?option=com_supportgroups&view=regions&task=region.edit"; - get('core.edit')): ?> + get('region.edit')): ?>
escape($item->name); ?> checked_out): ?> @@ -96,7 +96,7 @@ $edit = "index.php?option=com_supportgroups&view=regions&task=region.edit"; - get('core.edit.state')) : ?> + get('region.edit.state')) : ?> checked_out) : ?> published, $i, 'regions.', true, 'cb'); ?> diff --git a/admin/views/regions/view.html.php b/admin/views/regions/view.html.php index d925d55..57c0126 100644 --- a/admin/views/regions/view.html.php +++ b/admin/views/regions/view.html.php @@ -63,10 +63,10 @@ class SupportgroupsViewRegions extends JViewLegacy $this->saveOrder = $this->listOrder == 'ordering'; // get global action permissions $this->canDo = SupportgroupsHelper::getActions('region'); - $this->canEdit = $this->canDo->get('core.edit'); - $this->canState = $this->canDo->get('core.edit.state'); - $this->canCreate = $this->canDo->get('core.create'); - $this->canDelete = $this->canDo->get('core.delete'); + $this->canEdit = $this->canDo->get('region.edit'); + $this->canState = $this->canDo->get('region.edit.state'); + $this->canCreate = $this->canDo->get('region.create'); + $this->canDelete = $this->canDo->get('region.delete'); $this->canBatch = $this->canDo->get('core.batch'); // We don't need toolbar in the modal window. diff --git a/admin/views/support_group/tmpl/edit.php b/admin/views/support_group/tmpl/edit.php index eda8a8a..4c2ce5e 100644 --- a/admin/views/support_group/tmpl/edit.php +++ b/admin/views/support_group/tmpl/edit.php @@ -35,19 +35,35 @@ $componentParams = JComponentHelper::getParams('com_supportgroups'); ?> -
+ +
'details')); ?>
-
+
+
+ +
- canDo->get('core.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('core.edit.state') || $this->canDo->get('core.edit.created')) : ?> + canDo->get('payment.access')) : ?> + +
+
+
+
+ +
+
+ + + + canDo->get('support_group.delete') || $this->canDo->get('support_group.edit.created_by') || $this->canDo->get('support_group.edit.state') || $this->canDo->get('support_group.edit.created')) : ?>
@@ -85,5 +101,8 @@ $componentParams = JComponentHelper::getParams('com_supportgroups');
-
+
+ +
+ diff --git a/admin/views/support_group/view.html.php b/admin/views/support_group/view.html.php index 01c123b..37066c8 100644 --- a/admin/views/support_group/view.html.php +++ b/admin/views/support_group/view.html.php @@ -68,7 +68,10 @@ class SupportgroupsViewSupport_group extends JViewLegacy { // return to the list view that refered to this item $this->referral = '&ref='.(string)$this->ref; - } + } + + // Get Linked view data + $this->vvvpayments = $this->get('Vvvpayments'); // Set the toolbar $this->addToolBar(); @@ -95,12 +98,12 @@ class SupportgroupsViewSupport_group extends JViewLegacy // Built the actions for new and existing records. if ($this->refid || $this->ref) { - if ($this->canDo->get('core.create') && $isNew) + if ($this->canDo->get('support_group.create') && $isNew) { // We can create the record. JToolBarHelper::save('support_group.save', 'JTOOLBAR_SAVE'); } - elseif ($this->canDo->get('core.edit')) + elseif ($this->canDo->get('support_group.edit')) { // We can save the record. JToolBarHelper::save('support_group.save', 'JTOOLBAR_SAVE'); @@ -121,7 +124,7 @@ class SupportgroupsViewSupport_group extends JViewLegacy if ($isNew) { // For new records, check the create permission. - if ($this->canDo->get('core.create')) + if ($this->canDo->get('support_group.create')) { JToolBarHelper::apply('support_group.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('support_group.save', 'JTOOLBAR_SAVE'); @@ -131,24 +134,24 @@ class SupportgroupsViewSupport_group extends JViewLegacy } else { - if ($this->canDo->get('core.edit')) + if ($this->canDo->get('support_group.edit')) { // We can save the new record JToolBarHelper::apply('support_group.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('support_group.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. - if ($this->canDo->get('core.create')) + if ($this->canDo->get('support_group.create')) { JToolBarHelper::custom('support_group.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('support_group.version')); - if ($this->state->params->get('save_history', 1) && $this->canDo->get('') && $canVersion) + if ($this->state->params->get('save_history', 1) && $this->canDo->get('support_group.edit') && $canVersion) { JToolbarHelper::versions('com_supportgroups.support_group', $this->item->id); } - if ($this->canDo->get('core.create')) + if ($this->canDo->get('support_group.create')) { JToolBarHelper::custom('support_group.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } @@ -192,7 +195,31 @@ class SupportgroupsViewSupport_group extends JViewLegacy $isNew = ($this->item->id < 1); $document = JFactory::getDocument(); $document->setTitle(JText::_($isNew ? 'COM_SUPPORTGROUPS_SUPPORT_GROUP_NEW' : 'COM_SUPPORTGROUPS_SUPPORT_GROUP_EDIT')); - $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/support_group.css"); + $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/support_group.css"); + + // Add the CSS for Footable. + $document->addStyleSheet(JURI::root() .'media/com_supportgroups/footable/css/footable.core.min.css'); + + // Use the Metro Style + if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) + { + $document->addStyleSheet(JURI::root() .'media/com_supportgroups/footable/css/footable.metro.min.css'); + } + // Use the Legacy Style. + elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) + { + $document->addStyleSheet(JURI::root() .'media/com_supportgroups/footable/css/footable.standalone.min.css'); + } + + // Add the JavaScript for Footable + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.js'); + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.sort.js'); + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.filter.js'); + $document->addScript(JURI::root() .'media/com_supportgroups/footable/js/footable.paginate.js'); + + $footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('.footable').footable(); }); jQuery('.nav-tabs').on('click', 'li', function() { setTimeout(tableFix, 10); }); }); function tableFix() { jQuery('.footable').trigger('footable_resize'); }"; + $document->addScriptDeclaration($footable); + $document->addScript(JURI::root() . $this->script); $document->addScript(JURI::root() . "administrator/components/com_supportgroups/views/support_group/submitbutton.js"); JText::script('view not acceptable. Error'); diff --git a/admin/views/support_groups/tmpl/default_body.php b/admin/views/support_groups/tmpl/default_body.php index cceb641..ebb38f5 100644 --- a/admin/views/support_groups/tmpl/default_body.php +++ b/admin/views/support_groups/tmpl/default_body.php @@ -37,7 +37,7 @@ $edit = "index.php?option=com_supportgroups&view=support_groups&task=support_gro ?> - get('core.edit.state')): ?> + get('support_group.edit.state')): ?> saveOrder) { @@ -60,7 +60,7 @@ $edit = "index.php?option=com_supportgroups&view=support_groups&task=support_gro - get('core.edit')): ?> + get('support_group.edit')): ?> checked_out) : ?> id); ?> @@ -75,7 +75,7 @@ $edit = "index.php?option=com_supportgroups&view=support_groups&task=support_gro - get('core.edit')): ?> + get('support_group.edit')): ?>
escape($item->name); ?> checked_out): ?> @@ -86,8 +86,35 @@ $edit = "index.php?option=com_supportgroups&view=support_groups&task=support_gro
escape($item->name); ?>
+ + escape($item->phone); ?> + + + user->authorise('location.edit', 'com_supportgroups.location.' . (int)$item->location)): ?> + + +
escape($item->location_name); ?>
+ + + + user->authorise('clinic.edit', 'com_supportgroups.clinic.' . (int)$item->clinic)): ?> + + +
escape($item->clinic_name); ?>
+ + + + escape($item->male); ?> + + + escape($item->female); ?> + - get('core.edit.state')) : ?> + get('support_group.edit.state')) : ?> checked_out) : ?> published, $i, 'support_groups.', true, 'cb'); ?> diff --git a/admin/views/support_groups/tmpl/default_foot.php b/admin/views/support_groups/tmpl/default_foot.php index 21d189c..13fe521 100644 --- a/admin/views/support_groups/tmpl/default_foot.php +++ b/admin/views/support_groups/tmpl/default_foot.php @@ -28,5 +28,5 @@ defined('_JEXEC') or die('Restricted access'); ?> - pagination->getListFooter(); ?> + pagination->getListFooter(); ?> \ No newline at end of file diff --git a/admin/views/support_groups/tmpl/default_head.php b/admin/views/support_groups/tmpl/default_head.php index 9e1a8d4..c6c80cf 100644 --- a/admin/views/support_groups/tmpl/default_head.php +++ b/admin/views/support_groups/tmpl/default_head.php @@ -46,6 +46,21 @@ defined('_JEXEC') or die('Restricted access'); listDirn, $this->listOrder); ?> + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + canState): ?> listDirn, $this->listOrder); ?> diff --git a/admin/views/support_groups/view.html.php b/admin/views/support_groups/view.html.php index fc561ca..6685119 100644 --- a/admin/views/support_groups/view.html.php +++ b/admin/views/support_groups/view.html.php @@ -63,10 +63,10 @@ class SupportgroupsViewSupport_groups extends JViewLegacy $this->saveOrder = $this->listOrder == 'ordering'; // get global action permissions $this->canDo = SupportgroupsHelper::getActions('support_group'); - $this->canEdit = $this->canDo->get('core.edit'); - $this->canState = $this->canDo->get('core.edit.state'); - $this->canCreate = $this->canDo->get('core.create'); - $this->canDelete = $this->canDo->get('core.delete'); + $this->canEdit = $this->canDo->get('support_group.edit'); + $this->canState = $this->canDo->get('support_group.edit.state'); + $this->canCreate = $this->canDo->get('support_group.create'); + $this->canDelete = $this->canDo->get('support_group.delete'); $this->canBatch = $this->canDo->get('core.batch'); // We don't need toolbar in the modal window. @@ -200,7 +200,51 @@ class SupportgroupsViewSupport_groups extends JViewLegacy 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); - } + } + + // Set Location Name Selection + $this->locationNameOptions = JFormHelper::loadFieldType('Locations')->getOptions(); + if ($this->locationNameOptions) + { + // Location Name Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_LOCATION_LABEL').' -', + 'filter_location', + JHtml::_('select.options', $this->locationNameOptions, 'value', 'text', $this->state->get('filter.location')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Location Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_LOCATION_LABEL').' -', + 'batch[location]', + JHtml::_('select.options', $this->locationNameOptions, 'value', 'text') + ); + } + } + + // Set Clinic Name Selection + $this->clinicNameOptions = JFormHelper::loadFieldType('Clinics')->getOptions(); + if ($this->clinicNameOptions) + { + // Clinic Name Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_CLINIC_LABEL').' -', + 'filter_clinic', + JHtml::_('select.options', $this->clinicNameOptions, 'value', 'text', $this->state->get('filter.clinic')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Clinic Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_CLINIC_LABEL').' -', + 'batch[clinic]', + JHtml::_('select.options', $this->clinicNameOptions, 'value', 'text') + ); + } + } } /** @@ -244,6 +288,11 @@ class SupportgroupsViewSupport_groups extends JViewLegacy 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_NAME_LABEL'), + 'a.phone' => JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_PHONE_LABEL'), + 'g.name' => JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_LOCATION_LABEL'), + 'h.name' => JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_CLINIC_LABEL'), + 'a.male' => JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_MALE_LABEL'), + 'a.female' => JText::_('COM_SUPPORTGROUPS_SUPPORT_GROUP_FEMALE_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); } diff --git a/script.php b/script.php index 74e0117..b25d9bd 100644 --- a/script.php +++ b/script.php @@ -145,6 +145,178 @@ class com_supportgroupsInstallerScript } } + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Payment alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.payment') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $payment_found = $db->getNumRows(); + // Now check if there were any rows + if ($payment_found) + { + // Since there are load the needed payment type ids + $payment_ids = $db->loadColumn(); + // Remove Payment from the content type table + $payment_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.payment') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($payment_condition); + $db->setQuery($query); + // Execute the query to remove Payment items + $payment_done = $db->execute(); + if ($payment_done); + { + // If succesfully remove Payment add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.payment) type alias was removed from the #__content_type table')); + } + + // Remove Payment items from the contentitem tag map table + $payment_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.payment') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($payment_condition); + $db->setQuery($query); + // Execute the query to remove Payment items + $payment_done = $db->execute(); + if ($payment_done); + { + // If succesfully remove Payment add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.payment) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Payment items from the ucm content table + $payment_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_supportgroups.payment') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($payment_condition); + $db->setQuery($query); + // Execute the query to remove Payment items + $payment_done = $db->execute(); + if ($payment_done); + { + // If succesfully remove Payment add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.payment) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Payment items are cleared from DB + foreach ($payment_ids as $payment_id) + { + // Remove Payment items from the ucm base table + $payment_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $payment_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($payment_condition); + $db->setQuery($query); + // Execute the query to remove Payment items + $db->execute(); + + // Remove Payment items from the ucm history table + $payment_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $payment_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($payment_condition); + $db->setQuery($query); + // Execute the query to remove Payment items + $db->execute(); + } + } + + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Clinic alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.clinic') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $clinic_found = $db->getNumRows(); + // Now check if there were any rows + if ($clinic_found) + { + // Since there are load the needed clinic type ids + $clinic_ids = $db->loadColumn(); + // Remove Clinic from the content type table + $clinic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.clinic') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic items + $clinic_done = $db->execute(); + if ($clinic_done); + { + // If succesfully remove Clinic add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.clinic) type alias was removed from the #__content_type table')); + } + + // Remove Clinic items from the contentitem tag map table + $clinic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.clinic') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic items + $clinic_done = $db->execute(); + if ($clinic_done); + { + // If succesfully remove Clinic add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.clinic) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Clinic items from the ucm content table + $clinic_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_supportgroups.clinic') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic items + $clinic_done = $db->execute(); + if ($clinic_done); + { + // If succesfully remove Clinic add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.clinic) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Clinic items are cleared from DB + foreach ($clinic_ids as $clinic_id) + { + // Remove Clinic items from the ucm base table + $clinic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $clinic_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic items + $db->execute(); + + // Remove Clinic items from the ucm history table + $clinic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $clinic_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic items + $db->execute(); + } + } + // Create a new query object. $query = $db->getQuery(true); // Select id from content type table @@ -317,6 +489,92 @@ class com_supportgroupsInstallerScript } } + // Create a new query object. + $query = $db->getQuery(true); + // Select id from content type table + $query->select($db->quoteName('type_id')); + $query->from($db->quoteName('#__content_types')); + // Where Country alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.country') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $country_found = $db->getNumRows(); + // Now check if there were any rows + if ($country_found) + { + // Since there are load the needed country type ids + $country_ids = $db->loadColumn(); + // Remove Country from the content type table + $country_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.country') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($country_condition); + $db->setQuery($query); + // Execute the query to remove Country items + $country_done = $db->execute(); + if ($country_done); + { + // If succesfully remove Country add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.country) type alias was removed from the #__content_type table')); + } + + // Remove Country items from the contentitem tag map table + $country_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.country') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($country_condition); + $db->setQuery($query); + // Execute the query to remove Country items + $country_done = $db->execute(); + if ($country_done); + { + // If succesfully remove Country add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.country) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Country items from the ucm content table + $country_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_supportgroups.country') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($country_condition); + $db->setQuery($query); + // Execute the query to remove Country items + $country_done = $db->execute(); + if ($country_done); + { + // If succesfully remove Country add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.country) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Country items are cleared from DB + foreach ($country_ids as $country_id) + { + // Remove Country items from the ucm base table + $country_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $country_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($country_condition); + $db->setQuery($query); + // Execute the query to remove Country items + $db->execute(); + + // Remove Country items from the ucm history table + $country_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $country_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($country_condition); + $db->setQuery($query); + // Execute the query to remove Country items + $db->execute(); + } + } + // Create a new query object. $query = $db->getQuery(true); // Select id from content type table @@ -408,83 +666,83 @@ class com_supportgroupsInstallerScript // Select id from content type table $query->select($db->quoteName('type_id')); $query->from($db->quoteName('#__content_types')); - // Where Country alias is found - $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.country') ); + // Where Help_document alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.help_document') ); $db->setQuery($query); // Execute query to see if alias is found $db->execute(); - $country_found = $db->getNumRows(); + $help_document_found = $db->getNumRows(); // Now check if there were any rows - if ($country_found) + if ($help_document_found) { - // Since there are load the needed country type ids - $country_ids = $db->loadColumn(); - // Remove Country from the content type table - $country_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.country') ); + // Since there are load the needed help_document type ids + $help_document_ids = $db->loadColumn(); + // Remove Help_document from the content type table + $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.help_document') ); // Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__content_types')); - $query->where($country_condition); + $query->where($help_document_condition); $db->setQuery($query); - // Execute the query to remove Country items - $country_done = $db->execute(); - if ($country_done); + // Execute the query to remove Help_document items + $help_document_done = $db->execute(); + if ($help_document_done); { - // If succesfully remove Country add queued success message. - $app->enqueueMessage(JText::_('The (com_supportgroups.country) type alias was removed from the #__content_type table')); + // If succesfully remove Help_document add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.help_document) type alias was removed from the #__content_type table')); } - // Remove Country items from the contentitem tag map table - $country_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.country') ); + // Remove Help_document items from the contentitem tag map table + $help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_supportgroups.help_document') ); // Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__contentitem_tag_map')); - $query->where($country_condition); + $query->where($help_document_condition); $db->setQuery($query); - // Execute the query to remove Country items - $country_done = $db->execute(); - if ($country_done); + // Execute the query to remove Help_document items + $help_document_done = $db->execute(); + if ($help_document_done); { - // If succesfully remove Country add queued success message. - $app->enqueueMessage(JText::_('The (com_supportgroups.country) type alias was removed from the #__contentitem_tag_map table')); + // If succesfully remove Help_document add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.help_document) type alias was removed from the #__contentitem_tag_map table')); } - // Remove Country items from the ucm content table - $country_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_supportgroups.country') ); + // Remove Help_document items from the ucm content table + $help_document_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_supportgroups.help_document') ); // Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_content')); - $query->where($country_condition); + $query->where($help_document_condition); $db->setQuery($query); - // Execute the query to remove Country items - $country_done = $db->execute(); - if ($country_done); + // Execute the query to remove Help_document items + $help_document_done = $db->execute(); + if ($help_document_done); { - // If succesfully remove Country add queued success message. - $app->enqueueMessage(JText::_('The (com_supportgroups.country) type alias was removed from the #__ucm_content table')); + // If succesfully remove Help_document add queued success message. + $app->enqueueMessage(JText::_('The (com_supportgroups.help_document) type alias was removed from the #__ucm_content table')); } - // Make sure that all the Country items are cleared from DB - foreach ($country_ids as $country_id) + // Make sure that all the Help_document items are cleared from DB + foreach ($help_document_ids as $help_document_id) { - // Remove Country items from the ucm base table - $country_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $country_id); + // Remove Help_document items from the ucm base table + $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_base')); - $query->where($country_condition); + $query->where($help_document_condition); $db->setQuery($query); - // Execute the query to remove Country items + // Execute the query to remove Help_document items $db->execute(); - // Remove Country items from the ucm history table - $country_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $country_id); + // Remove Help_document items from the ucm history table + $help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id); // Create a new query object. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')); - $query->where($country_condition); + $query->where($help_document_condition); $db->setQuery($query); - // Execute the query to remove Country items + // Execute the query to remove Help_document items $db->execute(); } } @@ -501,8 +759,8 @@ class com_supportgroupsInstallerScript $query->delete($db->quoteName('#__assets')); $query->where($supportgroups_condition); $db->setQuery($query); - $country_done = $db->execute(); - if ($country_done); + $help_document_done = $db->execute(); + if ($help_document_done); { // If succesfully remove supportgroups add queued success message. $app->enqueueMessage(JText::_('All related items was removed from the #__assets table')); @@ -566,13 +824,37 @@ class com_supportgroupsInstallerScript $support_group->type_title = 'Supportgroups Support_group'; $support_group->type_alias = 'com_supportgroups.support_group'; $support_group->table = '{"special": {"dbtable": "#__supportgroups_support_group","key": "id","type": "Support_group","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $support_group->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name"}}'; + $support_group->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","phone":"phone","location":"location","clinic":"clinic","male":"male","female":"female","female_art":"female_art","male_art":"male_art","female_children":"female_children","male_children":"male_children","area":"area"}}'; $support_group->router = 'SupportgroupsHelperRoute::getSupport_groupRoute'; - $support_group->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/support_group.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $support_group->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/support_group.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","area"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","location","clinic","male","female","female_art","male_art","female_children","male_children"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "location","targetTable": "#__supportgroups_location","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "clinic","targetTable": "#__supportgroups_clinic","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $support_group_Inserted = $db->insertObject('#__content_types', $support_group); + // Create the payment content type object. + $payment = new stdClass(); + $payment->type_title = 'Supportgroups Payment'; + $payment->type_alias = 'com_supportgroups.payment'; + $payment->table = '{"special": {"dbtable": "#__supportgroups_payment","key": "id","type": "Payment","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $payment->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "support_group","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"support_group":"support_group","year":"year","amount":"amount"}}'; + $payment->router = 'SupportgroupsHelperRoute::getPaymentRoute'; + $payment->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/payment.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","support_group","year"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "support_group","targetTable": "#__supportgroups_support_group","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $payment_Inserted = $db->insertObject('#__content_types', $payment); + + // Create the clinic content type object. + $clinic = new stdClass(); + $clinic->type_title = 'Supportgroups Clinic'; + $clinic->type_alias = 'com_supportgroups.clinic'; + $clinic->table = '{"special": {"dbtable": "#__supportgroups_clinic","key": "id","type": "Clinic","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $clinic->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","phone":"phone","area":"area"}}'; + $clinic->router = 'SupportgroupsHelperRoute::getClinicRoute'; + $clinic->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/clinic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","area"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $clinic_Inserted = $db->insertObject('#__content_types', $clinic); + // Create the location content type object. $location = new stdClass(); $location->type_title = 'Supportgroups Location'; @@ -597,6 +879,18 @@ class com_supportgroupsInstallerScript // Set the object into the content types table. $region_Inserted = $db->insertObject('#__content_types', $region); + // Create the country content type object. + $country = new stdClass(); + $country->type_title = 'Supportgroups Country'; + $country->type_alias = 'com_supportgroups.country'; + $country->table = '{"special": {"dbtable": "#__supportgroups_country","key": "id","type": "Country","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $country->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","currency":"currency","worldzone":"worldzone","codethree":"codethree","codetwo":"codetwo","alias":"alias"}}'; + $country->router = 'SupportgroupsHelperRoute::getCountryRoute'; + $country->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/country.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "currency","targetTable": "#__supportgroups_currency","targetColumn": "codethree","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $country_Inserted = $db->insertObject('#__content_types', $country); + // Create the currency content type object. $currency = new stdClass(); $currency->type_title = 'Supportgroups Currency'; @@ -609,17 +903,17 @@ class com_supportgroupsInstallerScript // Set the object into the content types table. $currency_Inserted = $db->insertObject('#__content_types', $currency); - // Create the country content type object. - $country = new stdClass(); - $country->type_title = 'Supportgroups Country'; - $country->type_alias = 'com_supportgroups.country'; - $country->table = '{"special": {"dbtable": "#__supportgroups_country","key": "id","type": "Country","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $country->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","currency":"currency","worldzone":"worldzone","codethree":"codethree","codetwo":"codetwo","alias":"alias"}}'; - $country->router = 'SupportgroupsHelperRoute::getCountryRoute'; - $country->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/country.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "currency","targetTable": "#__supportgroups_currency","targetColumn": "codethree","displayColumn": "name"}]}'; + // Create the help_document content type object. + $help_document = new stdClass(); + $help_document->type_title = 'Supportgroups Help_document'; + $help_document->type_alias = 'com_supportgroups.help_document'; + $help_document->table = '{"special": {"dbtable": "#__supportgroups_help_document","key": "id","type": "Help_document","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $help_document->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "title","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "content","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"title":"title","type":"type","groups":"groups","location":"location","admin_view":"admin_view","site_view":"site_view","target":"target","content":"content","alias":"alias","article":"article","url":"url","not_required":"not_required"}}'; + $help_document->router = 'SupportgroupsHelperRoute::getHelp_documentRoute'; + $help_document->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","type","location","target","article","not_required"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; // Set the object into the content types table. - $country_Inserted = $db->insertObject('#__content_types', $country); + $help_document_Inserted = $db->insertObject('#__content_types', $help_document); // Install the global extenstion params. @@ -654,9 +948,9 @@ class com_supportgroupsInstallerScript $support_group->type_title = 'Supportgroups Support_group'; $support_group->type_alias = 'com_supportgroups.support_group'; $support_group->table = '{"special": {"dbtable": "#__supportgroups_support_group","key": "id","type": "Support_group","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $support_group->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name"}}'; + $support_group->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","phone":"phone","location":"location","clinic":"clinic","male":"male","female":"female","female_art":"female_art","male_art":"male_art","female_children":"female_children","male_children":"male_children","area":"area"}}'; $support_group->router = 'SupportgroupsHelperRoute::getSupport_groupRoute'; - $support_group->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/support_group.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $support_group->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/support_group.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","area"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","location","clinic","male","female","female_art","male_art","female_children","male_children"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "location","targetTable": "#__supportgroups_location","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "clinic","targetTable": "#__supportgroups_clinic","targetColumn": "id","displayColumn": "name"}]}'; // Check if support_group type is already in content_type DB. $support_group_id = null; @@ -678,6 +972,64 @@ class com_supportgroupsInstallerScript $support_group_Inserted = $db->insertObject('#__content_types', $support_group); } + // Create the payment content type object. + $payment = new stdClass(); + $payment->type_title = 'Supportgroups Payment'; + $payment->type_alias = 'com_supportgroups.payment'; + $payment->table = '{"special": {"dbtable": "#__supportgroups_payment","key": "id","type": "Payment","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $payment->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "support_group","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"support_group":"support_group","year":"year","amount":"amount"}}'; + $payment->router = 'SupportgroupsHelperRoute::getPaymentRoute'; + $payment->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/payment.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","support_group","year"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "support_group","targetTable": "#__supportgroups_support_group","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if payment type is already in content_type DB. + $payment_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($payment->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $payment->type_id = $db->loadResult(); + $payment_Updated = $db->updateObject('#__content_types', $payment, 'type_id'); + } + else + { + $payment_Inserted = $db->insertObject('#__content_types', $payment); + } + + // Create the clinic content type object. + $clinic = new stdClass(); + $clinic->type_title = 'Supportgroups Clinic'; + $clinic->type_alias = 'com_supportgroups.clinic'; + $clinic->table = '{"special": {"dbtable": "#__supportgroups_clinic","key": "id","type": "Clinic","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $clinic->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","phone":"phone","area":"area"}}'; + $clinic->router = 'SupportgroupsHelperRoute::getClinicRoute'; + $clinic->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/clinic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","area"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if clinic type is already in content_type DB. + $clinic_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($clinic->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $clinic->type_id = $db->loadResult(); + $clinic_Updated = $db->updateObject('#__content_types', $clinic, 'type_id'); + } + else + { + $clinic_Inserted = $db->insertObject('#__content_types', $clinic); + } + // Create the location content type object. $location = new stdClass(); $location->type_title = 'Supportgroups Location'; @@ -736,35 +1088,6 @@ class com_supportgroupsInstallerScript $region_Inserted = $db->insertObject('#__content_types', $region); } - // Create the currency content type object. - $currency = new stdClass(); - $currency->type_title = 'Supportgroups Currency'; - $currency->type_alias = 'com_supportgroups.currency'; - $currency->table = '{"special": {"dbtable": "#__supportgroups_currency","key": "id","type": "Currency","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $currency->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","codethree":"codethree","numericcode":"numericcode","symbol":"symbol","alias":"alias","positivestyle":"positivestyle","thousands":"thousands","decimalsymbol":"decimalsymbol","decimalplace":"decimalplace","negativestyle":"negativestyle"}}'; - $currency->router = 'SupportgroupsHelperRoute::getCurrencyRoute'; - $currency->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","numericcode","decimalplace"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; - - // Check if currency type is already in content_type DB. - $currency_id = null; - $query = $db->getQuery(true); - $query->select($db->quoteName(array('type_id'))); - $query->from($db->quoteName('#__content_types')); - $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($currency->type_alias)); - $db->setQuery($query); - $db->execute(); - - // Set the object into the content types table. - if ($db->getNumRows()) - { - $currency->type_id = $db->loadResult(); - $currency_Updated = $db->updateObject('#__content_types', $currency, 'type_id'); - } - else - { - $currency_Inserted = $db->insertObject('#__content_types', $currency); - } - // Create the country content type object. $country = new stdClass(); $country->type_title = 'Supportgroups Country'; @@ -794,6 +1117,64 @@ class com_supportgroupsInstallerScript $country_Inserted = $db->insertObject('#__content_types', $country); } + // Create the currency content type object. + $currency = new stdClass(); + $currency->type_title = 'Supportgroups Currency'; + $currency->type_alias = 'com_supportgroups.currency'; + $currency->table = '{"special": {"dbtable": "#__supportgroups_currency","key": "id","type": "Currency","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $currency->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","codethree":"codethree","numericcode":"numericcode","symbol":"symbol","alias":"alias","positivestyle":"positivestyle","thousands":"thousands","decimalsymbol":"decimalsymbol","decimalplace":"decimalplace","negativestyle":"negativestyle"}}'; + $currency->router = 'SupportgroupsHelperRoute::getCurrencyRoute'; + $currency->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","numericcode","decimalplace"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if currency type is already in content_type DB. + $currency_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($currency->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $currency->type_id = $db->loadResult(); + $currency_Updated = $db->updateObject('#__content_types', $currency, 'type_id'); + } + else + { + $currency_Inserted = $db->insertObject('#__content_types', $currency); + } + + // Create the help_document content type object. + $help_document = new stdClass(); + $help_document->type_title = 'Supportgroups Help_document'; + $help_document->type_alias = 'com_supportgroups.help_document'; + $help_document->table = '{"special": {"dbtable": "#__supportgroups_help_document","key": "id","type": "Help_document","prefix": "supportgroupsTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $help_document->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "title","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "content","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"title":"title","type":"type","groups":"groups","location":"location","admin_view":"admin_view","site_view":"site_view","target":"target","content":"content","alias":"alias","article":"article","url":"url","not_required":"not_required"}}'; + $help_document->router = 'SupportgroupsHelperRoute::getHelp_documentRoute'; + $help_document->content_history_options = '{"formFile": "administrator/components/com_supportgroups/models/forms/help_document.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","type","location","target","article","not_required"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "article","targetTable": "#__content","targetColumn": "id","displayColumn": "title"}]}'; + + // Check if help_document type is already in content_type DB. + $help_document_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($help_document->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $help_document->type_id = $db->loadResult(); + $help_document_Updated = $db->updateObject('#__content_types', $help_document, 'type_id'); + } + else + { + $help_document_Inserted = $db->insertObject('#__content_types', $help_document); + } + echo ' diff --git a/site/controllers/help.php b/site/controllers/help.php new file mode 100644 index 0000000..76ceceb --- /dev/null +++ b/site/controllers/help.php @@ -0,0 +1,130 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Support Groups + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import Joomla controllerform library +jimport('joomla.application.component.controller'); + +/** + * Supportgroups Help Controller + */ +class SupportgroupsControllerHelp extends JControllerLegacy +{ + public function __construct($config) + { + parent::__construct($config); + // load the tasks + $this->registerTask('getText', 'help'); + } + + public function help() + { + $user = JFactory::getUser(); + $jinput = JFactory::getApplication()->input; + // Check Token! + $token = JSession::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($token == $call_token){ + $task = $this->getTask(); + switch($task){ + case 'getText': + try + { + $idValue = $jinput->get('id', 0, 'INT'); + if($idValue) + { + $result = $this->getHelpDocumentText($idValue); + } + else + { + $result = ''; + } + echo $result; + // stop execution gracefully + jexit(); + } + catch(Exception $e) + { + // stop execution gracefully + jexit(); + } + break; + } + } + else + { + // stop execution gracefully + jexit(); + } + } + + protected function getHelpDocumentText($id) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select(array('a.title','a.content')); + $query->from('#__supportgroups_help_document AS a'); + $query->where('a.id = '.(int) $id); + $query->where('a.published = 1'); + $query->where('a.location = 2'); + $db->setQuery($query); + $db->execute(); + if($db->getNumRows()) + { + $text = array(); + $document = $db->loadObject(); + // fix image issue + $images['src="images'] = 'src="'.JURI::root().'images'; + $images["src='images"] = "src='".JURI::root()."images"; + $images['src="/images'] = 'src="'.JURI::root().'images'; + $images["src='/images"] = "src='".JURI::root()."images"; + // set document template + $text[] = ""; + $text[] = ''; + $text[] = ""; + $text[] = ''; + $text[] = "".$document->title.""; + $text[] = ''; + $text[] = ''; + $text[] = ""; + $text[] = '
'; + $text[] = '
'; + $text[] = '
'; + // build the help text + $text[] = '

'.$document->title."

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


'; + $text[] = '
'; + $text[] = ""; + $text[] = ""; + + return implode("\n",$text); + } + return false; + } +} diff --git a/site/helpers/supportgroups.php b/site/helpers/supportgroups.php index 955409a..eeb936e 100644 --- a/site/helpers/supportgroups.php +++ b/site/helpers/supportgroups.php @@ -108,11 +108,75 @@ abstract class SupportgroupsHelper } /** - * Can be used to build help urls. + * Load the Component Help URLs. **/ public static function getHelpUrl($view) { + $user = JFactory::getUser(); + $groups = $user->get('groups'); + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url')); + $query->from('#__supportgroups_help_document AS a'); + $query->where('a.site_view = '.$db->quote($view)); + $query->where('a.location = 2'); + $query->where('a.published = 1'); + $db->setQuery($query); + $db->execute(); + if($db->getNumRows()) + { + $helps = $db->loadObjectList(); + if (self::checkArray($helps)) + { + foreach ($helps as $nr => $help) + { + if ($help->target == 1) + { + $targetgroups = json_decode($help->groups, true); + if (!array_intersect($targetgroups, $groups)) + { + // if user not in those target groups then remove the item + unset($helps[$nr]); + continue; + } + } + // set the return type + switch ($help->type) + { + // set joomla article + case 1: + return self::loadArticleLink($help->article); + break; + // set help text + case 2: + return self::loadHelpTextLink($help->id); + break; + // set Link + case 3: + return $help->url; + break; + } + } + } + } return false; + } + + /** + * Get the Article Link. + **/ + protected static function loadArticleLink($id) + { + return JURI::root().'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal'; + } + + /** + * Get the Help Text Link. + **/ + protected static function loadHelpTextLink($id) + { + $token = JSession::getFormToken(); + return 'index.php?option=com_supportgroups&task=help.getText&id=' . (int) $id . '&token=' . $token; } /** diff --git a/supportgroups.xml b/supportgroups.xml index 09b447c..8573f40 100644 --- a/supportgroups.xml +++ b/supportgroups.xml @@ -71,6 +71,8 @@ COM_SUPPORTGROUPS_MENU_SUPPORT_GROUPS + COM_SUPPORTGROUPS_MENU_PAYMENTS + COM_SUPPORTGROUPS_MENU_CLINICS COM_SUPPORTGROUPS_MENU_LOCATIONS COM_SUPPORTGROUPS_MENU_REGIONS