This commit is contained in:
Llewellyn van der Merwe 2022-03-03 04:58:38 +02:00
parent f21fdc5b3f
commit 4925167de0
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
182 changed files with 20498 additions and 19401 deletions

View File

@ -13,20 +13,20 @@ Watch this [tutorial](https://youtu.be/lkE0ZiSWufg) to see how.
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Members Manager](https://www.joomlacomponentbuilder.com/)
+ *First Build*: 6th July, 2018
+ *Last Build*: 8th February, 2021
+ *Last Build*: 2nd March, 2022
+ *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time
**136 Hours** or **17 Eight Hour Days** (actual time the author saved -
**137 Hours** or **17 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **48925**
+ *Line count*: **48989**
+ *File count*: **259**
+ *Folder count*: **70**
@ -34,11 +34,11 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> (with the following break down:
> **debugging @34hours** = codingtime / 4;
> **planning @19hours** = codingtime / 7;
> **planning @20hours** = codingtime / 7;
> **mapping @14hours** = codingtime / 10;
> **office @23hours** = codingtime / 6;)
**226 Hours** or **28 Eight Hour Days**
**227 Hours** or **28 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**,

View File

@ -13,20 +13,20 @@ Watch this [tutorial](https://youtu.be/lkE0ZiSWufg) to see how.
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Members Manager](https://www.joomlacomponentbuilder.com/)
+ *First Build*: 6th July, 2018
+ *Last Build*: 8th February, 2021
+ *Last Build*: 2nd March, 2022
+ *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time
**136 Hours** or **17 Eight Hour Days** (actual time the author saved -
**137 Hours** or **17 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **48925**
+ *Line count*: **48989**
+ *File count*: **259**
+ *Folder count*: **70**
@ -34,11 +34,11 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> (with the following break down:
> **debugging @34hours** = codingtime / 4;
> **planning @19hours** = codingtime / 7;
> **planning @20hours** = codingtime / 7;
> **mapping @14hours** = codingtime / 10;
> **office @23hours** = codingtime / 6;)
**226 Hours** or **28 Eight Hour Days**
**227 Hours** or **28 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**,

View File

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

View File

@ -1,16 +1,16 @@
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */
.no-click {
pointer-events: none;
}
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */
.no-click {
pointer-events: none;
}

View File

@ -1,16 +1,16 @@
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */
#jform_main_member_chzn {
width: 100% !important;
@ -24,4 +24,4 @@
}
.form-inline-header .control-group, .form-inline-header .control-label, .form-inline-header .controls {
display: inline-block;
}
}

View File

@ -1,14 +1,14 @@
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */

View File

@ -1,14 +1,14 @@
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */

View File

@ -1,14 +1,14 @@
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* CSS Document */

View File

@ -1,12 +1,12 @@
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/* JS Document */

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
addrulepath="/administrator/components/com_membersmanager/models/rules"
addfieldpath="/administrator/components/com_membersmanager/models/fields"
@ -56,8 +56,8 @@
required="true"
multiple="false"
/>
<!-- Spacer_hr_one Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_one" hr="true" class="spacer_hr_one" />
<!-- Spacer_hr_1 Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_1" hr="true" class="spacer_hr_1" />
<!-- Placeholder_prefix Field. Type: Text. (joomla) -->
<field
type="text"
@ -73,8 +73,8 @@
hint="COM_MEMBERSMANAGER_CONFIG_PLACEHOLDER_PREFIX_HINT"
autocomplete="on"
/>
<!-- Spacer_hr_two Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_two" hr="true" class="spacer_hr_two" />
<!-- Spacer_hr_2 Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_2" hr="true" class="spacer_hr_2" />
<field name="autorTitle"
type="spacer"
label="COM_MEMBERSMANAGER_CONFIG_AUTHOR"
@ -611,20 +611,20 @@
hint="COM_MEMBERSMANAGER_CONFIG_DOC_FOOTER_HINT"
required="true"
/>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC">
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
class="inputbox"
validate="rules"
filter="rules"
component="com_membersmanager"
section="component"
/>
</fieldset>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC">
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
class="inputbox"
validate="rules"
filter="rules"
component="com_membersmanager"
section="component"
/>
</fieldset>
</config>

View File

@ -1,114 +1,114 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* General Controller of Membersmanager component
*/
class MembersmanagerController extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
*
* @since 3.0
*/
public function __construct($config = array())
{
// set the default view
$config['default_view'] = 'members';
parent::__construct($config);
}
/**
* display task
*
* @return void
*/
function display($cachable = false, $urlparams = false)
{
// set default view if not set
$view = $this->input->getCmd('view', 'members');
$data = $this->getViewRelation($view);
$layout = $this->input->get('layout', null, 'WORD');
$id = $this->input->getInt('id');
// Check for edit form.
if(MembersmanagerHelper::checkArray($data))
{
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_membersmanager.edit.'.$data['view'], $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
// check if item was opend from other then its own list view
$ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0);
// set redirect
if ($refid > 0 && MembersmanagerHelper::checkString($ref))
{
// redirect to item of ref
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
}
elseif (MembersmanagerHelper::checkString($ref))
{
// redirect to ref
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view='.(string)$ref, false));
}
else
{
// normal redirect back to the list view
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view='.$data['views'], false));
}
return false;
}
}
return parent::display($cachable, $urlparams);
}
protected function getViewRelation($view)
{
// check the we have a value
if (MembersmanagerHelper::checkString($view))
{
// the view relationships
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* General Controller of Membersmanager component
*/
class MembersmanagerController extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
*
* @since 3.0
*/
public function __construct($config = array())
{
// set the default view
$config['default_view'] = 'members';
parent::__construct($config);
}
/**
* display task
*
* @return void
*/
function display($cachable = false, $urlparams = false)
{
// set default view if not set
$view = $this->input->getCmd('view', 'members');
$data = $this->getViewRelation($view);
$layout = $this->input->get('layout', null, 'WORD');
$id = $this->input->getInt('id');
// Check for edit form.
if(MembersmanagerHelper::checkArray($data))
{
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_membersmanager.edit.'.$data['view'], $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
// check if item was opend from other then its own list view
$ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0);
// set redirect
if ($refid > 0 && MembersmanagerHelper::checkString($ref))
{
// redirect to item of ref
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
}
elseif (MembersmanagerHelper::checkString($ref))
{
// redirect to ref
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view='.(string)$ref, false));
}
else
{
// normal redirect back to the list view
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view='.$data['views'], false));
}
return false;
}
}
return parent::display($cachable, $urlparams);
}
protected function getViewRelation($view)
{
// check the we have a value
if (MembersmanagerHelper::checkString($view))
{
// the view relationships
$views = array(
'member' => 'members',
'type' => 'types'
);
// check if this is a list view
if (in_array($view, $views))
{
// this is a list view
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
}
// check if it is an edit view
elseif (array_key_exists($view, $views))
{
// this is a edit view
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
}
}
return false;
}
}
'type' => 'types'
);
// check if this is a list view
if (in_array($view, $views))
{
// this is a list view
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
}
// check if it is an edit view
elseif (array_key_exists($view, $views))
{
// this is a edit view
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
}
}
return false;
}
}

View File

@ -1,32 +1,34 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Ajax Controller
*/
class MembersmanagerControllerAjax extends JControllerLegacy
{
public function __construct($config)
{
parent::__construct($config);
// make sure all json stuff are set
JFactory::getDocument()->setMimeEncoding( 'application/json' );
JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"');
JResponse::setHeader("Access-Control-Allow-Origin", "*");
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Ajax Controller
*/
class MembersmanagerControllerAjax extends JControllerLegacy
{
public function __construct($config)
{
parent::__construct($config);
// make sure all json stuff are set
JFactory::getDocument()->setMimeEncoding( 'application/json' );
// get the application
$app = JFactory::getApplication();
$app->setHeader('Content-Disposition','attachment;filename="getajax.json"');
$app->setHeader('Access-Control-Allow-Origin', '*');
// load the tasks
$this->registerTask('checkUnique', 'ajax');
$this->registerTask('getPlaceHolders', 'ajax');
@ -34,25 +36,31 @@ class MembersmanagerControllerAjax extends JControllerLegacy
$this->registerTask('uploadfile', 'ajax');
$this->registerTask('removeFile', 'ajax');
$this->registerTask('getUserDetails', 'ajax');
$this->registerTask('getChartImageLink', 'ajax');
}
public function ajax()
{
$user = JFactory::getUser();
$jinput = JFactory::getApplication()->input;
// Check Token!
$token = JSession::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM');
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
{
$task = $this->getTask();
switch($task)
$this->registerTask('getChartImageLink', 'ajax');
}
public function ajax()
{
// get the user for later use
$user = JFactory::getUser();
// get the input values
$jinput = JFactory::getApplication()->input;
// check if we should return raw
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
// return to a callback function
$callback = $jinput->get('callback', null, 'CMD');
// Check Token!
$token = JSession::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM');
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
{
// get the task
$task = $this->getTask();
switch($task)
{
case 'checkUnique':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$fieldValue = $jinput->get('field', NULL, 'WORD');
$valueValue = $jinput->get('value', NULL, 'STRING');
if($fieldValue && $user->id != 0 && $valueValue)
@ -63,7 +71,7 @@ class MembersmanagerControllerAjax extends JControllerLegacy
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
@ -78,10 +86,14 @@ class MembersmanagerControllerAjax extends JControllerLegacy
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
@ -91,7 +103,6 @@ class MembersmanagerControllerAjax extends JControllerLegacy
case 'getPlaceHolders':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$getTypeValue = $jinput->get('getType', NULL, 'WORD');
if($getTypeValue && $user->id != 0)
{
@ -101,7 +112,7 @@ class MembersmanagerControllerAjax extends JControllerLegacy
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
@ -116,10 +127,14 @@ class MembersmanagerControllerAjax extends JControllerLegacy
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
@ -129,7 +144,6 @@ class MembersmanagerControllerAjax extends JControllerLegacy
case 'getAnyPlaceHolders':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$getTypeValue = $jinput->get('getType', NULL, 'WORD');
if($getTypeValue && $user->id != 0)
{
@ -139,7 +153,7 @@ class MembersmanagerControllerAjax extends JControllerLegacy
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
@ -154,10 +168,14 @@ class MembersmanagerControllerAjax extends JControllerLegacy
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
@ -167,7 +185,6 @@ class MembersmanagerControllerAjax extends JControllerLegacy
case 'uploadfile':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$targetValue = $jinput->get('target', NULL, 'WORD');
$typeValue = $jinput->get('type', NULL, 'WORD');
if($targetValue && $user->id != 0 && $typeValue)
@ -178,7 +195,7 @@ class MembersmanagerControllerAjax extends JControllerLegacy
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
@ -193,10 +210,14 @@ class MembersmanagerControllerAjax extends JControllerLegacy
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
@ -206,7 +227,6 @@ class MembersmanagerControllerAjax extends JControllerLegacy
case 'removeFile':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$filenameValue = $jinput->get('filename', NULL, 'CMD');
$targetValue = $jinput->get('target', NULL, 'WORD');
$flushValue = $jinput->get('flush', NULL, 'INT');
@ -219,7 +239,7 @@ class MembersmanagerControllerAjax extends JControllerLegacy
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
@ -234,10 +254,14 @@ class MembersmanagerControllerAjax extends JControllerLegacy
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
@ -247,7 +271,6 @@ class MembersmanagerControllerAjax extends JControllerLegacy
case 'getUserDetails':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$userValue = $jinput->get('user', NULL, 'INT');
if($userValue && $user->id != 0)
{
@ -257,7 +280,7 @@ class MembersmanagerControllerAjax extends JControllerLegacy
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
@ -272,10 +295,14 @@ class MembersmanagerControllerAjax extends JControllerLegacy
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
@ -285,7 +312,6 @@ class MembersmanagerControllerAjax extends JControllerLegacy
case 'getChartImageLink':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$chartValue = $jinput->get('chart', NULL, 'STRING');
if($chartValue && $user->id != 0)
{
@ -295,7 +321,7 @@ class MembersmanagerControllerAjax extends JControllerLegacy
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback . "(".json_encode($result).");";
}
@ -310,28 +336,37 @@ class MembersmanagerControllerAjax extends JControllerLegacy
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
if($callback)
{
echo $callback."(".json_encode($e).");";
}
elseif($returnRaw)
{
echo json_encode($e);
}
else
{
echo "(".json_encode($e).");";
}
}
break;
}
}
else
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode(false).");";
}
else
{
echo "(".json_encode(false).");";
}
}
}
}
break;
}
}
else
{
// return to a callback function
if($callback)
{
echo $callback."(".json_encode(false).");";
}
elseif($returnRaw)
{
echo json_encode(false);
}
else
{
echo "(".json_encode(false).");";
}
}
}
}

View File

@ -1,56 +1,56 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Import Controller
*/
class MembersmanagerControllerImport extends JControllerLegacy
{
/**
* Import an spreadsheet.
*
* @return void
*/
public function import()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$model = $this->getModel('import');
if ($model->import())
{
$cache = JFactory::getCache('mod_menu');
$cache->clean();
// TODO: Reset the users acl here as well to kill off any missing bits
}
$app = JFactory::getApplication();
$redirect_url = $app->getUserState('com_membersmanager.redirect_url');
if (empty($redirect_url))
{
$redirect_url = JRoute::_('index.php?option=com_membersmanager&view=import', false);
}
else
{
// wipe out the user state when we're going to redirect
$app->setUserState('com_membersmanager.redirect_url', '');
$app->setUserState('com_membersmanager.message', '');
$app->setUserState('com_membersmanager.extension_message', '');
}
$this->setRedirect($redirect_url);
}
}
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Import Controller
*/
class MembersmanagerControllerImport extends JControllerLegacy
{
/**
* Import an spreadsheet.
*
* @return void
*/
public function import()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$model = $this->getModel('import');
if ($model->import())
{
$cache = JFactory::getCache('mod_menu');
$cache->clean();
// TODO: Reset the users acl here as well to kill off any missing bits
}
$app = JFactory::getApplication();
$redirect_url = $app->getUserState('com_membersmanager.redirect_url');
if (empty($redirect_url))
{
$redirect_url = JRoute::_('index.php?option=com_membersmanager&view=import', false);
}
else
{
// wipe out the user state when we're going to redirect
$app->setUserState('com_membersmanager.redirect_url', '');
$app->setUserState('com_membersmanager.message', '');
$app->setUserState('com_membersmanager.extension_message', '');
}
$this->setRedirect($redirect_url);
}
}

View File

@ -1,45 +1,45 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Member Controller
*/
class MembersmanagerControllerMember extends JControllerForm
{
/**
* Current or most recently performed task.
*
* @var string
* @since 12.2
* @note Replaces _task.
*/
protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array())
{
$this->view_list = 'Members'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Member Controller
*/
class MembersmanagerControllerMember extends JControllerForm
{
/**
* Current or most recently performed task.
*
* @var string
* @since 12.2
* @note Replaces _task.
*/
protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array())
{
$this->view_list = 'Members'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
}
/**
@ -127,18 +127,18 @@ class MembersmanagerControllerMember extends JControllerForm
return $saved;
}
/**
* 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())
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = array())
{
// Get user object.
$user = JFactory::getUser();
@ -150,20 +150,20 @@ class MembersmanagerControllerMember extends JControllerForm
}
// In the absense of better information, revert to the component permissions.
return $user->authorise('member.create', $this->option);
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
return $user->authorise('member.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();
@ -217,197 +217,197 @@ class MembersmanagerControllerMember extends JControllerForm
}
}
// Since there is no permission, revert to the component permissions.
return $user->authorise('member.edit', $this->option);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
// get the referral options (old method use return instead see parent)
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
// set the referral options
if ($refid && $ref)
{
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
}
elseif ($ref)
{
$append = '&ref='. (string)$ref . $append;
}
return $append;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 2.5
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Member', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=members' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 12.2
*/
public function cancel($key = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key);
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $cancel;
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 12.2
*/
public function save($key = null, $urlVar = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
// This is not needed since parent save already does this
// Due to the ref and refid implementation we need to add this
if ($canReturn)
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $saved;
}
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 11.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
return $user->authorise('member.edit', $this->option);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
// get the referral options (old method use return instead see parent)
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
// set the referral options
if ($refid && $ref)
{
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
}
elseif ($ref)
{
$append = '&ref='. (string)$ref . $append;
}
return $append;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 2.5
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Member', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=members' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 12.2
*/
public function cancel($key = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key);
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $cancel;
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 12.2
*/
public function save($key = null, $urlVar = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
// This is not needed since parent save already does this
// Due to the ref and refid implementation we need to add this
if ($canReturn)
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $saved;
}
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 11.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
// safe all dynamic values (that has been posted)
if (isset($validData['id']))
@ -422,7 +422,7 @@ class MembersmanagerControllerMember extends JControllerForm
MembersmanagerHelper::saveRelationships($validData);
}
return;
}
}
return;
}
}

View File

@ -1,47 +1,47 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Members Controller
*/
class MembersmanagerControllerMembers extends JControllerAdmin
{
/**
* The prefix to use with controller messages.
*
* @var string
* @since 1.6
*/
protected $text_prefix = 'COM_MEMBERSMANAGER_MEMBERS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Member', $prefix = 'MembersmanagerModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Members Controller
*/
class MembersmanagerControllerMembers extends JControllerAdmin
{
/**
* The prefix to use with controller messages.
*
* @var string
* @since 1.6
*/
protected $text_prefix = 'COM_MEMBERSMANAGER_MEMBERS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Member', $prefix = 'MembersmanagerModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
public function exportData()
@ -134,5 +134,5 @@ class MembersmanagerControllerMembers extends JControllerAdmin
}
$this->setRedirect($redirect_url);
return false;
}
}
}
}

View File

@ -1,57 +1,57 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Type Controller
*/
class MembersmanagerControllerType extends JControllerForm
{
/**
* Current or most recently performed task.
*
* @var string
* @since 12.2
* @note Replaces _task.
*/
protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array())
{
$this->view_list = 'Types'; // 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())
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Type Controller
*/
class MembersmanagerControllerType extends JControllerForm
{
/**
* Current or most recently performed task.
*
* @var string
* @since 12.2
* @note Replaces _task.
*/
protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array())
{
$this->view_list = 'Types'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
}
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = array())
{
// Get user object.
$user = JFactory::getUser();
@ -63,20 +63,20 @@ class MembersmanagerControllerType extends JControllerForm
}
// In the absense of better information, revert to the component permissions.
return $user->authorise('type.create', $this->option);
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
return $user->authorise('type.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();
@ -126,199 +126,199 @@ class MembersmanagerControllerType extends JControllerForm
}
}
// Since there is no permission, revert to the component permissions.
return $user->authorise('type.edit', $this->option);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
// get the referral options (old method use return instead see parent)
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
// set the referral options
if ($refid && $ref)
{
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
}
elseif ($ref)
{
$append = '&ref='. (string)$ref . $append;
}
return $append;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 2.5
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Type', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=types' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 12.2
*/
public function cancel($key = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key);
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $cancel;
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 12.2
*/
public function save($key = null, $urlVar = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
// This is not needed since parent save already does this
// Due to the ref and refid implementation we need to add this
if ($canReturn)
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $saved;
}
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 11.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
return $user->authorise('type.edit', $this->option);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
return;
}
}
// get the referral options (old method use return instead see parent)
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
// set the referral options
if ($refid && $ref)
{
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
}
elseif ($ref)
{
$append = '&ref='. (string)$ref . $append;
}
return $append;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 2.5
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Type', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=types' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 12.2
*/
public function cancel($key = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key);
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $cancel;
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 12.2
*/
public function save($key = null, $urlVar = null)
{
// get the referral options
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
// This is not needed since parent save already does this
// Due to the ref and refid implementation we need to add this
if ($canReturn)
{
$redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $saved;
}
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 11.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
return;
}
}

View File

@ -1,47 +1,47 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Types Controller
*/
class MembersmanagerControllerTypes extends JControllerAdmin
{
/**
* The prefix to use with controller messages.
*
* @var string
* @since 1.6
*/
protected $text_prefix = 'COM_MEMBERSMANAGER_TYPES';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Type', $prefix = 'MembersmanagerModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Types Controller
*/
class MembersmanagerControllerTypes extends JControllerAdmin
{
/**
* The prefix to use with controller messages.
*
* @var string
* @since 1.6
*/
protected $text_prefix = 'COM_MEMBERSMANAGER_TYPES';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Type', $prefix = 'MembersmanagerModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
public function exportData()
@ -135,5 +135,5 @@ class MembersmanagerControllerTypes extends JControllerAdmin
$this->setRedirect($redirect_url);
return false;
}
}
}

View File

@ -1,72 +1,72 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
class membersmanagerHeaderCheck
{
function js_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
$app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
foreach (array_keys($head_data['scripts']) as $script)
{
if (stristr($script, $script_name))
{
return true;
}
}
return false;
}
function css_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
$app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
foreach (array_keys($head_data['styleSheets']) as $script)
{
if (stristr($script, $script_name))
{
return true;
}
}
return false;
}
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
class membersmanagerHeaderCheck
{
function js_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
$app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
foreach (array_keys($head_data['scripts']) as $script)
{
if (stristr($script, $script_name))
{
return true;
}
}
return false;
}
function css_loaded($script_name)
{
// UIkit check point
if (strpos($script_name,'uikit') !== false)
{
$app = JFactory::getApplication();
$getTemplateName = $app->getTemplate('template')->template;
if (strpos($getTemplateName,'yoo') !== false)
{
return true;
}
}
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
foreach (array_keys($head_data['styleSheets']) as $script)
{
if (stristr($script, $script_name))
{
return true;
}
}
return false;
}
}

View File

@ -1,79 +1,79 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_PLATFORM') or die;
/**
* Utility class to render a list view batch selection options
*
* @since 3.0
*/
abstract class JHtmlBatch_
{
/**
* ListSelection
*
* @var array
* @since 3.0
*/
protected static $ListSelection = array();
/**
* Render the batch selection options.
*
* @return string The necessary HTML to display the batch selection options
*
* @since 3.0
*/
public static function render()
{
// Collect display data
$data = new stdClass;
$data->ListSelection = static::getListSelection();
// Create a layout object and ask it to render the batch selection options
$layout = new JLayoutFile('batchselection');
$batchHtml = $layout->render($data);
return $batchHtml;
}
/**
* Method to add a list selection to the batch modal
*
* @param string $label Label for the menu item.
* @param string $name Name for the filter. Also used as id.
* @param string $options Options for the select field.
* @param bool $noDefault Don't the label as the empty option
*
* @return void
*
* @since 3.0
*/
public static function addListSelection($label, $name, $options, $noDefault = false)
{
array_push(static::$ListSelection, array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault));
}
/**
* Returns an array of all ListSelection
*
* @return array
*
* @since 3.0
*/
public static function getListSelection()
{
return static::$ListSelection;
}
}
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_PLATFORM') or die;
/**
* Utility class to render a list view batch selection options
*
* @since 3.0
*/
abstract class JHtmlBatch_
{
/**
* ListSelection
*
* @var array
* @since 3.0
*/
protected static $ListSelection = array();
/**
* Render the batch selection options.
*
* @return string The necessary HTML to display the batch selection options
*
* @since 3.0
*/
public static function render()
{
// Collect display data
$data = new stdClass;
$data->ListSelection = static::getListSelection();
// Create a layout object and ask it to render the batch selection options
$layout = new JLayoutFile('batchselection');
$batchHtml = $layout->render($data);
return $batchHtml;
}
/**
* Method to add a list selection to the batch modal
*
* @param string $label Label for the menu item.
* @param string $name Name for the filter. Also used as id.
* @param string $options Options for the select field.
* @param bool $noDefault Don't the label as the empty option
*
* @return void
*
* @since 3.0
*/
public static function addListSelection($label, $name, $options, $noDefault = false)
{
array_push(static::$ListSelection, array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault));
}
/**
* Returns an array of all ListSelection
*
* @return array
*
* @since 3.0
*/
public static function getListSelection()
{
return static::$ListSelection;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +1,49 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_BASE') or die;
JHtmlBehavior::core();
$divWrapper = range(1,120,2);
$counter = 0;
?>
<?php if ($displayData->ListSelection) : ?>
<div class="row-fluid">
<?php foreach ($displayData->ListSelection as $ListSelection) : ?>
<div class="control-group span6">
<div class="controls">
<label for="<?php echo $ListSelection['name']; ?>" class="element-invisible"><?php echo $ListSelection['label']; ?></label>
<select name="<?php echo $ListSelection['name']; ?>" id="<?php echo $ListSelection['name']; ?>" class="span12 small">
<?php if (!$ListSelection['noDefault']) : ?>
<option value=""><?php echo $ListSelection['label']; ?></option>
<?php endif; ?>
<?php echo $ListSelection['options']; ?>
</select>
</div>
</div>
<?php if (in_array($counter,$divWrapper)) : ?>
</div>
<div class="row-fluid">
<?php endif; ?>
<?php $counter++; ?>
<?php endforeach; ?>
</div>
<div class="control-group radio" id="batch-move-copy">
<div class="controls">
<label class="radio" id="batch[move_copy]c-lbl" for="batch[move_copy]c">
<input type="radio" value="c" id="batch[move_copy]c" name="batch[move_copy]"><?php echo JText::_('Copy'); ?></label>
<label class="radio" id="batch[move_copy]m-lbl" for="batch[move_copy]m">
<input type="radio" checked="checked" value="m" id="batch[move_copy]m" name="batch[move_copy]"><?php echo JText::_('Update'); ?></label>
</div>
</div>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_BASE') or die;
JHtmlBehavior::core();
$divWrapper = range(1,120,2);
$counter = 0;
?>
<?php if ($displayData->ListSelection) : ?>
<div class="row-fluid">
<?php foreach ($displayData->ListSelection as $ListSelection) : ?>
<div class="control-group span6">
<div class="controls">
<label for="<?php echo $ListSelection['name']; ?>" class="element-invisible"><?php echo $ListSelection['label']; ?></label>
<select name="<?php echo $ListSelection['name']; ?>" id="<?php echo $ListSelection['name']; ?>" class="span12 small">
<?php if (!$ListSelection['noDefault']) : ?>
<option value=""><?php echo $ListSelection['label']; ?></option>
<?php endif; ?>
<?php echo $ListSelection['options']; ?>
</select>
</div>
</div>
<?php if (in_array($counter,$divWrapper)) : ?>
</div>
<div class="row-fluid">
<?php endif; ?>
<?php $counter++; ?>
<?php endforeach; ?>
</div>
<div class="control-group radio" id="batch-move-copy">
<div class="controls">
<label class="radio" id="batch[move_copy]c-lbl" for="batch[move_copy]c">
<input type="radio" value="c" id="batch[move_copy]c" name="batch[move_copy]"><?php echo JText::_('Copy'); ?></label>
<label class="radio" id="batch[move_copy]m-lbl" for="batch[move_copy]m">
<input type="radio" checked="checked" value="m" id="batch[move_copy]m" name="batch[move_copy]"><?php echo JText::_('Update'); ?></label>
</div>
</div>
<?php endif; ?>

View File

@ -1,47 +1,47 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'token',
'account',
'user'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-inline form-inline-header">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
'user'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-inline form-inline-header">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>

View File

@ -1,32 +1,32 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'type',
'name',
'surname',
@ -37,17 +37,17 @@ $fields = $displayData->get($fields_tab_layout) ?: array(
'password_check',
'main_member',
'not_required',
'profile_image'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
'profile_image'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,43 +1,43 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'profile_image_uploader'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'profile_image_uploader'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,47 +1,47 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'title',
'created',
'created_by',
'modified',
'modified_by'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
'modified_by'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,48 +1,48 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'published',
'ordering',
'access',
'version',
'hits',
'id'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
'id'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,20 +1,20 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
?>
<?php if ($displayData->state->get('filter.published') == -2 && ($displayData->canState && $displayData->canDelete)) : ?>
<script>
@ -71,4 +71,4 @@ defined('JPATH_BASE') or die('Restricted access');
<?= JText::_("COM_MEMBERSMANAGER_EXIT_TRASH") ?>
</button>
</div>
<?php endif; ?>
<?php endif; ?>

View File

@ -1,46 +1,46 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'add_relationship',
'type',
'edit_relationship',
'view_relationship'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
'view_relationship'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,44 +1,44 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'communicate',
'field_type'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
'field_type'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,46 +1,46 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'name',
'alias'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-inline form-inline-header">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
'alias'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-inline form-inline-header">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>

View File

@ -1,45 +1,45 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'description'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-vertical">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'description'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-vertical">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>

View File

@ -1,43 +1,43 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'groups_target'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'groups_target'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,43 +1,43 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'groups_access'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'groups_access'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,47 +1,47 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'title',
'created',
'created_by',
'modified',
'modified_by'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
'modified_by'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,48 +1,48 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'published',
'ordering',
'access',
'version',
'hits',
'id'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>
'id'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -1,43 +1,43 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_membersmanager'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
};
// Add CSS file for all pages
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_membersmanager/assets/css/admin.css');
$document->addScript('components/com_membersmanager/assets/js/admin.js');
// require helper files
JLoader::register('MembersmanagerHelper', __DIR__ . '/helpers/membersmanager.php');
JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// Triger the Global Admin Event
MembersmanagerHelper::globalEvent($document);
// Get an instance of the controller prefixed by Membersmanager
$controller = JControllerLegacy::getInstance('Membersmanager');
// Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task'));
// Redirect if set by the controller
$controller->redirect();
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_membersmanager'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
};
// Add CSS file for all pages
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_membersmanager/assets/css/admin.css');
$document->addScript('components/com_membersmanager/assets/js/admin.js');
// require helper files
JLoader::register('MembersmanagerHelper', __DIR__ . '/helpers/membersmanager.php');
JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
// Trigger the Global Admin Event
MembersmanagerHelper::globalEvent($document);
// Get an instance of the controller prefixed by Membersmanager
$controller = JControllerLegacy::getInstance('Membersmanager');
// Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task'));
// Redirect if set by the controller
$controller->redirect();

View File

@ -1,33 +1,33 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Ajax Model
*/
class MembersmanagerModelAjax extends JModelList
{
protected $app_params;
public function __construct()
{
parent::__construct();
// get params
$this->app_params = JComponentHelper::getParams('com_membersmanager');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Ajax Model
*/
class MembersmanagerModelAjax extends JModelList
{
protected $app_params;
public function __construct()
{
parent::__construct();
// get params
$this->app_params = JComponentHelper::getParams('com_membersmanager');
}
// Used in member
@ -765,5 +765,5 @@ class MembersmanagerModelAjax extends JModelList
JText::_('COM_MEMBERSMANAGER_THERE_WAS_AN_ERROR_PLEASE_TRY_AGAIN_LATER_IF_THIS_ERROR_CONTINUES_CONTACT_YOUR_SYSTEM_ADMINISTRATOR') .
'</div></div>';
}
}
}

View File

@ -1,41 +1,41 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Allowedimageformats Form Field class for the Membersmanager component
*/
class JFormFieldAllowedimageformats extends JFormFieldList
{
/**
* The allowedimageformats field type.
*
* @var string
*/
public $type = 'allowedimageformats';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Allowedimageformats Form Field class for the Membersmanager component
*/
class JFormFieldAllowedimageformats extends JFormFieldList
{
/**
* The allowedimageformats field type.
*
* @var string
*/
public $type = 'allowedimageformats';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// check if helper class already is set
if (!class_exists('MembersmanagerHelper'))
@ -84,6 +84,6 @@ class JFormFieldAllowedimageformats extends JFormFieldList
}
}
}
return $options;
}
}
return $options;
}
}

View File

@ -1,32 +1,32 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Mainmembers Form Field class for the Membersmanager component
*/
class JFormFieldMainmembers extends JFormFieldList
{
/**
* The mainmembers field type.
*
* @var string
*/
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Mainmembers Form Field class for the Membersmanager component
*/
class JFormFieldMainmembers extends JFormFieldList
{
/**
* The mainmembers field type.
*
* @var string
*/
public $type = 'mainmembers';
/**
@ -131,15 +131,15 @@ class JFormFieldMainmembers extends JFormFieldList
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// get the user
$my = JFactory::getUser();
@ -210,6 +210,6 @@ class JFormFieldMainmembers extends JFormFieldList
// load the current member manual
$options[] = JHtml::_('select.option', (int) $main_member, MembersmanagerHelper::getMemberName($main_member));
}
return $options;
}
}
return $options;
}
}

View File

@ -1,41 +1,41 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Membersfilteraccount Form Field class for the Membersmanager component
*/
class JFormFieldMembersfilteraccount extends JFormFieldList
{
/**
* The membersfilteraccount field type.
*
* @var string
*/
public $type = 'membersfilteraccount';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Membersfilteraccount Form Field class for the Membersmanager component
*/
class JFormFieldMembersfilteraccount extends JFormFieldList
{
/**
* The membersfilteraccount field type.
*
* @var string
*/
public $type = 'membersfilteraccount';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
@ -67,6 +67,6 @@ class JFormFieldMembersfilteraccount extends JFormFieldList
$_filter[] = JHtml::_('select.option', $account, JText::_($text));
}
}
return $_filter;
}
}
return $_filter;
}
}

View File

@ -1,41 +1,41 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Memberuser Form Field class for the Membersmanager component
*/
class JFormFieldMemberuser extends JFormFieldList
{
/**
* The memberuser field type.
*
* @var string
*/
public $type = 'memberuser';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Memberuser Form Field class for the Membersmanager component
*/
class JFormFieldMemberuser extends JFormFieldList
{
/**
* The memberuser field type.
*
* @var string
*/
public $type = 'memberuser';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// load the db object
$db = JFactory::getDBO();
// get the input from url
@ -132,6 +132,6 @@ class JFormFieldMemberuser extends JFormFieldList
// load the current member manual
$options[] = JHtml::_('select.option', (int) $user, JFactory::getUser($user)->name);
}
return $options;
}
}
return $options;
}
}

View File

@ -1,41 +1,41 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Onetomanycomponents Form Field class for the Membersmanager component
*/
class JFormFieldOnetomanycomponents extends JFormFieldList
{
/**
* The onetomanycomponents field type.
*
* @var string
*/
public $type = 'onetomanycomponents';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Onetomanycomponents Form Field class for the Membersmanager component
*/
class JFormFieldOnetomanycomponents extends JFormFieldList
{
/**
* The onetomanycomponents field type.
*
* @var string
*/
public $type = 'onetomanycomponents';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
$options = array();
// get the component name
@ -91,6 +91,6 @@ class JFormFieldOnetomanycomponents extends JFormFieldList
$options[] = JHtml::_('select.option', $item->element, $item->name . ' (' . $type . ')');
}
}
return $options;
}
}
return $options;
}
}

View File

@ -1,41 +1,41 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Onetoonecomponents Form Field class for the Membersmanager component
*/
class JFormFieldOnetoonecomponents extends JFormFieldList
{
/**
* The onetoonecomponents field type.
*
* @var string
*/
public $type = 'onetoonecomponents';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Onetoonecomponents Form Field class for the Membersmanager component
*/
class JFormFieldOnetoonecomponents extends JFormFieldList
{
/**
* The onetoonecomponents field type.
*
* @var string
*/
public $type = 'onetoonecomponents';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
$options = array();
// get the component name
@ -91,6 +91,6 @@ class JFormFieldOnetoonecomponents extends JFormFieldList
$options[] = JHtml::_('select.option', $item->element, $item->name . ' (' . $type . ')');
}
}
return $options;
}
}
return $options;
}
}

View File

@ -1,41 +1,41 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Targettypes Form Field class for the Membersmanager component
*/
class JFormFieldTargettypes extends JFormFieldList
{
/**
* The targettypes field type.
*
* @var string
*/
public $type = 'targettypes';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Targettypes Form Field class for the Membersmanager component
*/
class JFormFieldTargettypes extends JFormFieldList
{
/**
* The targettypes field type.
*
* @var string
*/
public $type = 'targettypes';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// load the db opbject
$db = JFactory::getDBO();
// start query
@ -54,6 +54,6 @@ class JFormFieldTargettypes extends JFormFieldList
$options[] = JHtml::_('select.option', $item->id, $item->target_type_name);
}
}
return $options;
}
}
return $options;
}
}

View File

@ -1,32 +1,32 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Types Form Field class for the Membersmanager component
*/
class JFormFieldTypes extends JFormFieldList
{
/**
* The types field type.
*
* @var string
*/
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Types Form Field class for the Membersmanager component
*/
class JFormFieldTypes extends JFormFieldList
{
/**
* The types field type.
*
* @var string
*/
public $type = 'types';
/**
@ -131,15 +131,15 @@ class JFormFieldTypes extends JFormFieldList
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get the user object.
$user = JFactory::getUser();
// Get the databse object.
@ -159,6 +159,6 @@ class JFormFieldTypes extends JFormFieldList
$options[] = JHtml::_('select.option', $item->id, $item->type_name);
}
}
return $options;
}
}
return $options;
}
}

View File

@ -1,41 +1,41 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Typesfilteraddrelationship Form Field class for the Membersmanager component
*/
class JFormFieldTypesfilteraddrelationship extends JFormFieldList
{
/**
* The typesfilteraddrelationship field type.
*
* @var string
*/
public $type = 'typesfilteraddrelationship';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Typesfilteraddrelationship Form Field class for the Membersmanager component
*/
class JFormFieldTypesfilteraddrelationship extends JFormFieldList
{
/**
* The typesfilteraddrelationship field type.
*
* @var string
*/
public $type = 'typesfilteraddrelationship';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
@ -67,6 +67,6 @@ class JFormFieldTypesfilteraddrelationship extends JFormFieldList
$_filter[] = JHtml::_('select.option', $add_relationship, JText::_($text));
}
}
return $_filter;
}
}
return $_filter;
}
}

View File

@ -1,32 +1,32 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Typesonmember Form Field class for the Membersmanager component
*/
class JFormFieldTypesonmember extends JFormFieldList
{
/**
* The typesonmember field type.
*
* @var string
*/
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Typesonmember Form Field class for the Membersmanager component
*/
class JFormFieldTypesonmember extends JFormFieldList
{
/**
* The typesonmember field type.
*
* @var string
*/
public $type = 'typesonmember';
/**
@ -131,15 +131,15 @@ class JFormFieldTypesonmember extends JFormFieldList
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// load the db opbject
$db = JFactory::getDBO();
// get the user
@ -205,6 +205,6 @@ class JFormFieldTypesonmember extends JFormFieldList
$options[] = JHtml::_('select.option', $item->id, $item->type_name);
}
}
return $options;
}
}
return $options;
}
}

View File

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

View File

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

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_membersmanager/models/rules"
addfieldpath="/administrator/components/com_membersmanager/models/fields"
>
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_membersmanager/models/rules"
addfieldpath="/administrator/components/com_membersmanager/models/fields"
>
<fieldset name="details">
<!-- Default Fields. -->
<!-- Id Field. Type: Text (joomla) -->
@ -102,8 +102,6 @@
maxlength="150"
description="COM_MEMBERSMANAGER_MEMBER_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_MEMBERSMANAGER_MEMBER_NAME_MESSAGE"
@ -280,8 +278,8 @@
required="false"
button="true"
/>
</fieldset>
</fieldset>
<!-- Access Control Fields. -->
<fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) -->
@ -302,5 +300,5 @@
component="com_membersmanager"
section="member"
/>
</fieldset>
</fieldset>
</form>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_membersmanager/models/rules"
addfieldpath="/administrator/components/com_membersmanager/models/fields"
>
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_membersmanager/models/rules"
addfieldpath="/administrator/components/com_membersmanager/models/fields"
>
<fieldset name="details">
<!-- Default Fields. -->
<!-- Id Field. Type: Text (joomla) -->
@ -102,8 +102,6 @@
maxlength="150"
description="COM_MEMBERSMANAGER_TYPE_NAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="COM_MEMBERSMANAGER_TYPE_NAME_MESSAGE"
@ -228,8 +226,8 @@
filter="STRING"
hint="COM_MEMBERSMANAGER_TYPE_ALIAS_HINT"
/>
</fieldset>
</fieldset>
<!-- Access Control Fields. -->
<fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) -->
@ -250,5 +248,5 @@
component="com_membersmanager"
section="type"
/>
</fieldset>
</fieldset>
</form>

View File

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

View File

@ -1,32 +1,32 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Member Model
*/
class MembersmanagerModelMember extends JModelAdmin
{
/**
* The tab layout fields array.
*
* @var array
*/
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Member Model
*/
class MembersmanagerModelMember extends JModelAdmin
{
/**
* The tab layout fields array.
*
* @var array
*/
protected $tabLayoutFields = array(
'membership' => array(
'left' => array(
@ -51,73 +51,73 @@ class MembersmanagerModelMember extends JModelAdmin
'user'
)
)
);
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_MEMBERSMANAGER';
/**
* The type alias for this content type.
*
* @var string
* @since 3.2
*/
public $typeAlias = 'com_membersmanager.member';
/**
* 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 = 'member', $prefix = 'MembersmanagerTable', $config = array())
{
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_membersmanager/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config);
);
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_MEMBERSMANAGER';
/**
* The type alias for this content type.
*
* @var string
* @since 3.2
*/
public $typeAlias = 'com_membersmanager.member';
/**
* 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 = 'member', $prefix = 'MembersmanagerTable', $config = array())
{
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_membersmanager/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config);
}
public function getVDM()
{
return $this->vastDevMod;
}
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata))
{
// Convert the metadata field to an array.
$registry = new Registry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata))
{
// Convert the metadata field to an array.
$registry = new Registry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
// Get the medium encryption.
@ -182,32 +182,26 @@ class MembersmanagerModelMember extends JModelAdmin
$item->useremail = $member->email;
// set the username
$item->username = $member->username;
}
if (!empty($item->id))
{
$item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_membersmanager.member');
}
}
return $item;
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @param array $options Optional array of options for the form creation.
*
* @return mixed A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{
// set load data option
}
}
return $item;
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @param array $options Optional array of options for the form creation.
*
* @return mixed A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{
// set load data option
$options['load_data'] = $loadData;
// check if xpath was set in options
$xpath = false;
@ -888,29 +882,29 @@ class MembersmanagerModelMember extends JModelAdmin
$form->setFieldAttribute('user', 'type', 'hidden');
}
}
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_membersmanager/models/forms/member.js';
}
/**
* Method to test whether a record can be deleted.
*
* @param object $record A record object.
*
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canDelete($record)
return $form;
}
/**
* Method to get the script that have to be included on the form
*
* @return string script files
*/
public function getScript()
{
return 'media/com_membersmanager/js/member.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))
{
@ -923,19 +917,19 @@ class MembersmanagerModelMember extends JModelAdmin
// The record has been set. Check the record permissions.
return $user->authorise('member.delete', 'com_membersmanager.member.' . (int) $record->id);
}
return false;
}
/**
* Method to test whether a record can have its state edited.
*
* @param object $record A record object.
*
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canEditState($record)
return false;
}
/**
* Method to test whether a record can have its state edited.
*
* @param object $record A record object.
*
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canEditState($record)
{
$user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0;
@ -950,104 +944,104 @@ class MembersmanagerModelMember extends JModelAdmin
}
}
// In the absense of better information, revert to the component permissions.
return $user->authorise('member.edit.state', 'com_membersmanager');
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
* @since 2.5
*/
protected function allowEdit($data = array(), $key = 'id')
return $user->authorise('member.edit.state', 'com_membersmanager');
}
/**
* 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('member.edit', 'com_membersmanager.member.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('member.edit', 'com_membersmanager');
}
/**
* 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('#__membersmanager_member'));
$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_membersmanager.edit.member.data', array());
if (empty($data))
{
$data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_membersmanager.member', $data);
}
return $data;
return $user->authorise('member.edit', 'com_membersmanager.member.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('member.edit', 'com_membersmanager');
}
/**
* 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('#__membersmanager_member'));
$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_membersmanager.edit.member.data', array());
if (empty($data))
{
$data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_membersmanager.member', $data);
}
return $data;
}
/**
@ -1096,18 +1090,18 @@ class MembersmanagerModelMember extends JModelAdmin
protected function getUniqueFields()
{
return false;
}
/**
* Method to delete one or more records.
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*
* @since 12.2
*/
public function delete(&$pks)
}
/**
* 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)
{
// users to remove
$users = array();
@ -1139,10 +1133,10 @@ class MembersmanagerModelMember extends JModelAdmin
$users[$pk] = $user;
}
}
}
if (!parent::delete($pks))
{
return false;
}
if (!parent::delete($pks))
{
return false;
}
// we must also update all linked tables
@ -1188,26 +1182,26 @@ class MembersmanagerModelMember extends JModelAdmin
}
// must still do the relationship clearing (TODO)
}
}
return true;
}
/**
* Method to change the published state of one or more records.
*
* @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state.
*
* @return boolean True on success.
*
* @since 12.2
*/
public function publish(&$pks, $value = 1)
{
if (!parent::publish($pks, $value))
{
return false;
}
return true;
}
/**
* Method to change the published state of one or more records.
*
* @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state.
*
* @return boolean True on success.
*
* @since 12.2
*/
public function publish(&$pks, $value = 1)
{
if (!parent::publish($pks, $value))
{
return false;
}
// we must also update all linked tables
@ -1281,105 +1275,105 @@ class MembersmanagerModelMember extends JModelAdmin
}
}
}
}
return true;
}
/**
* Method to perform batch operations on an item or a set of items.
*
* @param array $commands An array of commands to perform.
* @param array $pks An array of item ids.
* @param array $contexts An array of item contexts.
*
* @return boolean Returns true on success, false on failure.
*
* @since 12.2
*/
public function batch($commands, $pks, $contexts)
{
// Sanitize ids.
$pks = array_unique($pks);
ArrayHelper::toInteger($pks);
// Remove any values of zero.
if (array_search(0, $pks, true))
{
unset($pks[array_search(0, $pks, true)]);
}
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
$done = false;
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = MembersmanagerHelper::getActions('member');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
$this->type = $type->getTypeByAlias($this->typeAlias);
}
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
if (!empty($commands['move_copy']))
{
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c')
{
$result = $this->batchCopy($commands, $pks, $contexts);
if (is_array($result))
{
foreach ($result as $old => $new)
{
$contexts[$new] = $contexts[$old];
}
$pks = array_values($result);
}
else
{
return false;
}
}
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
{
return false;
}
$done = true;
}
if (!$done)
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
// Clear the cache
$this->cleanCache();
return true;
}
return true;
}
/**
* Method to perform batch operations on an item or a set of items.
*
* @param array $commands An array of commands to perform.
* @param array $pks An array of item ids.
* @param array $contexts An array of item contexts.
*
* @return boolean Returns true on success, false on failure.
*
* @since 12.2
*/
public function batch($commands, $pks, $contexts)
{
// Sanitize ids.
$pks = array_unique($pks);
ArrayHelper::toInteger($pks);
// Remove any values of zero.
if (array_search(0, $pks, true))
{
unset($pks[array_search(0, $pks, true)]);
}
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
$done = false;
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = MembersmanagerHelper::getActions('member');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
$this->type = $type->getTypeByAlias($this->typeAlias);
}
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
if (!empty($commands['move_copy']))
{
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c')
{
$result = $this->batchCopy($commands, $pks, $contexts);
if (is_array($result))
{
foreach ($result as $old => $new)
{
$contexts[$new] = $contexts[$old];
}
$pks = array_values($result);
}
else
{
return false;
}
}
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
{
return false;
}
$done = true;
}
if (!$done)
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
// Clear the cache
$this->cleanCache();
return true;
}
/**
@ -1631,30 +1625,30 @@ class MembersmanagerModelMember extends JModelAdmin
$this->cleanCache();
return true;
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
*
* @since 1.6
*/
public function save($data)
{
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
// set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author']))
{
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
*
* @since 1.6
*/
public function save($data)
{
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
// set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author']))
{
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
}
// get user object
@ -1889,14 +1883,14 @@ class MembersmanagerModelMember extends JModelAdmin
if (isset($data['profile_image']) && $mediumkey)
{
$data['profile_image'] = $medium->encryptString($data['profile_image']);
}
// Set the Params Items to data
if (isset($data['params']) && is_array($data['params']))
{
$params = new JRegistry;
$params->loadArray($data['params']);
$data['params'] = (string) $params;
}
// Set the Params Items to data
if (isset($data['params']) && is_array($data['params']))
{
$params = new JRegistry;
$params->loadArray($data['params']);
$data['params'] = (string) $params;
}
// Alter the unique field for save as copy
@ -1911,37 +1905,37 @@ class MembersmanagerModelMember extends JModelAdmin
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
}
}
}
if (parent::save($data))
{
return true;
}
return false;
}
/**
* Method to generate a unique value.
*
* @param string $field name.
* @param string $value data.
*
* @return string New value.
*
* @since 3.0
*/
protected function generateUnique($field,$value)
{
// set field value unique
$table = $this->getTable();
while ($table->load(array($field => $value)))
{
$value = StringHelper::increment($value);
}
return $value;
}
if (parent::save($data))
{
return true;
}
return false;
}
/**
* Method to generate a unique value.
*
* @param string $field name.
* @param string $value data.
*
* @return string New value.
*
* @since 3.0
*/
protected function generateUnique($field,$value)
{
// set field value unique
$table = $this->getTable();
while ($table->load(array($field => $value)))
{
$value = StringHelper::increment($value);
}
return $value;
}
/**
@ -1964,5 +1958,5 @@ class MembersmanagerModelMember extends JModelAdmin
}
return $title;
}
}
}
}

View File

@ -1,41 +1,41 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Members Model
*/
class MembersmanagerModelMembers extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Members Model
*/
class MembersmanagerModelMembers extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.access','access',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
'a.account','account'
);
}
parent::__construct($config);
'a.account','account'
);
}
parent::__construct($config);
}
/**
@ -230,27 +230,27 @@ class MembersmanagerModelMembers extends JModelList
}
return false;
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout'))
{
$this->context .= '.' . $layout;
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout'))
{
$this->context .= '.' . $layout;
}
// Check if the form was submitted
@ -283,23 +283,23 @@ class MembersmanagerModelMembers extends JModelList
{
$account = $app->input->post->get('account');
$this->setState('filter.account', $account);
}
// 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()
}
// List state information.
parent::populateState($ordering, $direction);
}
/**
* Method to get an array of data items.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
// check in items
// Check in items
$this->checkInNow();
// load parent items
// load parent items
$items = parent::getItems();
// Set values to display correctly.
@ -356,10 +356,10 @@ class MembersmanagerModelMembers extends JModelList
$item->account = $this->selectionTranslation($item->account, 'account');
}
}
// return items
return $items;
// return items
return $items;
}
/**
@ -385,15 +385,15 @@ class MembersmanagerModelMembers extends JModelList
}
}
return $value;
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
@ -492,7 +492,7 @@ class MembersmanagerModelMembers extends JModelList
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
return $query;
}
/**
@ -944,16 +944,16 @@ class MembersmanagerModelMembers extends JModelList
}
}
return false;
}
/**
* Method to get a store id based on model configuration state.
*
* @return string A store id.
*
*/
protected function getStoreId($id = '')
{
}
/**
* Method to get a store id based on model configuration state.
*
* @return string A store id.
*
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
@ -973,9 +973,9 @@ class MembersmanagerModelMembers extends JModelList
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.account');
return parent::getStoreId($id);
$id .= ':' . $this->getState('filter.account');
return parent::getStoreId($id);
}
/**
@ -994,17 +994,19 @@ class MembersmanagerModelMembers extends JModelList
// Get a db connection.
$db = JFactory::getDbo();
// reset query
// Reset query.
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__membersmanager_member'));
$db->setQuery($query);
// Only select items that are checked out.
$query->where($db->quoteName('checked_out') . '!=0');
$db->setQuery($query, 0, 1);
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
// Get Yesterdays date.
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
// Reset query.
$query = $db->getQuery(true);
// Fields to update.
@ -1019,7 +1021,7 @@ class MembersmanagerModelMembers extends JModelList
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
// Check table
// Check table.
$query->update($db->quoteName('#__membersmanager_member'))->set($fields)->where($conditions);
$db->setQuery($query);
@ -1029,5 +1031,5 @@ class MembersmanagerModelMembers extends JModelList
}
return false;
}
}
}
}

View File

@ -1,26 +1,26 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
/**
* Form Rule (Memberloginname) class for the Joomla Platform.
*/
class JFormRuleMemberloginname extends FormRule
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
/**
* Form Rule (Memberloginname) class for the Joomla Platform.
*/
class JFormRuleMemberloginname extends FormRule
{
/**
* Method to test the username for uniqueness.
@ -82,5 +82,5 @@ class JFormRuleMemberloginname extends FormRule
}
return true;
}
}
}
}

View File

@ -1,26 +1,26 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
/**
* Form Rule (Memberuseremail) class for the Joomla Platform.
*/
class JFormRuleMemberuseremail extends FormRule
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
/**
* Form Rule (Memberuseremail) class for the Joomla Platform.
*/
class JFormRuleMemberuseremail extends FormRule
{
/**
* The regular expression to use in testing a form field value.
@ -145,5 +145,5 @@ class JFormRuleMemberuseremail extends FormRule
}
return true;
}
}
}
}

View File

@ -1,26 +1,26 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
/**
* Form Rule (Uniquetoken) class for the Joomla Platform.
*/
class JFormRuleUniquetoken extends FormRule
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormRule;
use Joomla\Registry\Registry;
/**
* Form Rule (Uniquetoken) class for the Joomla Platform.
*/
class JFormRuleUniquetoken extends FormRule
{
/**
* Method to test the field value for uniqueness.
@ -83,5 +83,5 @@ class JFormRuleUniquetoken extends FormRule
}
}
return true;
}
}
}
}

View File

@ -1,32 +1,32 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Type Model
*/
class MembersmanagerModelType extends JModelAdmin
{
/**
* The tab layout fields array.
*
* @var array
*/
use Joomla\Utilities\ArrayHelper;
/**
* Membersmanager Type Model
*/
class MembersmanagerModelType extends JModelAdmin
{
/**
* The tab layout fields array.
*
* @var array
*/
protected $tabLayoutFields = array(
'details' => array(
'left' => array(
@ -55,68 +55,68 @@ class MembersmanagerModelType extends JModelAdmin
'field_type'
)
)
);
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_MEMBERSMANAGER';
/**
* The type alias for this content type.
*
* @var string
* @since 3.2
*/
public $typeAlias = 'com_membersmanager.type';
/**
* 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 = 'type', $prefix = 'MembersmanagerTable', $config = array())
{
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_membersmanager/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config);
}
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata))
{
// Convert the metadata field to an array.
$registry = new Registry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
);
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_MEMBERSMANAGER';
/**
* The type alias for this content type.
*
* @var string
* @since 3.2
*/
public $typeAlias = 'com_membersmanager.type';
/**
* 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 = 'type', $prefix = 'MembersmanagerTable', $config = array())
{
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_membersmanager/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config);
}
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata))
{
// Convert the metadata field to an array.
$registry = new Registry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->view_relationship))
@ -153,32 +153,26 @@ class MembersmanagerModelType extends JModelAdmin
{
// JSON Decode groups_access.
$item->groups_access = json_decode($item->groups_access,true);
}
if (!empty($item->id))
{
$item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_membersmanager.type');
}
}
return $item;
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @param array $options Optional array of options for the form creation.
*
* @return mixed A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{
// set load data option
}
}
return $item;
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @param array $options Optional array of options for the form creation.
*
* @return mixed A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{
// set load data option
$options['load_data'] = $loadData;
// check if xpath was set in options
$xpath = false;
@ -449,29 +443,29 @@ class MembersmanagerModelType extends JModelAdmin
$form->setValue($redirectedField, null, $redirectedValue);
}
}
return $form;
}
/**
* Method to get the script that have to be included on the form
*
* @return string script files
*/
public function getScript()
{
return 'administrator/components/com_membersmanager/models/forms/type.js';
}
/**
* Method to test whether a record can be deleted.
*
* @param object $record A record object.
*
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canDelete($record)
return $form;
}
/**
* Method to get the script that have to be included on the form
*
* @return string script files
*/
public function getScript()
{
return 'media/com_membersmanager/js/type.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))
{
@ -484,19 +478,19 @@ class MembersmanagerModelType extends JModelAdmin
// The record has been set. Check the record permissions.
return $user->authorise('type.delete', 'com_membersmanager.type.' . (int) $record->id);
}
return false;
}
/**
* Method to test whether a record can have its state edited.
*
* @param object $record A record object.
*
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canEditState($record)
return false;
}
/**
* Method to test whether a record can have its state edited.
*
* @param object $record A record object.
*
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canEditState($record)
{
$user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0;
@ -511,104 +505,104 @@ class MembersmanagerModelType extends JModelAdmin
}
}
// In the absense of better information, revert to the component permissions.
return $user->authorise('type.edit.state', 'com_membersmanager');
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
* @since 2.5
*/
protected function allowEdit($data = array(), $key = 'id')
return $user->authorise('type.edit.state', 'com_membersmanager');
}
/**
* 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('type.edit', 'com_membersmanager.type.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('type.edit', 'com_membersmanager');
}
/**
* 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('#__membersmanager_type'));
$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_membersmanager.edit.type.data', array());
if (empty($data))
{
$data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_membersmanager.type', $data);
}
return $data;
return $user->authorise('type.edit', 'com_membersmanager.type.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('type.edit', 'com_membersmanager');
}
/**
* 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('#__membersmanager_type'));
$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_membersmanager.edit.type.data', array());
if (empty($data))
{
$data = $this->getItem();
// run the perprocess of the data
$this->preprocessData('com_membersmanager.type', $data);
}
return $data;
}
/**
@ -657,141 +651,141 @@ class MembersmanagerModelType extends JModelAdmin
protected function getUniqueFields()
{
return false;
}
/**
* Method to delete one or more records.
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*
* @since 12.2
*/
public function delete(&$pks)
{
if (!parent::delete($pks))
{
return false;
}
return true;
}
/**
* Method to change the published state of one or more records.
*
* @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state.
*
* @return boolean True on success.
*
* @since 12.2
*/
public function publish(&$pks, $value = 1)
{
if (!parent::publish($pks, $value))
{
return false;
}
return true;
}
/**
* Method to perform batch operations on an item or a set of items.
*
* @param array $commands An array of commands to perform.
* @param array $pks An array of item ids.
* @param array $contexts An array of item contexts.
*
* @return boolean Returns true on success, false on failure.
*
* @since 12.2
*/
public function batch($commands, $pks, $contexts)
{
// Sanitize ids.
$pks = array_unique($pks);
ArrayHelper::toInteger($pks);
// Remove any values of zero.
if (array_search(0, $pks, true))
{
unset($pks[array_search(0, $pks, true)]);
}
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
$done = false;
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = MembersmanagerHelper::getActions('type');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
$this->type = $type->getTypeByAlias($this->typeAlias);
}
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
if (!empty($commands['move_copy']))
{
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c')
{
$result = $this->batchCopy($commands, $pks, $contexts);
if (is_array($result))
{
foreach ($result as $old => $new)
{
$contexts[$new] = $contexts[$old];
}
$pks = array_values($result);
}
else
{
return false;
}
}
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
{
return false;
}
$done = true;
}
if (!$done)
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
// Clear the cache
$this->cleanCache();
return true;
}
/**
* Method to delete one or more records.
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*
* @since 12.2
*/
public function delete(&$pks)
{
if (!parent::delete($pks))
{
return false;
}
return true;
}
/**
* Method to change the published state of one or more records.
*
* @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state.
*
* @return boolean True on success.
*
* @since 12.2
*/
public function publish(&$pks, $value = 1)
{
if (!parent::publish($pks, $value))
{
return false;
}
return true;
}
/**
* Method to perform batch operations on an item or a set of items.
*
* @param array $commands An array of commands to perform.
* @param array $pks An array of item ids.
* @param array $contexts An array of item contexts.
*
* @return boolean Returns true on success, false on failure.
*
* @since 12.2
*/
public function batch($commands, $pks, $contexts)
{
// Sanitize ids.
$pks = array_unique($pks);
ArrayHelper::toInteger($pks);
// Remove any values of zero.
if (array_search(0, $pks, true))
{
unset($pks[array_search(0, $pks, true)]);
}
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
$done = false;
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = MembersmanagerHelper::getActions('type');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
$this->type = $type->getTypeByAlias($this->typeAlias);
}
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
if (!empty($commands['move_copy']))
{
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c')
{
$result = $this->batchCopy($commands, $pks, $contexts);
if (is_array($result))
{
foreach ($result as $old => $new)
{
$contexts[$new] = $contexts[$old];
}
$pks = array_values($result);
}
else
{
return false;
}
}
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
{
return false;
}
$done = true;
}
if (!$done)
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
// Clear the cache
$this->cleanCache();
return true;
}
/**
@ -1038,30 +1032,30 @@ class MembersmanagerModelType extends JModelAdmin
$this->cleanCache();
return true;
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
*
* @since 1.6
*/
public function save($data)
{
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
// set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author']))
{
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
*
* @since 1.6
*/
public function save($data)
{
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
// set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author']))
{
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
}
// Set the view_relationship items to data.
@ -1122,14 +1116,14 @@ class MembersmanagerModelType extends JModelAdmin
if (isset($data['groups_access']))
{
$data['groups_access'] = (string) json_encode($data['groups_access']);
}
// Set the Params Items to data
if (isset($data['params']) && is_array($data['params']))
{
$params = new JRegistry;
$params->loadArray($data['params']);
$data['params'] = (string) $params;
}
// Set the Params Items to data
if (isset($data['params']) && is_array($data['params']))
{
$params = new JRegistry;
$params->loadArray($data['params']);
$data['params'] = (string) $params;
}
// Alter the name for save as copy
@ -1197,37 +1191,37 @@ class MembersmanagerModelType extends JModelAdmin
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
}
}
}
if (parent::save($data))
{
return true;
}
return false;
}
/**
* Method to generate a unique value.
*
* @param string $field name.
* @param string $value data.
*
* @return string New value.
*
* @since 3.0
*/
protected function generateUnique($field,$value)
{
// set field value unique
$table = $this->getTable();
while ($table->load(array($field => $value)))
{
$value = StringHelper::increment($value);
}
return $value;
}
if (parent::save($data))
{
return true;
}
return false;
}
/**
* Method to generate a unique value.
*
* @param string $field name.
* @param string $value data.
*
* @return string New value.
*
* @since 3.0
*/
protected function generateUnique($field,$value)
{
// set field value unique
$table = $this->getTable();
while ($table->load(array($field => $value)))
{
$value = StringHelper::increment($value);
}
return $value;
}
/**
@ -1275,5 +1269,5 @@ class MembersmanagerModelType extends JModelAdmin
}
// We only had an alias
return $alias;
}
}
}
}

View File

@ -1,30 +1,30 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Types Model
*/
class MembersmanagerModelTypes extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Types Model
*/
class MembersmanagerModelTypes extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.access','access',
@ -32,11 +32,11 @@ class MembersmanagerModelTypes extends JModelList
'a.created_by','created_by',
'a.modified_by','modified_by',
'a.add_relationship','add_relationship',
'a.name','name'
);
}
parent::__construct($config);
'a.name','name'
);
}
parent::__construct($config);
}
/**
@ -83,27 +83,27 @@ class MembersmanagerModelTypes extends JModelList
}
return false;
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout'))
{
$this->context .= '.' . $layout;
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout'))
{
$this->context .= '.' . $layout;
}
// Check if the form was submitted
@ -143,23 +143,23 @@ class MembersmanagerModelTypes extends JModelList
{
$name = $app->input->post->get('name');
$this->setState('filter.name', $name);
}
// 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()
}
// List state information.
parent::populateState($ordering, $direction);
}
/**
* Method to get an array of data items.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
// check in items
// Check in items
$this->checkInNow();
// load parent items
// load parent items
$items = parent::getItems();
// Set values to display correctly.
@ -214,10 +214,10 @@ class MembersmanagerModelTypes extends JModelList
$item->add_relationship = $this->selectionTranslation($item->add_relationship, 'add_relationship');
}
}
// return items
return $items;
// return items
return $items;
}
/**
@ -241,15 +241,15 @@ class MembersmanagerModelTypes extends JModelList
}
}
return $value;
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
@ -336,7 +336,7 @@ class MembersmanagerModelTypes extends JModelList
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
return $query;
}
/**
@ -459,16 +459,16 @@ class MembersmanagerModelTypes extends JModelList
return $headers;
}
return false;
}
/**
* Method to get a store id based on model configuration state.
*
* @return string A store id.
*
*/
protected function getStoreId($id = '')
{
}
/**
* Method to get a store id based on model configuration state.
*
* @return string A store id.
*
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
@ -489,9 +489,9 @@ class MembersmanagerModelTypes extends JModelList
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.add_relationship');
$id .= ':' . $this->getState('filter.name');
return parent::getStoreId($id);
$id .= ':' . $this->getState('filter.name');
return parent::getStoreId($id);
}
/**
@ -510,17 +510,19 @@ class MembersmanagerModelTypes extends JModelList
// Get a db connection.
$db = JFactory::getDbo();
// reset query
// Reset query.
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__membersmanager_type'));
$db->setQuery($query);
// Only select items that are checked out.
$query->where($db->quoteName('checked_out') . '!=0');
$db->setQuery($query, 0, 1);
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
// Get Yesterdays date.
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
// Reset query.
$query = $db->getQuery(true);
// Fields to update.
@ -535,7 +537,7 @@ class MembersmanagerModelTypes extends JModelList
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
// Check table
// Check table.
$query->update($db->quoteName('#__membersmanager_type'))->set($fields)->where($conditions);
$db->setQuery($query);
@ -545,5 +547,5 @@ class MembersmanagerModelTypes extends JModelList
}
return false;
}
}
}
}

View File

@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS `#__membersmanager_member` (
`user` INT(11) NOT NULL DEFAULT 0,
`useremail` VARCHAR(255) NOT NULL DEFAULT '',
`username` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NOT NULL,
`params` text NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -52,7 +52,7 @@ CREATE TABLE IF NOT EXISTS `#__membersmanager_type` (
`name` VARCHAR(255) NOT NULL DEFAULT '',
`type` TEXT NOT NULL,
`view_relationship` TEXT NOT NULL,
`params` text NOT NULL,
`params` text NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,

View File

@ -2,4 +2,4 @@ ALTER TABLE `#__membersmanager_member` ADD `password` VARCHAR(255) NOT NULL DEFA
ALTER TABLE `#__membersmanager_member` ADD `password_check` VARCHAR(255) NOT NULL DEFAULT '' AFTER `password`;
ALTER TABLE `#__membersmanager_member` ADD `surname` CHAR(255) NOT NULL DEFAULT '' AFTER `profile_image`;
ALTER TABLE `#__membersmanager_member` ADD `surname` CHAR(255) NOT NULL DEFAULT '' AFTER `profile_image`;

View File

@ -1 +1 @@
ALTER TABLE `#__membersmanager_member` ADD `username` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`;
ALTER TABLE `#__membersmanager_member` ADD `username` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`;

View File

@ -1 +1 @@
ALTER TABLE `#__membersmanager_member` ADD `useremail` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`;
ALTER TABLE `#__membersmanager_member` ADD `useremail` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`;

View File

@ -2,4 +2,4 @@ ALTER TABLE `#__membersmanager_member` ADD `email` VARCHAR(255) NOT NULL DEFAULT
ALTER TABLE `#__membersmanager_member` ADD `main_member` INT(11) NOT NULL DEFAULT 0 AFTER `email`;
ALTER TABLE `#__membersmanager_member` ADD `name` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`;
ALTER TABLE `#__membersmanager_member` ADD `name` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`;

View File

@ -1 +1 @@
ALTER TABLE `#__membersmanager_member` ADD `profile_image` TEXT NOT NULL AFTER `user`;
ALTER TABLE `#__membersmanager_member` ADD `profile_image` TEXT NOT NULL AFTER `user`;

View File

@ -1 +1 @@
ALTER TABLE `#__membersmanager_member` ADD `token` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`;
ALTER TABLE `#__membersmanager_member` ADD `token` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`;

View File

@ -1,3 +1,3 @@
ALTER TABLE `#__membersmanager_type` ADD `groups_access` TEXT NOT NULL AFTER `description`;
ALTER TABLE `#__membersmanager_type` ADD `groups_target` TEXT NOT NULL AFTER `groups_access`;
ALTER TABLE `#__membersmanager_type` ADD `groups_target` TEXT NOT NULL AFTER `groups_access`;

View File

@ -4,4 +4,4 @@ ALTER TABLE `#__membersmanager_member` CONVERT TO CHARACTER SET utf8mb4 COLLATE
ALTER TABLE `#__membersmanager_type` ENGINE = InnoDB;
ALTER TABLE `#__membersmanager_type` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `#__membersmanager_type` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

View File

@ -1 +1 @@
ALTER TABLE `#__membersmanager_member` CHANGE `type` `type` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `#__membersmanager_member` CHANGE `type` `type` VARCHAR(255) NOT NULL DEFAULT '';

View File

@ -1 +1 @@
ALTER TABLE `#__membersmanager_member` CHANGE `type` `type` TEXT NOT NULL;
ALTER TABLE `#__membersmanager_member` CHANGE `type` `type` TEXT NOT NULL;

View File

@ -1,3 +1,3 @@
ALTER TABLE `#__membersmanager_type` ADD `add_relationship` TINYINT(1) NOT NULL DEFAULT 0 AFTER `asset_id`;
ALTER TABLE `#__membersmanager_type` ADD `type` TEXT NOT NULL AFTER `name`;
ALTER TABLE `#__membersmanager_type` ADD `type` TEXT NOT NULL AFTER `name`;

View File

@ -11,4 +11,4 @@ CREATE TABLE IF NOT EXISTS `#__membersmanager_relation_map` (
`relation` INT(11) NOT NULL DEFAULT 0,
`member` INT(11) NOT NULL DEFAULT 0,
`type` INT(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

View File

@ -1,3 +1,3 @@
ALTER TABLE `#__membersmanager_type` ADD `edit_relationship` TEXT NOT NULL AFTER `description`;
ALTER TABLE `#__membersmanager_type` ADD `view_relationship` TEXT NOT NULL AFTER `type`;
ALTER TABLE `#__membersmanager_type` ADD `view_relationship` TEXT NOT NULL AFTER `type`;

View File

@ -1,314 +1,314 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/**
* Members Table class
*/
class MembersmanagerTableMember 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)
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/**
* Members Table class
*/
class MembersmanagerTableMember 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('#__membersmanager_member', 'id', $db);
// Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_membersmanager.member'));
}
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 Member 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 member. A member 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('member', 'MembersmanagerTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_MEMBERSMANAGER_MEMBER_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('member', 'membersmanagerTable');
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->alias = StringHelper::increment($this->alias, 'dash');
}
}
/*
* Clean up keywords -- eliminate extra spaces between phrases
* and cr (\r) and lf (\n) characters from string.
* Only process if not empty.
*/
if (!empty($this->metakey))
{
// Array of characters to remove.
$bad_characters = array("\n", "\r", "\"", "<", ">");
// Remove bad characters.
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
// Create array using commas as delimiter.
$keys = explode(',', $after_clean);
$clean_keys = array();
foreach ($keys as $key)
{
// Ignore blank keywords.
if (trim($key))
{
$clean_keys[] = trim($key);
}
}
// Put array back together delimited by ", "
$this->metakey = implode(", ", $clean_keys);
}
// Clean up description -- eliminate quotes and <> brackets
if (!empty($this->metadesc))
{
// Only process if not empty
$bad_characters = array("\"", "<", ">");
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
}
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_membersmanager.member.'.$this->id);
$this->setRules($rules);
}
// Set ordering
if ($this->published < 0)
{
// Set ordering to 0 if state is archived or trashed
$this->ordering = 0;
}
return true;
}
/**
* Gets the default asset values for a component.
*
* @param $string $component The component asset name to search for
*
* @return JAccessRules The JAccessRules object for the asset
*/
protected function getDefaultAssetValues($component, $try = true)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);
$db->execute();
if ($db->loadRowList())
{
// asset already set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)
{
$try = explode('.',$component);
$result = $this->getDefaultAssetValues($try[0], false);
if ($result instanceof JAccessRules)
{
if (isset($try[1]))
{
$_result = (string) $result;
$_result = json_decode($_result);
foreach ($_result as $name => &$rule)
{
$v = explode('.', $name);
if ($try[1] !== $v[0])
{
// remove since it is not part of this view
unset($_result->$name);
}
else
{
// clear the value since we inherit
$rule = array();
}
}
// check if there are any view values remaining
if (count( (array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);
// Instantiate and return the JAccessRules object for the asset rules.
$rules = new JAccessRules;
$rules->mergeCollection($_result);
return $rules;
}
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
/**
* Method to compute the default name of the asset.
* The default name is in the form 'table_name.id'
* where id is the value of the primary key of the table.
*
* @return string
* @since 2.5
*/
protected function _getAssetName()
{
$k = $this->_tbl_key;
return 'com_membersmanager.member.'.(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_membersmanager');
return $asset->id;
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_membersmanager.member'));
}
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 Member 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 member. A member 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('member', 'MembersmanagerTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_MEMBERSMANAGER_MEMBER_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('member', 'membersmanagerTable');
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->alias = StringHelper::increment($this->alias, 'dash');
}
}
/*
* Clean up keywords -- eliminate extra spaces between phrases
* and cr (\r) and lf (\n) characters from string.
* Only process if not empty.
*/
if (!empty($this->metakey))
{
// Array of characters to remove.
$bad_characters = array("\n", "\r", "\"", "<", ">");
// Remove bad characters.
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
// Create array using commas as delimiter.
$keys = explode(',', $after_clean);
$clean_keys = array();
foreach ($keys as $key)
{
// Ignore blank keywords.
if (trim($key))
{
$clean_keys[] = trim($key);
}
}
// Put array back together delimited by ", "
$this->metakey = implode(", ", $clean_keys);
}
// Clean up description -- eliminate quotes and <> brackets
if (!empty($this->metadesc))
{
// Only process if not empty
$bad_characters = array("\"", "<", ">");
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
}
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_membersmanager.member.'.$this->id);
$this->setRules($rules);
}
// Set ordering
if ($this->published < 0)
{
// Set ordering to 0 if state is archived or trashed
$this->ordering = 0;
}
return true;
}
/**
* Gets the default asset values for a component.
*
* @param $string $component The component asset name to search for
*
* @return JAccessRules The JAccessRules object for the asset
*/
protected function getDefaultAssetValues($component, $try = true)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);
$db->execute();
if ($db->loadRowList())
{
// asset already set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)
{
$try = explode('.',$component);
$result = $this->getDefaultAssetValues($try[0], false);
if ($result instanceof JAccessRules)
{
if (isset($try[1]))
{
$_result = (string) $result;
$_result = json_decode($_result);
foreach ($_result as $name => &$rule)
{
$v = explode('.', $name);
if ($try[1] !== $v[0])
{
// remove since it is not part of this view
unset($_result->$name);
}
else
{
// clear the value since we inherit
$rule = array();
}
}
// check if there are any view values remaining
if (count( (array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);
// Instantiate and return the JAccessRules object for the asset rules.
$rules = new JAccessRules;
$rules->mergeCollection($_result);
return $rules;
}
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
/**
* Method to compute the default name of the asset.
* The default name is in the form 'table_name.id'
* where id is the value of the primary key of the table.
*
* @return string
* @since 2.5
*/
protected function _getAssetName()
{
$k = $this->_tbl_key;
return 'com_membersmanager.member.'.(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_membersmanager');
return $asset->id;
}
/**
@ -319,6 +319,6 @@ class MembersmanagerTableMember extends JTable
public function generateAlias()
{
return false;
}
}
}
}

View File

@ -1,314 +1,314 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/**
* Types Table class
*/
class MembersmanagerTableType 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)
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/**
* Types Table class
*/
class MembersmanagerTableType 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('#__membersmanager_type', 'id', $db);
// Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_membersmanager.type'));
}
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 Type 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 type. A type 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('type', 'MembersmanagerTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_MEMBERSMANAGER_TYPE_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('type', 'membersmanagerTable');
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->alias = StringHelper::increment($this->alias, 'dash');
}
}
/*
* Clean up keywords -- eliminate extra spaces between phrases
* and cr (\r) and lf (\n) characters from string.
* Only process if not empty.
*/
if (!empty($this->metakey))
{
// Array of characters to remove.
$bad_characters = array("\n", "\r", "\"", "<", ">");
// Remove bad characters.
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
// Create array using commas as delimiter.
$keys = explode(',', $after_clean);
$clean_keys = array();
foreach ($keys as $key)
{
// Ignore blank keywords.
if (trim($key))
{
$clean_keys[] = trim($key);
}
}
// Put array back together delimited by ", "
$this->metakey = implode(", ", $clean_keys);
}
// Clean up description -- eliminate quotes and <> brackets
if (!empty($this->metadesc))
{
// Only process if not empty
$bad_characters = array("\"", "<", ">");
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
}
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_membersmanager.type.'.$this->id);
$this->setRules($rules);
}
// Set ordering
if ($this->published < 0)
{
// Set ordering to 0 if state is archived or trashed
$this->ordering = 0;
}
return true;
}
/**
* Gets the default asset values for a component.
*
* @param $string $component The component asset name to search for
*
* @return JAccessRules The JAccessRules object for the asset
*/
protected function getDefaultAssetValues($component, $try = true)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);
$db->execute();
if ($db->loadRowList())
{
// asset already set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)
{
$try = explode('.',$component);
$result = $this->getDefaultAssetValues($try[0], false);
if ($result instanceof JAccessRules)
{
if (isset($try[1]))
{
$_result = (string) $result;
$_result = json_decode($_result);
foreach ($_result as $name => &$rule)
{
$v = explode('.', $name);
if ($try[1] !== $v[0])
{
// remove since it is not part of this view
unset($_result->$name);
}
else
{
// clear the value since we inherit
$rule = array();
}
}
// check if there are any view values remaining
if (count( (array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);
// Instantiate and return the JAccessRules object for the asset rules.
$rules = new JAccessRules;
$rules->mergeCollection($_result);
return $rules;
}
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
/**
* Method to compute the default name of the asset.
* The default name is in the form 'table_name.id'
* where id is the value of the primary key of the table.
*
* @return string
* @since 2.5
*/
protected function _getAssetName()
{
$k = $this->_tbl_key;
return 'com_membersmanager.type.'.(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_membersmanager');
return $asset->id;
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_membersmanager.type'));
}
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 Type 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 type. A type 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('type', 'MembersmanagerTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_MEMBERSMANAGER_TYPE_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('type', 'membersmanagerTable');
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->alias = StringHelper::increment($this->alias, 'dash');
}
}
/*
* Clean up keywords -- eliminate extra spaces between phrases
* and cr (\r) and lf (\n) characters from string.
* Only process if not empty.
*/
if (!empty($this->metakey))
{
// Array of characters to remove.
$bad_characters = array("\n", "\r", "\"", "<", ">");
// Remove bad characters.
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
// Create array using commas as delimiter.
$keys = explode(',', $after_clean);
$clean_keys = array();
foreach ($keys as $key)
{
// Ignore blank keywords.
if (trim($key))
{
$clean_keys[] = trim($key);
}
}
// Put array back together delimited by ", "
$this->metakey = implode(", ", $clean_keys);
}
// Clean up description -- eliminate quotes and <> brackets
if (!empty($this->metadesc))
{
// Only process if not empty
$bad_characters = array("\"", "<", ">");
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
}
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_membersmanager.type.'.$this->id);
$this->setRules($rules);
}
// Set ordering
if ($this->published < 0)
{
// Set ordering to 0 if state is archived or trashed
$this->ordering = 0;
}
return true;
}
/**
* Gets the default asset values for a component.
*
* @param $string $component The component asset name to search for
*
* @return JAccessRules The JAccessRules object for the asset
*/
protected function getDefaultAssetValues($component, $try = true)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);
$db->execute();
if ($db->loadRowList())
{
// asset already set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)
{
$try = explode('.',$component);
$result = $this->getDefaultAssetValues($try[0], false);
if ($result instanceof JAccessRules)
{
if (isset($try[1]))
{
$_result = (string) $result;
$_result = json_decode($_result);
foreach ($_result as $name => &$rule)
{
$v = explode('.', $name);
if ($try[1] !== $v[0])
{
// remove since it is not part of this view
unset($_result->$name);
}
else
{
// clear the value since we inherit
$rule = array();
}
}
// check if there are any view values remaining
if (count( (array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);
// Instantiate and return the JAccessRules object for the asset rules.
$rules = new JAccessRules;
$rules->mergeCollection($_result);
return $rules;
}
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
/**
* Method to compute the default name of the asset.
* The default name is in the form 'table_name.id'
* where id is the value of the primary key of the table.
*
* @return string
* @since 2.5
*/
protected function _getAssetName()
{
$k = $this->_tbl_key;
return 'com_membersmanager.type.'.(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_membersmanager');
return $asset->id;
}
/**
@ -324,7 +324,7 @@ class MembersmanagerTableType extends JTable
$this->alias = $this->name;
}
$this->alias = JApplication::stringURLSafe($this->alias);
$this->alias = JApplicationHelper::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '')
{
@ -332,6 +332,6 @@ class MembersmanagerTableType extends JTable
}
return $this->alias;
}
}
}
}

View File

@ -1,218 +1,218 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('jquery.framework');
JHtml::_('bootstrap.tooltip');
JHtml::_('script', 'system/core.js', false, true);
JHtml::_('behavior.keepalive');
?>
<script type="text/javascript">
<?php if ($this->hasPackage && MembersmanagerHelper::checkArray($this->headerList)) : ?>
Joomla.continueImport = function()
{
var form = document.getElementById('adminForm');
var error = false;
var therequired = [<?php $i = 0; foreach($this->headerList as $name => $title) { echo ($i != 0)? ', "vdm_'.$name.'"':'"vdm_'.$name.'"'; $i++; } ?>];
for(i = 0; i < therequired.length; i++)
{
if(jQuery('#'+therequired[i]).val() == "" )
{
error = true;
break;
}
}
// do field validation
if (error)
{
alert("<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS', true); ?>");
}
else
{
jQuery('#loading').css('display', 'block');
form.gettype.value = 'continue';
form.submit();
}
};
<?php else: ?>
Joomla.submitbutton = function()
{
var form = document.getElementById('adminForm');
// do field validation
if (form.import_package.value == "")
{
alert("<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_MSG_PLEASE_SELECT_A_FILE', true); ?>");
}
else
{
jQuery('#loading').css('display', 'block');
form.gettype.value = 'upload';
form.submit();
}
};
Joomla.submitbutton3 = function()
{
var form = document.getElementById('adminForm');
// do field validation
if (form.import_directory.value == ""){
alert("<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY', true); ?>");
}
else
{
jQuery('#loading').css('display', 'block');
form.gettype.value = 'folder';
form.submit();
}
};
Joomla.submitbutton4 = function()
{
var form = document.getElementById('adminForm');
// do field validation
if (form.import_url.value == "" || form.import_url.value == "http://")
{
alert("<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_MSG_ENTER_A_URL', true); ?>");
}
else
{
jQuery('#loading').css('display', 'block');
form.gettype.value = 'url';
form.submit();
}
};
<?php endif; ?>
// Add spindle-wheel for importations:
jQuery(document).ready(function($) {
var outerDiv = $('body');
$('<div id="loading"></div>')
.css("background", "rgba(255, 255, 255, .8) url('components/com_membersmanager/assets/images/import.gif') 50% 15% no-repeat")
.css("top", outerDiv.position().top - $(window).scrollTop())
.css("left", outerDiv.position().left - $(window).scrollLeft())
.css("width", outerDiv.width())
.css("height", outerDiv.height())
.css("position", "fixed")
.css("opacity", "0.80")
.css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)")
.css("filter", "alpha(opacity = 80)")
.css("display", "none")
.appendTo(outerDiv);
});
</script>
<div id="installer-import" class="clearfix">
<form enctype="multipart/form-data" action="<?php echo JRoute::_('index.php?option=com_membersmanager&view=import');?>" method="post" name="adminForm" id="adminForm" class="form-horizontal form-validate">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<?php if ($this->hasPackage && MembersmanagerHelper::checkArray($this->headerList) && MembersmanagerHelper::checkArray($this->headers)) : ?>
<fieldset class="uploadform">
<legend><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'); ?></legend>
<div class="control-group">
<label class="control-label" ><h4><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_TABLE_COLUMNS'); ?></h4></label>
<div class="controls">
<label class="control-label" ><h4><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_FILE_COLUMNS'); ?></h4></label>
</div>
</div>
<?php foreach($this->headerList as $name => $title): ?>
<div class="control-group">
<label for="<?php echo $name; ?>" class="control-label" ><?php echo $title; ?></label>
<div class="controls">
<select name="<?php echo $name; ?>" id="vdm_<?php echo $name; ?>" required class="required input_box" >
<option value=""><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_PLEASE_SELECT_COLUMN'); ?></option>
<option value="IGNORE"><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_IGNORE_COLUMN'); ?></option>
<?php foreach($this->headers as $value => $option): ?>
<?php $selected = (strtolower($option) == strtolower ($title) || strtolower($option) == strtolower($name))? 'selected="selected"':''; ?>
<option value="<?php echo MembersmanagerHelper::htmlEscape($value); ?>" class="required" <?php echo $selected ?>><?php echo MembersmanagerHelper::htmlEscape($option); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<?php endforeach; ?>
<div class="form-actions">
<input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_CONTINUE'); ?>" onclick="Joomla.continueImport()" />
</div>
</fieldset>
<input type="hidden" name="gettype" value="continue" />
<?php else: ?>
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'upload')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'upload', JText::_('COM_MEMBERSMANAGER_IMPORT_FROM_UPLOAD', true)); ?>
<fieldset class="uploadform">
<legend><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_UPDATE_DATA'); ?></legend>
<div class="control-group">
<label for="import_package" class="control-label"><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_SELECT_FILE'); ?></label>
<div class="controls">
<input class="input_box" id="import_package" name="import_package" type="file" size="57" />
</div>
</div>
<div class="form-actions">
<input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_UPLOAD_BOTTON'); ?>" onclick="Joomla.submitbutton()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
</div>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'directory', JText::_('COM_MEMBERSMANAGER_IMPORT_FROM_DIRECTORY', true)); ?>
<fieldset class="uploadform">
<legend><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_UPDATE_DATA'); ?></legend>
<div class="control-group">
<label for="import_directory" class="control-label"><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_DIRECTORY'); ?></label>
<div class="controls">
<input type="text" id="import_directory" name="import_directory" class="span5 input_box" size="70" value="<?php echo $this->state->get('import.directory'); ?>" />
</div>
</div>
<div class="form-actions">
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton3()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
</div>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'url', JText::_('COM_MEMBERSMANAGER_IMPORT_FROM_URL', true)); ?>
<fieldset class="uploadform">
<legend><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_UPDATE_DATA'); ?></legend>
<div class="control-group">
<label for="import_url" class="control-label"><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_URL'); ?></label>
<div class="controls">
<input type="text" id="import_url" name="import_url" class="span5 input_box" size="70" value="http://" />
</div>
</div>
<div class="form-actions">
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton4()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
</div>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<input type="hidden" name="gettype" value="upload" />
<?php endif; ?>
<input type="hidden" name="task" value="import.import" />
<?php echo JHtml::_('form.token'); ?>
</form>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('jquery.framework');
JHtml::_('bootstrap.tooltip');
JHtml::_('script', 'system/core.js', false, true);
JHtml::_('behavior.keepalive');
?>
<script type="text/javascript">
<?php if ($this->hasPackage && MembersmanagerHelper::checkArray($this->headerList)) : ?>
Joomla.continueImport = function()
{
var form = document.getElementById('adminForm');
var error = false;
var therequired = [<?php $i = 0; foreach($this->headerList as $name => $title) { echo ($i != 0)? ', "vdm_'.$name.'"':'"vdm_'.$name.'"'; $i++; } ?>];
for(i = 0; i < therequired.length; i++)
{
if(jQuery('#'+therequired[i]).val() == "" )
{
error = true;
break;
}
}
// do field validation
if (error)
{
alert("<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS', true); ?>");
}
else
{
jQuery('#loading').css('display', 'block');
form.gettype.value = 'continue';
form.submit();
}
};
<?php else: ?>
Joomla.submitbutton = function()
{
var form = document.getElementById('adminForm');
// do field validation
if (form.import_package.value == "")
{
alert("<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_MSG_PLEASE_SELECT_A_FILE', true); ?>");
}
else
{
jQuery('#loading').css('display', 'block');
form.gettype.value = 'upload';
form.submit();
}
};
Joomla.submitbutton3 = function()
{
var form = document.getElementById('adminForm');
// do field validation
if (form.import_directory.value == ""){
alert("<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY', true); ?>");
}
else
{
jQuery('#loading').css('display', 'block');
form.gettype.value = 'folder';
form.submit();
}
};
Joomla.submitbutton4 = function()
{
var form = document.getElementById('adminForm');
// do field validation
if (form.import_url.value == "" || form.import_url.value == "http://")
{
alert("<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_MSG_ENTER_A_URL', true); ?>");
}
else
{
jQuery('#loading').css('display', 'block');
form.gettype.value = 'url';
form.submit();
}
};
<?php endif; ?>
// Add spindle-wheel for importations:
jQuery(document).ready(function($) {
var outerDiv = $('body');
$('<div id="loading"></div>')
.css("background", "rgba(255, 255, 255, .8) url('components/com_membersmanager/assets/images/import.gif') 50% 15% no-repeat")
.css("top", outerDiv.position().top - $(window).scrollTop())
.css("left", outerDiv.position().left - $(window).scrollLeft())
.css("width", outerDiv.width())
.css("height", outerDiv.height())
.css("position", "fixed")
.css("opacity", "0.80")
.css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)")
.css("filter", "alpha(opacity = 80)")
.css("display", "none")
.appendTo(outerDiv);
});
</script>
<div id="installer-import" class="clearfix">
<form enctype="multipart/form-data" action="<?php echo JRoute::_('index.php?option=com_membersmanager&view=import');?>" method="post" name="adminForm" id="adminForm" class="form-horizontal form-validate">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<?php if ($this->hasPackage && MembersmanagerHelper::checkArray($this->headerList) && MembersmanagerHelper::checkArray($this->headers)) : ?>
<fieldset class="uploadform">
<legend><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'); ?></legend>
<div class="control-group">
<label class="control-label" ><h4><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_TABLE_COLUMNS'); ?></h4></label>
<div class="controls">
<label class="control-label" ><h4><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_FILE_COLUMNS'); ?></h4></label>
</div>
</div>
<?php foreach($this->headerList as $name => $title): ?>
<div class="control-group">
<label for="<?php echo $name; ?>" class="control-label" ><?php echo $title; ?></label>
<div class="controls">
<select name="<?php echo $name; ?>" id="vdm_<?php echo $name; ?>" required class="required input_box" >
<option value=""><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_PLEASE_SELECT_COLUMN'); ?></option>
<option value="IGNORE"><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_IGNORE_COLUMN'); ?></option>
<?php foreach($this->headers as $value => $option): ?>
<?php $selected = (strtolower($option) == strtolower ($title) || strtolower($option) == strtolower($name))? 'selected="selected"':''; ?>
<option value="<?php echo MembersmanagerHelper::htmlEscape($value); ?>" class="required" <?php echo $selected ?>><?php echo MembersmanagerHelper::htmlEscape($option); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<?php endforeach; ?>
<div class="form-actions">
<input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_CONTINUE'); ?>" onclick="Joomla.continueImport()" />
</div>
</fieldset>
<input type="hidden" name="gettype" value="continue" />
<?php else: ?>
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'upload')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'upload', JText::_('COM_MEMBERSMANAGER_IMPORT_FROM_UPLOAD', true)); ?>
<fieldset class="uploadform">
<legend><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_UPDATE_DATA'); ?></legend>
<div class="control-group">
<label for="import_package" class="control-label"><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_SELECT_FILE'); ?></label>
<div class="controls">
<input class="input_box" id="import_package" name="import_package" type="file" size="57" />
</div>
</div>
<div class="form-actions">
<input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_UPLOAD_BOTTON'); ?>" onclick="Joomla.submitbutton()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
</div>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'directory', JText::_('COM_MEMBERSMANAGER_IMPORT_FROM_DIRECTORY', true)); ?>
<fieldset class="uploadform">
<legend><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_UPDATE_DATA'); ?></legend>
<div class="control-group">
<label for="import_directory" class="control-label"><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_DIRECTORY'); ?></label>
<div class="controls">
<input type="text" id="import_directory" name="import_directory" class="span5 input_box" size="70" value="<?php echo $this->state->get('import.directory'); ?>" />
</div>
</div>
<div class="form-actions">
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton3()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
</div>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'url', JText::_('COM_MEMBERSMANAGER_IMPORT_FROM_URL', true)); ?>
<fieldset class="uploadform">
<legend><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_UPDATE_DATA'); ?></legend>
<div class="control-group">
<label for="import_url" class="control-label"><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_URL'); ?></label>
<div class="controls">
<input type="text" id="import_url" name="import_url" class="span5 input_box" size="70" value="http://" />
</div>
</div>
<div class="form-actions">
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_GET_BOTTON'); ?>" onclick="Joomla.submitbutton4()" />&nbsp;&nbsp;&nbsp;<small><?php echo JText::_('COM_MEMBERSMANAGER_IMPORT_FORMATS_ACCEPTED'); ?> (.csv .xls .ods)</small>
</div>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<input type="hidden" name="gettype" value="upload" />
<?php endif; ?>
<input type="hidden" name="task" value="import.import" />
<?php echo JHtml::_('form.token'); ?>
</form>
</div>

View File

@ -1,94 +1,94 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Membersmanager Import View
*/
class MembersmanagerViewImport extends JViewLegacy
{
protected $headerList;
protected $hasPackage = false;
protected $headers;
protected $hasHeader = 0;
protected $dataType;
public function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
MembersmanagerHelper::addSubmenu('import');
}
$paths = new stdClass;
$paths->first = '';
$state = $this->get('state');
$this->paths = &$paths;
$this->state = &$state;
// get global action permissions
$this->canDo = MembersmanagerHelper::getActions('import');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
}
// get the session object
$session = JFactory::getSession();
// check if it has package
$this->hasPackage = $session->get('hasPackage', false);
$this->dataType = $session->get('dataType', false);
if($this->hasPackage && $this->dataType)
{
$this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true);
$this->headers = MembersmanagerHelper::getFileHeaders($this->dataType);
// clear the data type
$session->clear('dataType');
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_MEMBERSMANAGER_IMPORT_TITLE'), 'upload');
JHtmlSidebar::setAction('index.php?option=com_membersmanager&view=import');
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_membersmanager');
}
// set help url for this view if found
$help_url = MembersmanagerHelper::getHelpUrl('import');
if (MembersmanagerHelper::checkString($help_url))
{
JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $help_url);
}
}
}
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Membersmanager Import View
*/
class MembersmanagerViewImport extends JViewLegacy
{
protected $headerList;
protected $hasPackage = false;
protected $headers;
protected $hasHeader = 0;
protected $dataType;
public function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
MembersmanagerHelper::addSubmenu('import');
}
$paths = new stdClass;
$paths->first = '';
$state = $this->get('state');
$this->paths = &$paths;
$this->state = &$state;
// get global action permissions
$this->canDo = MembersmanagerHelper::getActions('import');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
}
// get the session object
$session = JFactory::getSession();
// check if it has package
$this->hasPackage = $session->get('hasPackage', false);
$this->dataType = $session->get('dataType', false);
if($this->hasPackage && $this->dataType)
{
$this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true);
$this->headers = MembersmanagerHelper::getFileHeaders($this->dataType);
// clear the data type
$session->clear('dataType');
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_MEMBERSMANAGER_IMPORT_TITLE'), 'upload');
JHtmlSidebar::setAction('index.php?option=com_membersmanager&view=import');
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_membersmanager');
}
// set help url for this view if found
$this->help_url = MembersmanagerHelper::getHelpUrl('import');
if (MembersmanagerHelper::checkString($this->help_url))
{
JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $this->help_url);
}
}
}

View File

@ -1,26 +1,26 @@
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
Joomla.submitbutton = function(task)
{
if (task == ''){
return false;
} else {
var action = task.split('.');
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
Joomla.submitform(task, document.getElementById("adminForm"));
return true;
} else {
alert(Joomla.JText._('member, some values are not acceptable.','Some values are unacceptable'));
return false;
}
}
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
Joomla.submitbutton = function(task)
{
if (task == ''){
return false;
} else {
var action = task.split('.');
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
Joomla.submitform(task, document.getElementById("adminForm"));
return true;
} else {
alert(Joomla.JText._('member, some values are not acceptable.','Some values are unacceptable'));
return false;
}
}
}

View File

@ -1,25 +1,24 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
$componentParams = $this->params; // will be removed just use $this->params instead
?>
JHtml::_('behavior.keepalive');
$componentParams = $this->params; // will be removed just use $this->params instead
?>
<script type="text/javascript">
// waiting spinner
var outerDiv = jQuery('body');
@ -42,8 +41,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
jQuery('#loading').hide();
});
</script>
<div id="membersmanager_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_membersmanager&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div id="membersmanager_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_membersmanager&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<?php echo JLayoutHelper::render('member.membership_above', $this); ?>
<div class="form-horizontal">
@ -105,8 +104,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<input type="hidden" name="task" value="member.edit" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>
</div>
</form>
</div>
<script type="text/javascript">
@ -447,4 +446,4 @@ function getFile(filename, fileFormat, target, type){
}
}
</script>
</script>

View File

@ -1,84 +1,84 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Member View class
*/
class MembersmanagerViewMember extends JViewLegacy
{
/**
* display method of View
* @return void
*/
public function display($tpl = null)
{
// set params
$this->params = JComponentHelper::getParams('com_membersmanager');
// 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 = MembersmanagerHelper::getActions('member', $this->item);
// get input
$jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Member View class
*/
class MembersmanagerViewMember extends JViewLegacy
{
/**
* display method of View
* @return void
*/
public function display($tpl = null)
{
// set params
$this->params = JComponentHelper::getParams('com_membersmanager');
// 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 = MembersmanagerHelper::getActions('member', $this->item);
// get input
$jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$userId = $user->id;
@ -150,48 +150,48 @@ class MembersmanagerViewMember extends JViewLegacy
}
JToolbarHelper::divider();
// set help url for this view if found
$help_url = MembersmanagerHelper::getHelpUrl('member');
if (MembersmanagerHelper::checkString($help_url))
$this->help_url = MembersmanagerHelper::getHelpUrl('member');
if (MembersmanagerHelper::checkString($this->help_url))
{
JToolbarHelper::help('COM_MEMBERSMANAGER_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 MembersmanagerHelper::htmlEscape($var, $this->_charset, true, 30);
}
// use the helper htmlEscape method instead.
return MembersmanagerHelper::htmlEscape($var, $this->_charset);
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
$isNew = ($this->item->id < 1);
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_($isNew ? 'COM_MEMBERSMANAGER_MEMBER_NEW' : 'COM_MEMBERSMANAGER_MEMBER_EDIT'));
JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
*
* @return mixed The escaped value.
*/
public function escape($var)
{
if(strlen($var) > 30)
{
// use the helper htmlEscape method instead and shorten the string
return MembersmanagerHelper::htmlEscape($var, $this->_charset, true, 30);
}
// use the helper htmlEscape method instead.
return MembersmanagerHelper::htmlEscape($var, $this->_charset);
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
$isNew = ($this->item->id < 1);
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_($isNew ? 'COM_MEMBERSMANAGER_MEMBER_NEW' : 'COM_MEMBERSMANAGER_MEMBER_EDIT'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/member.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
// Add Ajax Token
$this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
$this->document->addScript(JURI::root() . $this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
$this->document->addScript(JURI::root() . $this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root() . "administrator/components/com_membersmanager/views/member/submitbutton.js", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
// get Uikit Version
@ -266,7 +266,7 @@ class MembersmanagerViewMember extends JViewLegacy
$this->document->addScriptDeclaration($update_button);
}
// need to add some language strings
JText::script('COM_MEMBERSMANAGER_VALUE_ALREADY_TAKEN_PLEASE_TRY_AGAIN');
JText::script('view not acceptable. Error');
}
}
JText::script('COM_MEMBERSMANAGER_VALUE_ALREADY_TAKEN_PLEASE_TRY_AGAIN');
JText::script('view not acceptable. Error');
}
}

View File

@ -1,29 +1,28 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_MEMBERSMANAGER_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_membersmanager&task=members.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'memberList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
}
?>
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_membersmanager&task=members.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'memberList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
}
?>
<form action="<?php echo JRoute::_('index.php?option=com_membersmanager&view=members'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
@ -66,4 +65,4 @@ if ($this->saveOrder)
<?php endif; ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
</form>

View File

@ -1,19 +1,19 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<p><?php echo JText::_('COM_MEMBERSMANAGER_MEMBERS_BATCH_TIP'); ?></p>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<p><?php echo JText::_('COM_MEMBERSMANAGER_MEMBERS_BATCH_TIP'); ?></p>
<?php echo $this->batchDisplay; ?>

View File

@ -1,24 +1,24 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<!-- clear the batch values if cancel -->
<button class="btn" type="button" onclick="" data-dismiss="modal">
<?php echo JText::_('JCANCEL'); ?>
</button>
<!-- post the batch values if process -->
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('member.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<!-- clear the batch values if cancel -->
<button class="btn" type="button" onclick="" data-dismiss="modal">
<?php echo JText::_('JCANCEL'); ?>
</button>
<!-- post the batch values if process -->
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('member.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>

View File

@ -1,21 +1,21 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_membersmanager&view=members&task=member.edit";
?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_membersmanager&view=members&task=member.edit";
?>
<?php foreach ($this->items as $i => $item): ?>
<?php
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;

View File

@ -1,19 +1,19 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<tr>
<td colspan="7"><?php echo $this->pagination->getListFooter(); ?></td>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<tr>
<td colspan="7"><?php echo $this->pagination->getListFooter(); ?></td>
</tr>

View File

@ -1,19 +1,19 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<tr>
<?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone">

View File

@ -1,46 +1,46 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<label for="filter_search" class="element-invisible"><?php echo JText::_('Search');?></label>
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('Search Members'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
<?php echo JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
</select>
</div>
</div>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<label for="filter_search" class="element-invisible"><?php echo JText::_('Search');?></label>
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('Search Members'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
<?php echo JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
</select>
</div>
</div>
<div class="clearfix"> </div>

View File

@ -1,39 +1,39 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Membersmanager View class for the Members
*/
class MembersmanagerViewMembers extends JViewLegacy
{
/**
* Members view display method
* @return void
*/
function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
MembersmanagerHelper::addSubmenu('members');
}
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Membersmanager View class for the Members
*/
class MembersmanagerViewMembers extends JViewLegacy
{
/**
* Members view display method
* @return void
*/
function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
MembersmanagerHelper::addSubmenu('members');
}
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
@ -41,104 +41,104 @@ class MembersmanagerViewMembers extends JViewLegacy
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions
$this->canDo = MembersmanagerHelper::getActions('member');
$this->canEdit = $this->canDo->get('member.edit');
$this->canState = $this->canDo->get('member.edit.state');
$this->canCreate = $this->canDo->get('member.create');
$this->canDelete = $this->canDo->get('member.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();
}
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_MEMBERSMANAGER_MEMBERS'), 'joomla');
JHtmlSidebar::setAction('index.php?option=com_membersmanager&view=members');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate)
{
JToolBarHelper::addNew('member.add');
}
// Only load if there are items
if (MembersmanagerHelper::checkArray($this->items))
{
if ($this->canEdit)
{
JToolBarHelper::editList('member.edit');
}
if ($this->canState)
{
JToolBarHelper::publishList('members.publish');
JToolBarHelper::unpublishList('members.unpublish');
JToolBarHelper::archiveList('members.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('members.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('', 'members.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('members.trash');
$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();
}
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_MEMBERSMANAGER_MEMBERS'), 'joomla');
JHtmlSidebar::setAction('index.php?option=com_membersmanager&view=members');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate)
{
JToolBarHelper::addNew('member.add');
}
// Only load if there are items
if (MembersmanagerHelper::checkArray($this->items))
{
if ($this->canEdit)
{
JToolBarHelper::editList('member.edit');
}
if ($this->canState)
{
JToolBarHelper::publishList('members.publish');
JToolBarHelper::unpublishList('members.unpublish');
JToolBarHelper::archiveList('members.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('members.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('', 'members.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('members.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('member.export'))
{
JToolBarHelper::custom('members.exportData', 'download', '', 'COM_MEMBERSMANAGER_EXPORT_DATA', true);
}
}
}
if ($this->user->authorise('member.import_joomla_users', 'com_membersmanager'))
{
@ -149,19 +149,19 @@ class MembersmanagerViewMembers extends JViewLegacy
if ($this->canDo->get('core.import') && $this->canDo->get('member.import'))
{
JToolBarHelper::custom('members.importData', 'upload', '', 'COM_MEMBERSMANAGER_IMPORT_DATA', false);
}
// set help url for this view if found
$help_url = MembersmanagerHelper::getHelpUrl('members');
if (MembersmanagerHelper::checkString($help_url))
{
JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_membersmanager');
}
// set help url for this view if found
$this->help_url = MembersmanagerHelper::getHelpUrl('members');
if (MembersmanagerHelper::checkString($this->help_url))
{
JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_membersmanager');
}
// Only load published batch if state and batch is allowed
@ -202,54 +202,54 @@ class MembersmanagerViewMembers extends JViewLegacy
'batch[account]',
JHtml::_('select.options', $this->accountOptions, 'value', 'text')
);
}
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_('COM_MEMBERSMANAGER_MEMBERS'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/members.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/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 MembersmanagerHelper::htmlEscape($var, $this->_charset, true);
}
// use the helper htmlEscape method instead.
return MembersmanagerHelper::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()
{
}
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_('COM_MEMBERSMANAGER_MEMBERS'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/members.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/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 MembersmanagerHelper::htmlEscape($var, $this->_charset, true);
}
// use the helper htmlEscape method instead.
return MembersmanagerHelper::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.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
'a.account' => JText::_('COM_MEMBERSMANAGER_MEMBER_ACCOUNT_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
}
);
}
}

View File

@ -1,26 +1,26 @@
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
Joomla.submitbutton = function(task)
{
if (task == ''){
return false;
} else {
var action = task.split('.');
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
Joomla.submitform(task, document.getElementById("adminForm"));
return true;
} else {
alert(Joomla.JText._('type, some values are not acceptable.','Some values are unacceptable'));
return false;
}
}
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
Joomla.submitbutton = function(task)
{
if (task == ''){
return false;
} else {
var action = task.split('.');
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
Joomla.submitform(task, document.getElementById("adminForm"));
return true;
} else {
alert(Joomla.JText._('type, some values are not acceptable.','Some values are unacceptable'));
return false;
}
}
}

View File

@ -1,25 +1,24 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
$componentParams = $this->params; // will be removed just use $this->params instead
?>
JHtml::_('behavior.keepalive');
$componentParams = $this->params; // will be removed just use $this->params instead
?>
<script type="text/javascript">
// waiting spinner
var outerDiv = jQuery('body');
@ -42,8 +41,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
jQuery('#loading').hide();
});
</script>
<div id="membersmanager_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_membersmanager&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div id="membersmanager_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_membersmanager&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<?php echo JLayoutHelper::render('type.details_above', $this); ?>
<div class="form-horizontal">
@ -119,8 +118,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<input type="hidden" name="task" value="type.edit" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>
</div>
</form>
</div>
<script type="text/javascript">
@ -140,4 +139,4 @@ jQuery('#adminForm').on('change', '#jform_add_relationship',function (e)
});
</script>
</script>

View File

@ -1,84 +1,84 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Type View class
*/
class MembersmanagerViewType extends JViewLegacy
{
/**
* display method of View
* @return void
*/
public function display($tpl = null)
{
// set params
$this->params = JComponentHelper::getParams('com_membersmanager');
// 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 = MembersmanagerHelper::getActions('type', $this->item);
// get input
$jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Type View class
*/
class MembersmanagerViewType extends JViewLegacy
{
/**
* display method of View
* @return void
*/
public function display($tpl = null)
{
// set params
$this->params = JComponentHelper::getParams('com_membersmanager');
// 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 = MembersmanagerHelper::getActions('type', $this->item);
// get input
$jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$userId = $user->id;
@ -150,46 +150,46 @@ class MembersmanagerViewType extends JViewLegacy
}
JToolbarHelper::divider();
// set help url for this view if found
$help_url = MembersmanagerHelper::getHelpUrl('type');
if (MembersmanagerHelper::checkString($help_url))
$this->help_url = MembersmanagerHelper::getHelpUrl('type');
if (MembersmanagerHelper::checkString($this->help_url))
{
JToolbarHelper::help('COM_MEMBERSMANAGER_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 MembersmanagerHelper::htmlEscape($var, $this->_charset, true, 30);
}
// use the helper htmlEscape method instead.
return MembersmanagerHelper::htmlEscape($var, $this->_charset);
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
$isNew = ($this->item->id < 1);
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_($isNew ? 'COM_MEMBERSMANAGER_TYPE_NEW' : 'COM_MEMBERSMANAGER_TYPE_EDIT'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/type.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addScript(JURI::root() . $this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
*
* @return mixed The escaped value.
*/
public function escape($var)
{
if(strlen($var) > 30)
{
// use the helper htmlEscape method instead and shorten the string
return MembersmanagerHelper::htmlEscape($var, $this->_charset, true, 30);
}
// use the helper htmlEscape method instead.
return MembersmanagerHelper::htmlEscape($var, $this->_charset);
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
$isNew = ($this->item->id < 1);
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_($isNew ? 'COM_MEMBERSMANAGER_TYPE_NEW' : 'COM_MEMBERSMANAGER_TYPE_EDIT'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/type.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addScript(JURI::root() . $this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root() . "administrator/components/com_membersmanager/views/type/submitbutton.js", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
// add the style sheets
@ -207,7 +207,7 @@ class MembersmanagerViewType extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/tooltip.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/lightbox.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/notify.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/upload.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
JText::script('view not acceptable. Error');
}
}
$this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/upload.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
JText::script('view not acceptable. Error');
}
}

View File

@ -1,29 +1,28 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_MEMBERSMANAGER_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_membersmanager&task=types.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
}
?>
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_membersmanager&task=types.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
}
?>
<form action="<?php echo JRoute::_('index.php?option=com_membersmanager&view=types'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
@ -66,4 +65,4 @@ if ($this->saveOrder)
<?php endif; ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
</form>

View File

@ -1,19 +1,19 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<p><?php echo JText::_('COM_MEMBERSMANAGER_TYPES_BATCH_TIP'); ?></p>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<p><?php echo JText::_('COM_MEMBERSMANAGER_TYPES_BATCH_TIP'); ?></p>
<?php echo $this->batchDisplay; ?>

View File

@ -1,24 +1,24 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<!-- clear the batch values if cancel -->
<button class="btn" type="button" onclick="" data-dismiss="modal">
<?php echo JText::_('JCANCEL'); ?>
</button>
<!-- post the batch values if process -->
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('type.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<!-- clear the batch values if cancel -->
<button class="btn" type="button" onclick="" data-dismiss="modal">
<?php echo JText::_('JCANCEL'); ?>
</button>
<!-- post the batch values if process -->
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('type.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>

View File

@ -1,21 +1,21 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_membersmanager&view=types&task=type.edit";
?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_membersmanager&view=types&task=type.edit";
?>
<?php foreach ($this->items as $i => $item): ?>
<?php
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;

View File

@ -1,19 +1,19 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<tr>
<td colspan="9"><?php echo $this->pagination->getListFooter(); ?></td>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<tr>
<td colspan="9"><?php echo $this->pagination->getListFooter(); ?></td>
</tr>

View File

@ -1,19 +1,19 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<tr>
<?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone">

View File

@ -1,46 +1,46 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<label for="filter_search" class="element-invisible"><?php echo JText::_('Search');?></label>
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('Search Types'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
<?php echo JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
</select>
</div>
</div>
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<label for="filter_search" class="element-invisible"><?php echo JText::_('Search');?></label>
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('Search Types'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
<?php echo JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
</select>
</div>
</div>
<div class="clearfix"> </div>

View File

@ -1,39 +1,39 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Membersmanager View class for the Types
*/
class MembersmanagerViewTypes extends JViewLegacy
{
/**
* Types view display method
* @return void
*/
function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
MembersmanagerHelper::addSubmenu('types');
}
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Membersmanager View class for the Types
*/
class MembersmanagerViewTypes extends JViewLegacy
{
/**
* Types view display method
* @return void
*/
function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
MembersmanagerHelper::addSubmenu('types');
}
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
@ -41,104 +41,104 @@ class MembersmanagerViewTypes extends JViewLegacy
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions
$this->canDo = MembersmanagerHelper::getActions('type');
$this->canEdit = $this->canDo->get('type.edit');
$this->canState = $this->canDo->get('type.edit.state');
$this->canCreate = $this->canDo->get('type.create');
$this->canDelete = $this->canDo->get('type.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();
}
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_MEMBERSMANAGER_TYPES'), 'archive');
JHtmlSidebar::setAction('index.php?option=com_membersmanager&view=types');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate)
{
JToolBarHelper::addNew('type.add');
}
// Only load if there are items
if (MembersmanagerHelper::checkArray($this->items))
{
if ($this->canEdit)
{
JToolBarHelper::editList('type.edit');
}
if ($this->canState)
{
JToolBarHelper::publishList('types.publish');
JToolBarHelper::unpublishList('types.unpublish');
JToolBarHelper::archiveList('types.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('types.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('', 'types.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('types.trash');
$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();
}
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_MEMBERSMANAGER_TYPES'), 'archive');
JHtmlSidebar::setAction('index.php?option=com_membersmanager&view=types');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate)
{
JToolBarHelper::addNew('type.add');
}
// Only load if there are items
if (MembersmanagerHelper::checkArray($this->items))
{
if ($this->canEdit)
{
JToolBarHelper::editList('type.edit');
}
if ($this->canState)
{
JToolBarHelper::publishList('types.publish');
JToolBarHelper::unpublishList('types.unpublish');
JToolBarHelper::archiveList('types.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('types.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('', 'types.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('types.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('type.export'))
{
JToolBarHelper::custom('types.exportData', 'download', '', 'COM_MEMBERSMANAGER_EXPORT_DATA', true);
}
}
}
if ($this->user->authorise('type.update_types', 'com_membersmanager'))
{
@ -149,19 +149,19 @@ class MembersmanagerViewTypes extends JViewLegacy
if ($this->canDo->get('core.import') && $this->canDo->get('type.import'))
{
JToolBarHelper::custom('types.importData', 'upload', '', 'COM_MEMBERSMANAGER_IMPORT_DATA', false);
}
// set help url for this view if found
$help_url = MembersmanagerHelper::getHelpUrl('types');
if (MembersmanagerHelper::checkString($help_url))
{
JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_membersmanager');
}
// set help url for this view if found
$this->help_url = MembersmanagerHelper::getHelpUrl('types');
if (MembersmanagerHelper::checkString($this->help_url))
{
JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_membersmanager');
}
// Only load published batch if state and batch is allowed
@ -202,54 +202,54 @@ class MembersmanagerViewTypes extends JViewLegacy
'batch[add_relationship]',
JHtml::_('select.options', $this->add_relationshipOptions, 'value', 'text')
);
}
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_('COM_MEMBERSMANAGER_TYPES'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/types.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/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 MembersmanagerHelper::htmlEscape($var, $this->_charset, true);
}
// use the helper htmlEscape method instead.
return MembersmanagerHelper::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()
{
}
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_('COM_MEMBERSMANAGER_TYPES'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/types.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/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 MembersmanagerHelper::htmlEscape($var, $this->_charset, true);
}
// use the helper htmlEscape method instead.
return MembersmanagerHelper::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.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
'a.name' => JText::_('COM_MEMBERSMANAGER_TYPE_NAME_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
}
);
}
}

View File

@ -1,12 +1,12 @@
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
body {

Some files were not shown because too many files have changed in this diff Show More