Updated with JCB v2.9.14

This commit is contained in:
Llewellyn van der Merwe 2019-04-04 13:58:49 +02:00
parent 20d88a5f30
commit cdef9ab9dd
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
76 changed files with 2337 additions and 764 deletions

View File

@ -13,38 +13,38 @@ 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*: 27th December, 2018
+ *Last Build*: 4th April, 2019
+ *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
**112 Hours** or **14 Eight Hour Days** (actual time the author saved -
**116 Hours** or **15 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*: **40016**
+ *File count*: **232**
+ *Line count*: **41590**
+ *File count*: **237**
+ *Folder count*: **61**
**73 Hours** or **9 Eight Hour Days** (the actual time the author spent)
**76 Hours** or **9 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @28hours** = codingtime / 4;
> **planning @16hours** = codingtime / 7;
> **mapping @11hours** = codingtime / 10;
> **debugging @29hours** = codingtime / 4;
> **planning @17hours** = codingtime / 7;
> **mapping @12hours** = codingtime / 10;
> **office @19hours** = codingtime / 6;)
**185 Hours** or **23 Eight Hour Days**
**192 Hours** or **24 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **4.6 weeks** or **1 months**
Project duration: **4.8 weeks** or **1 months**
> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -13,38 +13,38 @@ 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*: 27th December, 2018
+ *Last Build*: 4th April, 2019
+ *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
**112 Hours** or **14 Eight Hour Days** (actual time the author saved -
**116 Hours** or **15 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*: **40016**
+ *File count*: **232**
+ *Line count*: **41590**
+ *File count*: **237**
+ *Folder count*: **61**
**73 Hours** or **9 Eight Hour Days** (the actual time the author spent)
**76 Hours** or **9 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @28hours** = codingtime / 4;
> **planning @16hours** = codingtime / 7;
> **mapping @11hours** = codingtime / 10;
> **debugging @29hours** = codingtime / 4;
> **planning @17hours** = codingtime / 7;
> **mapping @12hours** = codingtime / 10;
> **office @19hours** = codingtime / 6;)
**185 Hours** or **23 Eight Hour Days**
**192 Hours** or **24 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **4.6 weeks** or **1 months**
Project duration: **4.8 weeks** or **1 months**
> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -17,6 +17,7 @@
<action name="core.edit.created_by" title="COM_MEMBERSMANAGER_EDIT_CREATED_BY" description="COM_MEMBERSMANAGER_EDIT_CREATED_BY_DESC" />
<action name="core.edit.created" title="COM_MEMBERSMANAGER_EDIT_CREATED_DATE" description="COM_MEMBERSMANAGER_EDIT_CREATED_DATE_DESC" />
<action name="site.cpanel.access" title="COM_MEMBERSMANAGER_CPANEL_ACCESS_SITE" description="COM_MEMBERSMANAGER_CPANEL_ACCESS_SITE_DESC" />
<action name="member.import_joomla_users" title="COM_MEMBERSMANAGER_MEMBER_IMPORT_JOOMLA_USERS_BUTTON_ACCESS" description="COM_MEMBERSMANAGER_MEMBER_IMPORT_JOOMLA_USERS_BUTTON_ACCESS_DESC" />
<action name="site.profile.access" title="COM_MEMBERSMANAGER_MEMBER_PROFILE_ACCESS_SITE" description="COM_MEMBERSMANAGER_MEMBER_PROFILE_ACCESS_SITE_DESC" />
<action name="member.access" title="COM_MEMBERSMANAGER_MEMBERS_ACCESS" description="COM_MEMBERSMANAGER_MEMBERS_ACCESS_DESC" />
<action name="member.access.email" title="COM_MEMBERSMANAGER_MEMBERS_ACCESS_EMAIL" description="COM_MEMBERSMANAGER_MEMBERS_ACCESS_EMAIL_DESC" />
@ -64,6 +65,7 @@
<action name="member.view.user" title="COM_MEMBERSMANAGER_MEMBERS_VIEW_USER" description="COM_MEMBERSMANAGER_MEMBERS_VIEW_USER_DESC" />
<action name="member.view.useremail" title="COM_MEMBERSMANAGER_MEMBERS_VIEW_USEREMAIL" description="COM_MEMBERSMANAGER_MEMBERS_VIEW_USEREMAIL_DESC" />
<action name="member.view.username" title="COM_MEMBERSMANAGER_MEMBERS_VIEW_USERNAME" description="COM_MEMBERSMANAGER_MEMBERS_VIEW_USERNAME_DESC" />
<action name="type.update_types" title="COM_MEMBERSMANAGER_TYPE_UPDATE_TYPES_BUTTON_ACCESS" description="COM_MEMBERSMANAGER_TYPE_UPDATE_TYPES_BUTTON_ACCESS_DESC" />
<action name="type.access" title="COM_MEMBERSMANAGER_TYPES_ACCESS" description="COM_MEMBERSMANAGER_TYPES_ACCESS_DESC" />
<action name="type.batch" title="COM_MEMBERSMANAGER_TYPES_BATCH_USE" description="COM_MEMBERSMANAGER_TYPES_BATCH_USE_DESC" />
<action name="type.create" title="COM_MEMBERSMANAGER_TYPES_CREATE" description="COM_MEMBERSMANAGER_TYPES_CREATE_DESC" />

View File

@ -14,3 +14,13 @@
#jform_main_member_chzn {
width: 100% !important;
}
.btn-toolbar .btn-wrapper {
display: inline-block;
margin: 0 0 8px 5px;
}
.form-inline, .form-inline-header {
display: inline-block;
}
.form-inline-header .control-group, .form-inline-header .control-label, .form-inline-header .controls {
display: inline-block;
}

View File

@ -47,6 +47,17 @@
/>
<field type="spacer" name="spacerHistory" hr="true" />
<!-- Default_accesslevel Field. Type: Accesslevel. (joomla) -->
<field
type="accesslevel"
name="default_accesslevel"
label="COM_MEMBERSMANAGER_CONFIG_DEFAULT_ACCESSLEVEL_LABEL"
description="COM_MEMBERSMANAGER_CONFIG_DEFAULT_ACCESSLEVEL_DESCRIPTION"
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" />
<!-- Placeholder_prefix Field. Type: Text. (joomla) -->
<field
type="text"
@ -62,8 +73,8 @@
hint="COM_MEMBERSMANAGER_CONFIG_PLACEHOLDER_PREFIX_HINT"
autocomplete="on"
/>
<!-- Spacer_hr Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr" hr="true" class="spacer_hr" />
<!-- Spacer_hr_two Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_two" hr="true" class="spacer_hr_two" />
<field name="autorTitle"
type="spacer"
label="COM_MEMBERSMANAGER_CONFIG_AUTHOR"
@ -287,6 +298,21 @@
name="profile_custom_config"
label="COM_MEMBERSMANAGER_CONFIG_PROFILE">
<!-- Login_required Field. Type: Radio. (joomla) -->
<field
type="radio"
name="login_required"
label="COM_MEMBERSMANAGER_CONFIG_LOGIN_REQUIRED_LABEL"
description="COM_MEMBERSMANAGER_CONFIG_LOGIN_REQUIRED_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
COM_MEMBERSMANAGER_CONFIG_YES</option>
<option value="2">
COM_MEMBERSMANAGER_CONFIG_NO</option>
</field>
<!-- Button_forms_name Field. Type: Text. (joomla) -->
<field
type="text"

View File

@ -103,4 +103,33 @@ class MembersmanagerControllerMembers extends JControllerAdmin
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=members', false), $message, 'error');
return;
}
public function importJoomlaUsers()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if user has the right
$user = JFactory::getUser();
// set redirect
$redirect_url = JRoute::_('index.php?option=com_membersmanager&view=members', false);
if($user->authorise('core.create', 'com_membersmanager'))
{
// get the model
$model = $this->getModel('members');
if ($model->importJoomlaUsers())
{
// set success message
$message = '<h1>'.JText::_('COM_MEMBERSMANAGER_IMPORT_SUCCESS').'</h1>';
$message .= '<p>'.JText::_('COM_MEMBERSMANAGER_ALL_THE_USERS_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED_INTO_RELATED_MEMBER_TYPE_RELATIONSHIPS').'</p>';
$this->setRedirect($redirect_url, $message);
return true;
}
}
else
{
JFactory::getApplication()->enqueueMessage(JText::_('COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_CREATE_MEMBERS'), 'error');
}
$this->setRedirect($redirect_url);
return false;
}
}

View File

@ -103,4 +103,34 @@ class MembersmanagerControllerTypes extends JControllerAdmin
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=types', false), $message, 'error');
return;
}
public function updateTypes()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if user has the right
$user = JFactory::getUser();
// set redirect
$redirect_url = JRoute::_('index.php?option=com_membersmanager&view=types', false);
if($user->authorise('core.create', 'com_membersmanager'))
{
// get the model
$model = $this->getModel('types');
if ($model->updateTypes())
{
// set success message
$message = '<h1>'.JText::_('COM_MEMBERSMANAGER_UPDATE_SUCCESS').'</h1>';
$message .= '<p>'.JText::_('COM_MEMBERSMANAGER_ALL_THE_MEMBERS_FOUND_WERE_SUCCESSFULLY_MAPPED_WITH_THE_TYPES_SELECTED').'</p>';
$this->setRedirect($redirect_url, $message);
return true;
}
}
else
{
JFactory::getApplication()->enqueueMessage(JText::_('COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_MEMBERS_TYPES'), 'error');
}
$this->setRedirect($redirect_url);
return false;
}
}

View File

@ -27,6 +27,7 @@ abstract class MembersmanagerHelper
self::loadSession();
}
/**
* the params
**/
@ -161,7 +162,7 @@ abstract class MembersmanagerHelper
// set edit link
$selection['setMemberEditURL:id|created_by'] = $f . 'edit_url' . $b;
// Get the medium encryption.
$mediumkey = MembersmanagerHelper::getCryptKey('medium');
$mediumkey = self::getCryptKey('medium');
if ($mediumkey)
{
// Get the encryption object.
@ -221,7 +222,17 @@ abstract class MembersmanagerHelper
**/
protected static function setProfileLink($object)
{
return JRoute::_('index.php?option=com_membersmanager&view=profile&id='. $object->get('id') . ':' . $object->get('token') . '&return=' . self::$return_here);
// get the global settings
if (!self::checkObject(self::$params))
{
self::$params = JComponentHelper::getParams('com_membersmanager');
}
// only load link if open to public or is logged in
if (2 == self::$params->get('login_required', 1) || JFactory::getUser()->id > 0)
{
return JRoute::_('index.php?option=com_membersmanager&view=profile&id='. $object->get('id') . ':' . $object->get('token') . '&return=' . self::$return_here);
}
return '';
}
/**
@ -290,9 +301,24 @@ abstract class MembersmanagerHelper
$_return = urlencode(base64_encode((string) JUri::getInstance()));
if ($return)
{
return self::getCreateURL('message', 'message', $return . '&return=' . $_return, 'com_communicate');
return self::getCreateURL('compose', 'compose', $return . '&return=' . $_return, 'com_communicate');
}
return self::getCreateURL('message', 'message', '&return=' . $_return, 'com_communicate');
return self::getCreateURL('compose', 'compose', '&return=' . $_return, 'com_communicate');
}
elseif ($key && 'message_number' === $key && is_numeric($return) && $return > 0)
{
// get the messages numbers
if (($messages = self::getMessages($return)) !== false)
{
// return result
return count( (array) $messages);
}
return 0;
}
elseif ($key && 'list_messages' === $key && is_numeric($default) && $default > 0)
{
// return result
return self::getListMessages($default, $return);
}
// get the global settings of com_communicate (singleton)
$params = JComponentHelper::getParams('com_communicate');
@ -306,6 +332,103 @@ abstract class MembersmanagerHelper
return $default;
}
/**
* return a list of messages
**/
protected static function getListMessages(&$id, &$return)
{
// get the messages
if (($messages = self::getMessages($id)) !== false)
{
// set the return value
$_return = '';
if (self::checkString($return))
{
$_return = '&return=' . $return;
}
// now build the html
$bucket = array('received' => array(), 'send' => array());
foreach($messages as $message)
{
// get time stamp
$timestamp = strtotime($message->created);
$date = self::fancyDynamicDate($timestamp);
// get key
$key = '&key=' . self::lock($message->id); // to insure that the access is only given by the sytem
// build link
$link = JRoute::_('index.php?option=com_communicate&view=message&id=' . $message->id . $_return . $key);
// set read status
$b = '<a href="' . $link . '">';
$_b = '</a>';
if ($message->hits == 0)
{
$b = '<a href="' . $link . '">&bigstar;&nbsp;';
}
// build the bucket of messages
if ($id == $message->recipient)
{
$bucket['received'][] = $b . $message->subject . '<br />&nbsp;&nbsp;<small>&rarr;&nbsp;' . $date . '</small>' . $_b;
}
else
{
if (($name = self::getMemberName($message->recipient, null, null, null, false)) === false)
{
$name = $message->email;
}
$bucket['send'][] = $b . $name . '<br />&nbsp;&nbsp;' . $message->subject . '<br />&nbsp;&nbsp;<small>&larr;&nbsp;' . $date . '</small>' . $_b;
}
}
// now build the actual list
$html = array();
foreach ($bucket as $_name => $_messages)
{
if (self::checkArray($_messages))
{
$html[] = '<li class="uk-nav-header">' . $_name . '</li>';
$html[] = '<li>' . implode('</li><li>', $_messages) . '</li>';
}
}
// make sure we have messages
if (self::checkArray($html))
{
return implode("", $html);
}
}
return false;
}
/**
* get messages
**/
public static function getMessages(&$id)
{
// Get the user object.
$user = JFactory::getUser();
// get database object
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select(array('a.id', 'a.member','a.recipient','a.created','a.subject','a.kind','a.email','a.hits'));
$query->from('#__communicate_message AS a');
$query->where('(a.recipient = ' . (int) $id . ' OR a.member = ' . (int) $id . ')');
$query->where('a.published = 1');
// Implement View Level Access
if (!$user->authorise('core.options', 'com_communicate'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
$query->order('a.created desc');
$db->setQuery($query);
$db->execute();
// check if we have found any
if ($db->getNumRows())
{
// get all messages
return $db->loadObjectList();
}
return false;
}
/**
* remove all groups that are part of target groups in the member types
**/
@ -342,7 +465,7 @@ abstract class MembersmanagerHelper
public static function getAnyPlaceHolders($_component, $type = 'report', $addCompany = false)
{
// check if we are in the correct class
if ('com_membersmanager' !== $_component)
if ('com_membersmanager' !== $_component && 'com_corecomponent' !== $_component)
{
// check if the class and method exist
if (($helperClass = self::getHelperClass($_component)) !== false && method_exists($helperClass, 'getPlaceHolders'))
@ -681,9 +804,57 @@ abstract class MembersmanagerHelper
// check if access is needed
if (!$user->authorise('core.options', 'com_membersmanager'))
{
if (($userID = $user->get('id', false)) !== false && $userID > 0 && ($types = self::getVar('member', $userID, 'user', 'type')) !== false)
// get all types in system
$query = $db->getQuery(true);
$query->select(array('a.groups_access', 'a.groups_target'));
$query->from('#__membersmanager_type AS a');
$query->where($db->quoteName('a.published') . ' >= 1');
// also filter by access (will keep an eye on this)
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
$db->setQuery($query);
$db->execute();
// get all types
$types = $db->loadAssocList();
// make sure we have types, and user access groups
if (self::checkArray($types) && ($userID = $user->get('id', false)) !== false && $userID > 0 && ($member_type = self::getVar('member', $userID, 'user', 'type')) !== false)
{
return self::getMemberGroupsByType($types, 'groups_access');
// get the groups this member belong to
$member_access = self::getMemberGroupsByType($member_type);
// function to setup the group array
$setGroups = function ($groups) {
// convert to array
if (self::checkJson($groups))
{
return (array) json_decode($groups, true);
}
elseif (is_numeric($groups))
{
return array($groups);
}
return false;
};
// our little function to check if two arrays intersect on values
$intersect = function ($a, $b) { $b = array_flip($b); foreach ($a as $v) { if (isset($b[$v])) return true; } return false; };
// type bucket
$bucketTypes = array();
foreach ($types as $groups)
{
$groups_access = $setGroups($groups['groups_access']);
if (self::checkArray($groups_target) && $intersect($groups_access, $member_access))
{
$groups_target = $setGroups($groups['groups_target']);
foreach ($groups_target as $group_target)
{
$bucketTypes[$group_target] = $group_target;
}
}
}
// check if we found any
if (self::checkArray($bucketTypes))
{
return $bucketTypes;
}
}
return false;
}
@ -712,7 +883,7 @@ abstract class MembersmanagerHelper
{
// get all types in system
$query = $db->getQuery(true);
$query->select(array('a.id', 'a.groups_target')); // groups_target = type_link
$query->select(array('a.id', 'a.groups_access'));
$query->from('#__membersmanager_type AS a');
$query->where($db->quoteName('a.published') . ' >= 1');
// also filter by access (will keep an eye on this)
@ -721,10 +892,12 @@ abstract class MembersmanagerHelper
$db->setQuery($query);
$db->execute();
// get all types
$types = $db->loadAssocList('id', 'groups_target');
$types = $db->loadAssocList('id', 'groups_access');
// make sure we have types, and user access groups
if (self::checkArray($types) && ($groups_access = self::getAccessGroups($user, $db)) !== false)
if (self::checkArray($types) && ($userID = $user->get('id', false)) !== false && $userID > 0 && ($member_type = self::getVar('member', $userID, 'user', 'type')) !== false)
{
// get the access groups
$groups_access = self::getMemberGroupsByType($member_type);
// function to setup the group array
$setGroups = function ($groups) {
// convert to array
@ -835,6 +1008,32 @@ abstract class MembersmanagerHelper
return date('jS \o\f F Y',$date);
}
/**
* get date based in period past
*/
public static function fancyDynamicDate($date)
{
if (!self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
// older then year
$lastyear = date("Y", strtotime("-1 year"));
$tragetyear = date("Y", $date);
if ($tragetyear <= $lastyear)
{
return date('m/d/y', $date);
}
// same day
$yesterday = strtotime("-1 day");
if ($date > $yesterday)
{
return date('g:i A', $date);
}
// just month day
return date('M j', $date);
}
/**
* Change to nice fancy day time and date
*/
@ -1992,6 +2191,10 @@ abstract class MembersmanagerHelper
{
$checked_out = (int) $item->checked_out;
}
else
{
$checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (self::checkArray($item) && isset($item['id']))
{
@ -2000,6 +2203,14 @@ abstract class MembersmanagerHelper
{
$checked_out = (int) $item['checked_out'];
}
else
{
$checked_out = self::getVar($view, $item['id'], 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
// set the link title
$title = self::safeString(JText::_('COM_MEMBERSMANAGER_EDIT') . ' ' . $view, 'W');
@ -2051,6 +2262,118 @@ abstract class MembersmanagerHelper
return '';
}
/**
* Get an edit text button
*
* @param string $text The button text
* @param int $item The item to edit
* @param string $view The type of item to edit
* @param string $views The list view controller name
* @param string $ref The return path
* @param string $component The component these views belong to
* @param string $headsup The message to show on click of button
*
* @return string On success the full html link
*
*/
public static function getEditTextButton($text, &$item, $view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true, $class = 'uk-button', $headsup = 'COM_MEMBERSMANAGER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE')
{
// make sure we have text
if (!self::checkString($text))
{
return self::getEditButton($item, $view, $views, $ref, $component, $headsup);
}
// get URL
$url = self::getEditURL($item, $view, $views, $ref, $component, $jRoute);
// check if we found any
if (self::checkString($url))
{
// get the global settings
if (!self::checkObject(self::$params))
{
self::$params = JComponentHelper::getParams('com_membersmanager');
}
// get UIKIT version
$uikit = self::$params->get('uikit_version', 2);
// check that we have the ID
if (self::checkObject($item) && isset($item->id))
{
// check if the checked_out is available
if (isset($item->checked_out))
{
$checked_out = (int) $item->checked_out;
}
else
{
$checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (self::checkArray($item) && isset($item['id']))
{
// check if the checked_out is available
if (isset($item['checked_out']))
{
$checked_out = (int) $item['checked_out'];
}
else
{
$checked_out = self::getVar($view, $item['id'], 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
// set the link title
$title = self::safeString(JText::_('COM_MEMBERSMANAGER_EDIT') . ' ' . $view, 'W');
// check that there is a check message
if (self::checkString($headsup))
{
if (3 == $uikit)
{
$href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"';
}
else
{
$href = 'onclick="UIkit2.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"';
}
}
else
{
$href = 'href="' . $url . '"';
}
// return UIKIT version 3
if (3 == $uikit)
{
// check if it is checked out
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == JFactory::getUser()->id)
{
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return ' <a class="' . $class . '" href="#" disabled title="' . JText::sprintf('COM_MEMBERSMANAGER__HAS_BEEN_CHECKED_OUT_BY_S', self::safeString($view, 'W'), JFactory::getUser($checked_out)->name) . '">' . $text . '</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
// check if it is checked out (return UIKIT version 2)
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == JFactory::getUser()->id)
{
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return ' <a class="' . $class . '" href="#" disabled title="' . JText::sprintf('COM_MEMBERSMANAGER__HAS_BEEN_CHECKED_OUT_BY_S', self::safeString($view, 'W'), JFactory::getUser($checked_out)->name) . '">' . $text . '</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return '';
}
/**
* Get the edit URL
*
@ -2064,8 +2387,13 @@ abstract class MembersmanagerHelper
* @return string On success the edit url
*
*/
public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true)
public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true)
{
// make sure the user has access to view
if (!JFactory::getUser()->authorise($view. '.access', $component))
{
return false;
}
// build record
$record = new stdClass();
// check that we have the ID
@ -2182,7 +2510,7 @@ abstract class MembersmanagerHelper
public static function getCreateURL($view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true)
{
// can create
if (JFactory::getUser()->authorise($view . '.create', $component))
if (JFactory::getUser()->authorise($view. '.access', $component) && JFactory::getUser()->authorise($view . '.create', $component))
{
// set create task
$create = "&task=" . $view . ".edit";
@ -2348,9 +2676,36 @@ abstract class MembersmanagerHelper
// add and update the header footer and header if setDynamicData is found on placeholder request
if (method_exists(__CLASS__, 'setDynamicData') && 'placeholder' == $method)
{
// get the placeholder prefix
$prefix = self::$params->get('placeholder_prefix', 'member');
// member array keeper
$member_keeper = array('[IF ' . $prefix . '_' => '|!f r3c1p13nt_', '[' . $prefix . '_' => '|r3c1p13nt_');
// get the global templates
$doc_header = self::$params->get('doc_header', '');
if (self::checkString($doc_header))
{
// preserve any possible member placeholders
$doc_header = str_replace(array_keys($member_keeper), array_values($member_keeper), $doc_header);
// update document header with company details
$doc_header = self::setDynamicData($doc_header, self::$companyDetails[$method]);
// reverse the preservation of member placeholders
$doc_header = str_replace(array_values($member_keeper), array_keys($member_keeper), $doc_header);
}
// get the global templates
$doc_footer = self::$params->get('doc_footer', '');
if (self::checkString($doc_footer))
{
// preserve any possible member placeholders
$doc_footer = str_replace(array_keys($member_keeper), array_values($member_keeper), $doc_footer);
// update document footer with company details
$doc_footer = self::setDynamicData($doc_footer, self::$companyDetails[$method]);
// reverse the preservation of member placeholders
$doc_footer = str_replace(array_values($member_keeper), array_keys($member_keeper), $doc_footer);
}
// add document header and footer
self::$companyDetails[$method][$f.'company_doc_header'.$b] = self::setDynamicData(self::$params->get('doc_header', ''), self::$companyDetails[$method]);
self::$companyDetails[$method][$f.'company_doc_footer'.$b] = self::setDynamicData(self::$params->get('doc_footer', ''), self::$companyDetails[$method]);
self::$companyDetails[$method][$f.'company_doc_header'.$b] = $doc_header;
self::$companyDetails[$method][$f.'company_doc_footer'.$b] = $doc_footer;
}
// if object is called for
if ('object' == $method)
@ -2872,11 +3227,11 @@ abstract class MembersmanagerHelper
self::joinMemberDetails($query, $filter, $db);
}
// Implement View Level Access (if set in table)
if (!$user->authorise('core.options', '[[[com_component]]]') && isset($columns['access']))
if (!$user->authorise('core.options', 'com_membersmanager') && isset($columns['access']))
{
// ensure to always filter by access
$accessGroups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $accessGroups . ')');
// $accessGroups = implode(',', $user->getAuthorisedViewLevels()); TODO first fix save to correct access groups
// $query->where('a.access IN (' . $accessGroups . ')');
}
// check if we have more get where details
if (method_exists(__CLASS__, "whereMemberDetails"))
@ -3827,6 +4182,8 @@ abstract class MembersmanagerHelper
*/
protected static function setInfoComponents()
{
// filter per user access
$user = JFactory::getUser();
$db = JFactory::getDBO();
// get components
$query = $db->getQuery(true);
@ -3843,8 +4200,9 @@ abstract class MembersmanagerHelper
// filter out the components we need
$listComponents = array_filter(
$listComponents,
function ($component) {
if (self::checkJson($component->params) && strpos($component->params, 'activate_membersmanager_info') !== false)
function ($component) use($user) {
if (self::checkJson($component->params) && strpos($component->params, 'activate_membersmanager_info') !== false
&& $user->authorise('form.access', $component->element))
{
// check if this component is active
$component->params = json_decode($component->params);
@ -4078,6 +4436,8 @@ abstract class MembersmanagerHelper
*/
protected static function setAssessmentComponents()
{
// filter per user access
$user = JFactory::getUser();
$db = JFactory::getDBO();
// get components
$query = $db->getQuery(true);
@ -4094,8 +4454,9 @@ abstract class MembersmanagerHelper
// filter out the components we need
$listComponents = array_filter(
$listComponents,
function ($component) {
if (self::checkJson($component->params) && strpos($component->params, 'activate_membersmanager_assessment') !== false)
function ($component) use($user) {
if (self::checkJson($component->params) && strpos($component->params, 'activate_membersmanager_assessment') !== false
&& $user->authorise('form.access', $component->element))
{
// check if this component is active
$component->params = json_decode($component->params);
@ -4167,6 +4528,8 @@ abstract class MembersmanagerHelper
return false;
}
);
// get user object
$user = JFactory::getUser();
// get the database object
$db = JFactory::getDBO();
// set the tabs
@ -4190,14 +4553,18 @@ abstract class MembersmanagerHelper
$tables = array();
foreach ($component as $_nr => $comp)
{
if (($ids = self::getVars('form', $item->id, $view, 'id', 'IN', str_replace('com_', '', $comp->element))) !== false && self::checkArray($ids))
// first check access
if ($user->authorise('form.edit', $comp->element))
{
// load the table
$tables[] = self::getTabLinksTable($ids, $item, $comp, $view, $return, $db);
}
elseif (($tmp = self::getTabLinksTable(null, $item, $comp, $view, $return, $db)) !== false)
{
$tables[] = $tmp;
if (($ids = self::getVars('form', $item->id, $view, 'id', 'IN', str_replace('com_', '', $comp->element))) !== false && self::checkArray($ids))
{
// load the table
$tables[] = self::getTabLinksTable($ids, $item, $comp, $view, $return, $db);
}
elseif (($tmp = self::getTabLinksTable(null, $item, $comp, $view, $return, $db)) !== false)
{
$tables[] = $tmp;
}
}
}
// load the tables to the layout
@ -4225,7 +4592,7 @@ abstract class MembersmanagerHelper
$layout = array();
}
}
elseif (self::checkObject($component) && isset($component->element))
elseif (self::checkObject($component) && isset($component->element) && $user->authorise('form.edit', $component->element))
{
if (($id = self::getVar('form', $item->id, $view, 'id', '=', str_replace('com_', '', $component->element))) === false) // get item ID
{
@ -4398,6 +4765,7 @@ abstract class MembersmanagerHelper
* @param int $id The item id
* @param object $component The target component details
* @param array $document The document array to load script
* @param array $footer The document footer array to load scripts
*
* @return string
*
@ -4439,6 +4807,7 @@ abstract class MembersmanagerHelper
*
* @param object $component The target component
* @param array $document The document array to load script
* @param array $footer The document footer array to load scripts
*
* @return string
*
@ -4688,9 +5057,24 @@ abstract class MembersmanagerHelper
return false;
}
);
// set type if not set
if (!isset($data['type']) && $view == 'member')
{
$data['type'] = self::getVar($view, $data['id'], 'id', 'type');
}
// set account if not set
if (!isset($data['account']) && $view == 'member')
{
$data['account'] = self::getVar($view, $data['id'], 'id', 'account');
}
// check if we have methods
if (self::checkArray($methods) && isset($data['type'], $data['account']))
{
// get the global settings
if (!self::checkObject(self::$params))
{
self::$params = JComponentHelper::getParams('com_membersmanager');
}
// get the app object
$app = JFactory::getApplication();
// get the post object
@ -4699,7 +5083,7 @@ abstract class MembersmanagerHelper
$user = JFactory::getUser();
// get the database object
$db = JFactory::getDBO();
// start looping the metods
// start looping the methods
foreach ($methods as $method)
{
// get components
@ -4722,10 +5106,15 @@ abstract class MembersmanagerHelper
// check if user are allowed to edit form values or create form values
if (self::checkArray($_data))
{
// get the local params
$params = JComponentHelper::getParams($_component);
// make sure the ID is set
if (!isset($_data['id']) || !is_numeric($_data['id']))
if (!isset($_data['id']) || !is_numeric($_data['id']) || $_data['id'] == 0)
{
// set id to zero as this will cause new item to be created
$_data['id'] = 0;
// set default access
$_data['access'] = $params->get('default_accesslevel', self::$params->get('default_accesslevel', 1));
}
// check if user may edit
if ($_data['id'] > 0 && !$user->authorise('form.edit', $_component . '.form.' . (int) $_data['id']))
@ -4794,7 +5183,7 @@ abstract class MembersmanagerHelper
continue;
}
// remove all fields not part of the allowed edit fields
if (($fields = JComponentHelper::getParams($_component)->get('edit_fields', false)) !== false && self::checkObject($fields))
if (($fields = $params->get('edit_fields', false)) !== false && self::checkObject($fields))
{
// build a fields array bucket
$fieldActive = array();
@ -4810,6 +5199,7 @@ abstract class MembersmanagerHelper
$fieldActive['created_by'] = 'created_by';
$fieldActive['modified'] = 'modified';
$fieldActive['modified_by'] = 'modified_by';
$fieldActive['access'] = 'access';
$fieldActive['version'] = 'version';
$fieldActive['rules'] = 'rules';
// get the database columns of this table
@ -5108,6 +5498,95 @@ abstract class MembersmanagerHelper
return $none;
}
/**
* bc math wrapper (very basic not for accounting)
*
* @param string $type The type bc math
* @param int $val1 The first value
* @param int $val2 The second value
* @param int $scale The scale value
*
* @return int
*
*/
public static function bcmath($type, $val1, $val2, $scale = 0)
{
// build function name
$function = 'bc' . $type;
// use the bcmath function if available
if (function_exists($function))
{
return $function($val1, $val2, $scale);
}
// if function does not exist we use +-*/ operators (fallback - not ideal)
switch ($type)
{
// Multiply two numbers
case 'mul':
return (string) round($val1 * $val2, $scale);
break;
// Divide of two numbers
case 'div':
return (string) round($val1 / $val2, $scale);
break;
// Adding two numbers
case 'add':
return (string) round($val1 + $val2, $scale);
break;
// Subtract one number from the other
case 'sub':
return (string) round($val1 - $val2, $scale);
break;
// Raise an arbitrary precision number to another
case 'pow':
return (string) round(pow($val1, $val2), $scale);
break;
// Compare two arbitrary precision numbers
case 'comp':
return (round($val1,2) == round($val2,2));
break;
}
return false;
}
/**
* Basic sum of an array with more precision
*
* @param array $array The values to sum
* @param int $scale The scale value
*
* @return float
*
*/
public static function bcsum($array, $scale = 4)
{
// use the bcadd function if available
if (function_exists('bcadd'))
{
// set the start value
$value = 0.0;
// loop the values and run bcadd
foreach($array as $val)
{
$value = bcadd($value, $val, $scale);
}
return $value;
}
// fall back on array sum
return array_sum($array);
}
/**
* get Core Name
*
* @return string the core component name
*
*/
public static function getCoreName()
{
return 'membersmanager';
}
/**
* Load the Component xml manifest.
**/

View File

@ -2,6 +2,8 @@ COM_MEMBERSMANAGER="Members Manager"
COM_MEMBERSMANAGER_ADD="Add"
COM_MEMBERSMANAGER_ADD_ONE_OF_THESE_PLACEHOLDERS_IN_TEXT_FOR_CUSTOM_DOWNLOAD_PLACEMENT="Add one of these placeholders in text for custom download placement"
COM_MEMBERSMANAGER_ALLOWED_IMAGE_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR="Allowed image formats are not set in the global settings, please notify your system administrator."
COM_MEMBERSMANAGER_ALL_THE_MEMBERS_FOUND_WERE_SUCCESSFULLY_MAPPED_WITH_THE_TYPES_SELECTED="All the members found were successfully mapped with the types selected."
COM_MEMBERSMANAGER_ALL_THE_USERS_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED_INTO_RELATED_MEMBER_TYPE_RELATIONSHIPS="All the users found in Joomla were successfully imported into related member type relationships."
COM_MEMBERSMANAGER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?"
COM_MEMBERSMANAGER_ARCHIVED="Archived"
COM_MEMBERSMANAGER_AUTHOR="Author"
@ -53,6 +55,8 @@ COM_MEMBERSMANAGER_CONFIG_COUNTRY_LABEL="Country"
COM_MEMBERSMANAGER_CONFIG_COUNTRY_MESSAGE="Error! Please add country name here."
COM_MEMBERSMANAGER_CONFIG_CROP_PROFILE_DESCRIPTION="Set if all profile images that are added should be cropped."
COM_MEMBERSMANAGER_CONFIG_CROP_PROFILE_LABEL="Crop Profile Images"
COM_MEMBERSMANAGER_CONFIG_DEFAULT_ACCESSLEVEL_DESCRIPTION="Select the default access level."
COM_MEMBERSMANAGER_CONFIG_DEFAULT_ACCESSLEVEL_LABEL="Default Access Level"
COM_MEMBERSMANAGER_CONFIG_DOC_FOOTER_DESCRIPTION="Enter Document Footer Here"
COM_MEMBERSMANAGER_CONFIG_DOC_FOOTER_HINT="Footer Here"
COM_MEMBERSMANAGER_CONFIG_DOC_FOOTER_LABEL="Document Footer<br /><small>html allowed</small>"
@ -100,6 +104,8 @@ COM_MEMBERSMANAGER_CONFIG_LIST_TEMPLATE_HINT="// html for the body surrounding t
[load_items]
</ul>"
COM_MEMBERSMANAGER_CONFIG_LIST_TEMPLATE_LABEL="List Template"
COM_MEMBERSMANAGER_CONFIG_LOGIN_REQUIRED_DESCRIPTION="Is it required to login before viewing a profile"
COM_MEMBERSMANAGER_CONFIG_LOGIN_REQUIRED_LABEL="Login Required"
COM_MEMBERSMANAGER_CONFIG_MAIN="Main"
COM_MEMBERSMANAGER_CONFIG_MAIN_LOGIN="Main & Login"
COM_MEMBERSMANAGER_CONFIG_MAIN_TEMPLATE_DESCRIPTION="Set the HTML for the main template"
@ -164,7 +170,7 @@ var fieldnr = [...Array(10).keys()];
// check selected components
function getOnlySelectedComponents() {
// start array (always load member managers own placeholders)
var values = ['com_membersmanager'];
var values = ['com_corecomponent'];
// all the selected (1 to 1)
jQuery.each(comfield_, function( index, value ) {
if (jQuery('#' + value + 'components').length){
@ -187,16 +193,15 @@ function getOnlySelectedComponents() {
getOnlySelectedComponentPlaceHolders(values);
}
function getOnlySelectedComponentPlaceHolders_server(comp){
var getUrl = 'index.php?option=com_membersmanager&task=ajax.getAnyPlaceHolders&format=json';
var getUrl = 'index.php?option=com_membersmanager&task=ajax.getAnyPlaceHolders&raw=true&format=json';
if(token.length > 0){
var request = 'token='+token+'&getType=' + comp;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
data: request,
jsonp: 'callback'
jsonp: false
});
}
function getOnlySelectedComponentPlaceHolders(values){
@ -368,6 +373,7 @@ COM_MEMBERSMANAGER_CONFIG_WEBSITE_MESSAGE="Error! Please add website here."
COM_MEMBERSMANAGER_CONFIG_YES="Yes"
COM_MEMBERSMANAGER_CONTRIBUTOR="Contributor"
COM_MEMBERSMANAGER_CONTRIBUTORS="Contributors"
COM_MEMBERSMANAGER_CORE_PLACEHOLDERS="Core Placeholders"
COM_MEMBERSMANAGER_COULD_NOT_UPLOAD_THE_FILE="Could not upload the file!"
COM_MEMBERSMANAGER_CPANEL_ACCESS_SITE="cPanel (Site) Access"
COM_MEMBERSMANAGER_CPANEL_ACCESS_SITE_DESC=" Allows the users in this group to access site cpanel."
@ -404,6 +410,7 @@ COM_MEMBERSMANAGER_IMPORT_FROM_UPLOAD="Upload"
COM_MEMBERSMANAGER_IMPORT_FROM_URL="URL"
COM_MEMBERSMANAGER_IMPORT_GET_BOTTON="Get File"
COM_MEMBERSMANAGER_IMPORT_IGNORE_COLUMN="-- Ignore This Column --"
COM_MEMBERSMANAGER_IMPORT_JOOMLA_USERS="Import Joomla Users"
COM_MEMBERSMANAGER_IMPORT_LINK_FILE_TO_TABLE_COLUMNS="Link File to Table Columns"
COM_MEMBERSMANAGER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE="Does not have a valid file type."
COM_MEMBERSMANAGER_IMPORT_MSG_ENTER_A_URL="Please enter a url."
@ -423,7 +430,7 @@ COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_DIRECTORY="Set the path to file"
COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_MEMBERS="Select the file to import data to members."
COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_TYPES="Select the file to import data to types."
COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_URL="Enter file URL"
COM_MEMBERSMANAGER_IMPORT_SUCCESS="Great! Import successful."
COM_MEMBERSMANAGER_IMPORT_SUCCESS="Import Success!"
COM_MEMBERSMANAGER_IMPORT_TABLE_COLUMNS="Table Columns"
COM_MEMBERSMANAGER_IMPORT_TITLE="Data Importer"
COM_MEMBERSMANAGER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE="Package to import not found."
@ -568,6 +575,8 @@ COM_MEMBERSMANAGER_MEMBER_EMAIL_MESSAGE="Error! Please add email address here."
COM_MEMBERSMANAGER_MEMBER_ERROR_UNIQUE_ALIAS="Another Member has the same alias."
COM_MEMBERSMANAGER_MEMBER_ID="Id"
COM_MEMBERSMANAGER_MEMBER_ID_MISMATCH_SS_COULD_NOT_BE_SAVED="Member ID mismatch, %s-%s could not be saved."
COM_MEMBERSMANAGER_MEMBER_IMPORT_JOOMLA_USERS_BUTTON_ACCESS="Member Import Joomla Users Button Access"
COM_MEMBERSMANAGER_MEMBER_IMPORT_JOOMLA_USERS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the import joomla users button."
COM_MEMBERSMANAGER_MEMBER_IS_ALREADY_LINKED_TO_AN_USER_THIS_CAN_NOT_BE_CHANGED_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_IF_YOU_NEED_MORE_HELP="Member is already linked to an USER, this can not be changed. Contact your system administrator if you need more help."
COM_MEMBERSMANAGER_MEMBER_MAIN="Main"
COM_MEMBERSMANAGER_MEMBER_MAIN_LOGIN="Main & Login"
@ -658,7 +667,11 @@ COM_MEMBERSMANAGER_NEW="New"
COM_MEMBERSMANAGER_NOT_FOUND_OR_ACCESS_DENIED="Not found or access denied!"
COM_MEMBERSMANAGER_NO_ACCESS_GRANTED="No Access Granted!"
COM_MEMBERSMANAGER_NO_IMPORT_FILE_SELECTED="No import file selected."
COM_MEMBERSMANAGER_NO_MEMBERS_ARE_SET_PLEASE_SET_SOME_AND_TRY_AGAIN="No members are set, please set some and try again."
COM_MEMBERSMANAGER_NO_MEMBER_TYPES_ARE_SET_PLEASE_SET_SOME_AND_TRY_AGAIN="No member types are set, please set some and try again."
COM_MEMBERSMANAGER_NO_TEMPLATE_FOR_BSB_WERE_FOUND="No template for <b>%s</b> were found"
COM_MEMBERSMANAGER_NO_USERS_WERE_FOUND_THAT_MATCH_THE_TARGET_GROUPS_SET_IN_THE_MEMBER_TYPES="No users were found that match the target groups set in the member types."
COM_MEMBERSMANAGER_ONLY_ONE_THOUSAND_MEMBERS_CAN_BE_IMPORTED_AT_A_TIME_SINCE_YOU_HAVE_MORE_THEN_ONE_THOUSAND_USERS_YOU_WILL_NEED_TO_RUN_THE_IMPORT_AGAIN_UNTIL_YOU_SEE_A_GREEN_SUCCESS_MESSAGE="Only 1000 members can be imported at a time. Since you have more then 1000 users, you will need to run the import again until you see a green success message!"
COM_MEMBERSMANAGER_OR="or"
COM_MEMBERSMANAGER_PLACEHOLDERS_NOT_FOUND="Placeholders not found"
COM_MEMBERSMANAGER_PRINT="Print"
@ -804,12 +817,16 @@ COM_MEMBERSMANAGER_TYPE_STATUS="Status"
COM_MEMBERSMANAGER_TYPE_TYPE="Type"
COM_MEMBERSMANAGER_TYPE_TYPE_DESCRIPTION="Select the type/s"
COM_MEMBERSMANAGER_TYPE_TYPE_LABEL="can Link"
COM_MEMBERSMANAGER_TYPE_UPDATE_TYPES_BUTTON_ACCESS="Type Update Types Button Access"
COM_MEMBERSMANAGER_TYPE_UPDATE_TYPES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the update types button."
COM_MEMBERSMANAGER_TYPE_VERSION_DESC="A count of the number of times this Type has been revised."
COM_MEMBERSMANAGER_TYPE_VERSION_LABEL="Revision"
COM_MEMBERSMANAGER_TYPE_VIEW_RELATIONSHIP="View Relationship"
COM_MEMBERSMANAGER_TYPE_VIEW_RELATIONSHIP_DESCRIPTION="Select the type/s that can view the relationships."
COM_MEMBERSMANAGER_TYPE_VIEW_RELATIONSHIP_LABEL="can View"
COM_MEMBERSMANAGER_TYPE_YES="Yes"
COM_MEMBERSMANAGER_UPDATE_SUCCESS="Update Success!"
COM_MEMBERSMANAGER_UPDATE_TYPES="Update Types"
COM_MEMBERSMANAGER_USE_BATCH="Use Batch"
COM_MEMBERSMANAGER_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."
COM_MEMBERSMANAGER_VALUE_ALREADY_TAKEN_PLEASE_TRY_AGAIN="Value already taken, please try again."
@ -819,9 +836,11 @@ COM_MEMBERSMANAGER_WARNING_IMPORT_UPLOAD_ERROR="Warning, import upload error."
COM_MEMBERSMANAGER_WEBSITE="Website"
COM_MEMBERSMANAGER_YOU_CAN_NOT_DELETE_BSB_FIRST_MOVE_ALL_SUB_ACCOUNTS_TO_NEW_MAIN_MEMBER="You can not delete <b>%s</b>, first move all sub account/s to new main member."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_ADD_DATA_TO_S_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to add data to %s, please contact your system administrator."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_CREATE_MEMBERS="You do not have permission to create members."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_S_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to edit %s, please contact your system administrator."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_THIS_MEMBER_RELATIONSHIPS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to edit this member relationships, please contact your system administrator."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_THIS_MEMBER_TYPE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to edit this member type, please contact your system administrator."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_REMOVE_THIS_FILE="You do not have permission to remove this file."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_MEMBERS_TYPES="You do not have permission to update members types."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_UPLOAD_AN="You do not have permission to upload an"
COM_MEMBERSMANAGER__HAS_BEEN_CHECKED_OUT_BY_S="% has been checked out by %s"

View File

@ -104,6 +104,8 @@ COM_MEMBERSMANAGER_MEMBERS_VIEW_USEREMAIL_DESC="Allows the users in this group t
COM_MEMBERSMANAGER_MEMBERS_VIEW_USERNAME="Members View Username"
COM_MEMBERSMANAGER_MEMBERS_VIEW_USERNAME_DESC="Allows the users in this group to view username of member"
COM_MEMBERSMANAGER_MEMBERS_VIEW_USER_DESC="Allows the users in this group to view user of member"
COM_MEMBERSMANAGER_MEMBER_IMPORT_JOOMLA_USERS_BUTTON_ACCESS="Member Import Joomla Users Button Access"
COM_MEMBERSMANAGER_MEMBER_IMPORT_JOOMLA_USERS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the import joomla users button."
COM_MEMBERSMANAGER_MEMBER_PROFILE_ACCESS_SITE="Member Profile (Site) Access"
COM_MEMBERSMANAGER_MEMBER_PROFILE_ACCESS_SITE_DESC=" Allows the users in this group to access site member profile."
COM_MEMBERSMANAGER_MENU="&#9733; Members Manager"
@ -159,5 +161,7 @@ COM_MEMBERSMANAGER_TYPES_IMPORT="Types Import"
COM_MEMBERSMANAGER_TYPES_IMPORT_DESC="Allows the users in this group to import import types"
COM_MEMBERSMANAGER_TYPES_SUBMENU="Types Submenu"
COM_MEMBERSMANAGER_TYPES_SUBMENU_DESC="Allows the users in this group to submenu of type"
COM_MEMBERSMANAGER_TYPE_UPDATE_TYPES_BUTTON_ACCESS="Type Update Types Button Access"
COM_MEMBERSMANAGER_TYPE_UPDATE_TYPES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the update types button."
COM_MEMBERSMANAGER_USE_BATCH="Use Batch"
COM_MEMBERSMANAGER_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."

View File

@ -14,14 +14,20 @@ defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
$fields = array(
$fields = $displayData->get('fields') ?: array(
'token',
'account'
'account',
'user'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<div class="form-inline form-inline-header">
<?php foreach($fields as $field){
echo $form->renderField($field);
} ?>
<?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>

View File

@ -30,20 +30,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -20,20 +20,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -12,11 +12,9 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
'user',
'created',
'created_by',
'modified',
@ -25,20 +23,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -12,7 +12,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
@ -26,20 +25,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -23,20 +23,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -21,20 +21,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -14,14 +14,19 @@ defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
$fields = array(
$fields = $displayData->get('fields') ?: array(
'name',
'alias'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<div class="form-inline form-inline-header">
<?php foreach($fields as $field){
echo $form->renderField($field);
} ?>
<?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>

View File

@ -18,16 +18,14 @@ $fields = $displayData->get('fields') ?: array(
'description'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<div class="form-vertical">
<?php foreach($fields as $field): ?>
<div class="control-group">
<div class="control-label">
<?php echo $form->getLabel($field); ?>
</div>
<div class="controls">
<?php echo $form->getInput($field); ?>
</div>
</div>
<?php endforeach; ?>
<?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>

View File

@ -20,20 +20,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -20,20 +20,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -12,7 +12,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
@ -24,20 +23,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -12,7 +12,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
@ -26,20 +25,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -62,9 +62,10 @@ class MembersmanagerModelAjax extends JModelList
// get placeholder header if available
public function getPlaceHolderHeaders($component)
{
if ('com_membersmanager' === $component)
if ('com_membersmanager' === $component || 'com_corecomponent' === $component)
{
return JText::_('COM_MEMBERSMANAGER');
// just return the core placeholders
return JText::_('COM_MEMBERSMANAGER_CORE_PLACEHOLDERS');
}
return MembersmanagerHelper::getComponentName($component);
}
@ -74,7 +75,7 @@ class MembersmanagerModelAjax extends JModelList
{
$view = $this->getViewID();
// make sure we are in the (allowed) view
if (isset($view['a_view']) && ($view['a_view'] === 'message' || $view['a_view'] === 'profile'))
if (isset($view['a_view']) && ($view['a_view'] === 'compose' || $view['a_view'] === 'profile'))
{
// build image name
$imageName = md5($image . 'jnst_f0r_dumm!es');
@ -205,7 +206,7 @@ class MembersmanagerModelAjax extends JModelList
{
MembersmanagerHelper::resizeImage($this->fileName, $this->fileFormat, $this->target, $this->folderPath, $this->fullPath);
}
// Get the basic encription.
// Get the basic encryption.
$basickey = MembersmanagerHelper::getCryptKey('basic');
$basic = null;
// set link options
@ -438,8 +439,8 @@ class MembersmanagerModelAjax extends JModelList
protected function _getPackageFromUpload()
{
// Get the uploaded file information
$app = JFactory::getApplication();
$input = $app->input;
$app = JFactory::getApplication();
$input = $app->input;
// See JInputFiles::get.
$userfiles = $input->files->get('files', null, 'array');
@ -473,9 +474,9 @@ class MembersmanagerModelAjax extends JModelList
}
// Build the appropriate paths
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name'];
$tmp_src = $userfile['tmp_name'];
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name'];
$tmp_src = $userfile['tmp_name'];
// Move uploaded file
jimport('joomla.filesystem.file');
@ -545,12 +546,12 @@ class MembersmanagerModelAjax extends JModelList
}
}
$config = JFactory::getConfig();
$config = JFactory::getConfig();
// set Package Name
$check['packagename'] = $archivename;
$check['packagename'] = $archivename;
// set directory
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
return $check;
}
@ -567,8 +568,8 @@ class MembersmanagerModelAjax extends JModelList
{
jimport('joomla.filesystem.file');
$config = JFactory::getConfig();
$package = $config->get('tmp_path'). '/' .$package;
$config = JFactory::getConfig();
$package = $config->get('tmp_path'). '/' .$package;
// Is the package file a valid file?
if (is_file($package))
@ -668,8 +669,8 @@ class MembersmanagerModelAjax extends JModelList
$string = '';
$header = '';
}
// get placeholders
if ($placeholders = MembersmanagerHelper::getAnyPlaceHolders($getType))
// get the core component helper class & get placeholders
if (($helperClass = MembersmanagerHelper::getHelperClass(MembersmanagerHelper::getCoreName())) !== false && ($placeholders = $helperClass::getAnyPlaceHolders($getType)) !== false)
{
return '<div>' . $header . '<code style="display: inline-block; padding: 2px; margin: 3px;">' .
implode('</code> <code style="display: inline-block; padding: 2px; margin: 3px;">', $placeholders) .

View File

@ -1584,7 +1584,7 @@ class MembersmanagerModelMember extends JModelAdmin
// start message bucket
$message = array();
// check if user already linked
if (isset($data['user']) && $data['user'] > 0)
if (isset($data['user']) && is_numeric($data['user']) && $data['user'] > 0)
{
// set user ID
$bucket['id'] = $data['user'];
@ -1636,32 +1636,33 @@ class MembersmanagerModelMember extends JModelAdmin
{
// make sure to set the user value
$data['user'] = $done;
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_MEMBER_WAS_CREATED_SUCCESSFULLY_AND_THE_LOGIN_DETAILS_WAS_EMAILED_TO_THE_MEMBER'), 'Success');
}
else
{
// set the error
$app->enqueueMessage($done, 'Error');
// we still check if user was created.... (TODO)
if (($didCreate = JUserHelper::getUserId($bucket['username'])))
{
$data['user'] = $didCreate;
}
}
// once we are sure we have an user ID
if (isset($data['user']) && is_numeric($data['user']) && $data['user'] > 0)
{
// check if we have groups
if (($typeGroups = MembersmanagerHelper::getMemberGroupsByType($data['type'])) !== false)
{
// update the user groups
JUserHelper::setUserGroups((int) $done, (array) $typeGroups);
JUserHelper::setUserGroups((int) $data['user'], (array) $typeGroups);
}
else
{
// notice that the group was not set for this user
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_MEMBER_WAS_NOT_ADDED_TO_ANY_GROUPS_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR'), 'Error');
}
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_MEMBER_WAS_CREATED_SUCCESSFULLY_AND_THE_LOGIN_DETAILS_WAS_EMAILED_TO_THE_MEMBER'), 'Success');
}
else
{
$app->enqueueMessage($done, 'Error');
}
// we still check if user was created.... (TODO)
if (!is_numeric($done) && ($didCreate = JUserHelper::getUserId($bucket['username'])))
{
$data['user'] = $didCreate;
}
}
// check if the user was set
if (isset($data['user']) && $data['user'] > 0)
{
// the login member must always own it self for edit permissions
$data['created_by'] = $data['user'];
}

View File

@ -27,14 +27,207 @@ class MembersmanagerModelMembers extends JModelList
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
'a.account','account',
'a.main_member','main_member'
'a.account','account'
);
}
parent::__construct($config);
}
/**
* Load all the users found in Joomla into membersmanager
*
* @since 2.7.5
*
* @return bool true on success
*/
public function importJoomlaUsers()
{
if (($types = $this->getMemberTypes()) !== false)
{
// get all already set users
$active_users = (($users = MembersmanagerHelper::getVars('member', 1, 'published', 'user')) !== false) ? $users : array();
// set so defaults
$userBucket = array();
$trigger = false;
foreach ($types as $type => $groups)
{
$this->loadMembers($userBucket, $type, $groups, $active_users, $trigger);
// trigger message to run import again
if ($trigger)
{
JFactory::getApplication()->enqueueMessage(JText::_('COM_MEMBERSMANAGER_ONLY_ONE_THOUSAND_MEMBERS_CAN_BE_IMPORTED_AT_A_TIME_SINCE_YOU_HAVE_MORE_THEN_ONE_THOUSAND_USERS_YOU_WILL_NEED_TO_RUN_THE_IMPORT_AGAIN_UNTIL_YOU_SEE_A_GREEN_SUCCESS_MESSAGE'), 'warning');
return false;
}
}
// now insert the members in table
if ($this->insertMembers($userBucket, $active_users) || !$trigger)
{
return true;
}
JFactory::getApplication()->enqueueMessage(JText::_('COM_MEMBERSMANAGER_NO_USERS_WERE_FOUND_THAT_MATCH_THE_TARGET_GROUPS_SET_IN_THE_MEMBER_TYPES'), 'warning');
return false;
}
JFactory::getApplication()->enqueueMessage(JText::_('COM_MEMBERSMANAGER_NO_MEMBER_TYPES_ARE_SET_PLEASE_SET_SOME_AND_TRY_AGAIN'), 'warning');
return false;
}
/**
* Gets an array of objects of types of members.
*
* @return object[] An array of results.
*
*/
protected function getMemberTypes()
{
// get types that allow relationships
$query = $this->_db->getQuery(true);
$query->select(array('a.id', 'a.groups_target'));
$query->from('#__membersmanager_type AS a');
$query->where($this->_db->quoteName('a.published') . ' >= 1');
$this->_db->setQuery($query);
$this->_db->execute();
// only continue if we have member types and all relationship types
if (($types = $this->_db->loadAssocList('id', 'groups_target')) !== false && MembersmanagerHelper::checkArray($types))
{
return $types;
}
return false;
}
/**
* Load members
*
* @return void
*
*/
protected function loadMembers(&$userBucket, &$type, &$groups, &$active_users, &$trigger)
{
if (!$trigger && MembersmanagerHelper::checkJson($groups))
{
$groups = (array) json_decode($groups, true);
if (MembersmanagerHelper::checkArray($groups))
{
foreach ($groups as $group_id)
{
if (($users = JAccess::getUsersByGroup($group_id)) !== false && MembersmanagerHelper::checkArray($users))
{
foreach ($users as $user_id)
{
// make sure this user is not already set
if (!in_array($user_id, $active_users))
{
if (!isset($userBucket[$user_id]))
{
$userBucket[$user_id] = array($type);
}
else
{
$userBucket[$user_id][] = $type;
}
}
else
{
// we need to do something here (TODO)
}
// if at any time we hit the 1000 mark we must reset
if (count($userBucket) >= 1000)
{
$trigger = true;
return $this->insertMembers($userBucket, $active_users);
}
}
}
}
}
}
}
/**
* Insert the members into the members table
*
* @return void
*
*/
protected function insertMembers(&$userBucket, $users)
{
// check if we found users
if (MembersmanagerHelper::checkArray($userBucket))
{
// Get a db connection.
$db = JFactory::getDbo();
$todayDate = JFactory::getDate()->toSql();
// Create a new query object.
$query = $db->getQuery(true);
// Insert columns.
$columns = array('user', 'token', 'name', 'username', 'useremail', 'account', 'type', 'created_by', 'created', 'published', 'access', 'version');
// Prepare the insert query.
$query->insert($db->quoteName('#__membersmanager_member'))->columns($db->quoteName($columns));
// limiting counter
$limiter = 0;
foreach ($userBucket as $user_id => $values)
{
// set the type
$type = new JRegistry;
$type->loadArray($values);
// get user
$member = JFactory::getUser($user_id);
// build unique token
$token = MembersmanagerHelper::safeString($member->name, 'L', '-', false, false);
while (!MembersmanagerHelper::checkUnique(0, 'token', $token, 'member'))
{
$token = JString::increment($token, 'dash');
}
// build member
$values = array();
$values[] = (int) $user_id;
$values[] = $db->quote($token);
$values[] = $db->quote($member->name);
$values[] = $db->quote($member->username);
$values[] = $db->quote($member->email);
$values[] = 1;
$values[] = $db->quote((string) $type);
$values[] = (int) $user_id;
$values[] = $db->quote($todayDate);
$values[] = 1;
$values[] = 1;
$values[] = 1;
// load values
$query->values(implode(',', $values));
// clear memory
unset($userBucket[$user_id]);
$limiter++;
// check if we have 100 rows, the insert and start new
if ($limiter >= 100)
{
// reset counter
$limiter = 0;
// run query
$db->setQuery($query);
$db->execute();
// reset query
$query = $db->getQuery(true);
// Prepare the new insert query.
$query->insert($db->quoteName('#__membersmanager_member'))->columns($db->quoteName($columns));
}
// make sure to update the user array that are active
$users[] = $user_id;
}
// reset the bucket
$userBucket = array();
// only run if queries remain
if ($limiter > 0)
{
$db->setQuery($query);
$db->execute();
}
return true;
}
return false;
}
/**
* Method to auto-populate the model state.
*
@ -52,9 +245,6 @@ class MembersmanagerModelMembers extends JModelList
$account = $this->getUserStateFromRequest($this->context . '.filter.account', 'filter_account');
$this->setState('filter.account', $account);
$main_member = $this->getUserStateFromRequest($this->context . '.filter.main_member', 'filter_main_member');
$this->setState('filter.main_member', $main_member);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
@ -245,11 +435,6 @@ class MembersmanagerModelMembers extends JModelList
{
$query->where('a.account = ' . $db->quote($db->escape($account)));
}
// Filter by main_member.
if ($main_member = $this->getState('filter.main_member'))
{
$query->where('a.main_member = ' . $db->quote($db->escape($main_member)));
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
@ -408,7 +593,6 @@ class MembersmanagerModelMembers extends JModelList
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.account');
$id .= ':' . $this->getState('filter.main_member');
return parent::getStoreId($id);
}

View File

@ -35,6 +35,52 @@ class MembersmanagerModelTypes extends JModelList
parent::__construct($config);
}
/**
* update/sync all the member types
*
* @return bool true on success
*/
public function updateTypes()
{
if (($members = $this->getMembers()) !== false)
{
// set so defaults
$bucket = array();
$trigger = false;
foreach ($members as $id => $types)
{
MembersmanagerHelper::updateTypes($id, $types);
}
return true;
}
JFactory::getApplication()->enqueueMessage(JText::_('COM_MEMBERSMANAGER_NO_MEMBERS_ARE_SET_PLEASE_SET_SOME_AND_TRY_AGAIN'), 'warning');
return false;
}
/**
* Gets an array of members.
*
* @return array An array of members.
*
*/
protected function getMembers()
{
// get types that allow relationships
$query = $this->_db->getQuery(true);
$query->select(array('a.id', 'a.type'));
$query->from('#__membersmanager_member AS a');
$query->where($this->_db->quoteName('a.published') . ' >= 1');
$this->_db->setQuery($query);
$this->_db->execute();
// only continue if we have member types and all relationship types
if (($members = $this->_db->loadAssocList('id', 'type')) !== false && MembersmanagerHelper::checkArray($members))
{
return $members;
}
return false;
}
/**
* Method to auto-populate the model state.
*

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 DEFAULT '',
`params` text NOT 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 DEFAULT '',
`params` text NOT 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

@ -13,19 +13,9 @@ Joomla.submitbutton = function(task)
if (task == ''){
return false;
} else {
var isValid=true;
var action = task.split('.');
if (action[1] != 'cancel' && action[1] != 'close'){
var forms = $$('form.form-validate');
for (var i=0;i<forms.length;i++){
if (!document.formvalidator.isValid(forms[i])){
isValid = false;
break;
}
}
}
if (isValid){
Joomla.submitform(task);
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'));

View File

@ -134,6 +134,11 @@ class MembersmanagerViewMembers extends JViewLegacy
JToolBarHelper::custom('members.exportData', 'download', '', 'COM_MEMBERSMANAGER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('member.import_joomla_users', 'com_membersmanager'))
{
// add Import Joomla Users button.
JToolBarHelper::custom('members.importJoomlaUsers', 'joomla', '', 'COM_MEMBERSMANAGER_IMPORT_JOOMLA_USERS', false);
}
if ($this->canDo->get('core.import') && $this->canDo->get('member.import'))
{
@ -207,28 +212,6 @@ class MembersmanagerViewMembers extends JViewLegacy
);
}
}
// Set Main Member User Selection
$this->main_memberUserOptions = JFormHelper::loadFieldType('Mainmembers')->options;
if ($this->main_memberUserOptions)
{
// Main Member User Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_MEMBERSMANAGER_MEMBER_MAIN_MEMBER_LABEL').' -',
'filter_main_member',
JHtml::_('select.options', $this->main_memberUserOptions, 'value', 'text', $this->state->get('filter.main_member'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Main Member User Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_MEMBERSMANAGER_MEMBER_MAIN_MEMBER_LABEL').' -',
'batch[main_member]',
JHtml::_('select.options', $this->main_memberUserOptions, 'value', 'text')
);
}
}
}
/**

View File

@ -13,19 +13,9 @@ Joomla.submitbutton = function(task)
if (task == ''){
return false;
} else {
var isValid=true;
var action = task.split('.');
if (action[1] != 'cancel' && action[1] != 'close'){
var forms = $$('form.form-validate');
for (var i=0;i<forms.length;i++){
if (!document.formvalidator.isValid(forms[i])){
isValid = false;
break;
}
}
}
if (isValid){
Joomla.submitform(task);
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'));

View File

@ -134,6 +134,11 @@ class MembersmanagerViewTypes extends JViewLegacy
JToolBarHelper::custom('types.exportData', 'download', '', 'COM_MEMBERSMANAGER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('type.update_types', 'com_membersmanager'))
{
// add Update Types button.
JToolBarHelper::custom('types.updateTypes', 'wrench', '', 'COM_MEMBERSMANAGER_UPDATE_TYPES', false);
}
if ($this->canDo->get('core.import') && $this->canDo->get('type.import'))
{

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_MEMBERSMANAGER</name>
<creationDate>27th December, 2018</creationDate>
<creationDate>4th April, 2019</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>https://www.joomlacomponentbuilder.com/</authorUrl>

View File

@ -503,7 +503,7 @@ class com_membersmanagerInstallerScript
$query = $db->getQuery(true);
// Field to update.
$fields = array(
$db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","placeholder_prefix":"member","members_display_type":"1","many_components":"0","crop_profile":"1","profile_height":"300","profile_width":"200","dynamic_salt":"1->!,3->E,4->A,6->b,9->d","country":"Namibia","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_version":"2","uikit_load":"1","uikit_min":"","uikit_style":""}'),
$db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","default_accesslevel":"1","placeholder_prefix":"member","members_display_type":"1","many_components":"0","login_required":"1","crop_profile":"1","profile_height":"300","profile_width":"200","dynamic_salt":"1->!,3->E,4->A,6->b,9->d","country":"Namibia","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_version":"2","uikit_load":"1","uikit_min":"","uikit_style":""}'),
);
// Condition.
$conditions = array(

View File

@ -14,3 +14,13 @@
#jform_main_member_chzn {
width: 100% !important;
}
.btn-toolbar .btn-wrapper {
display: inline-block;
margin: 0 0 8px 5px;
}
.form-inline, .form-inline-header {
display: inline-block;
}
.form-inline-header .control-group, .form-inline-header .control-label, .form-inline-header .controls {
display: inline-block;
}

View File

@ -11,16 +11,16 @@
/* JS Document */
// Get report based on id & element from Server
function getReport_server(report_key){
var getUrl = JRouter("index.php?option=com_membersmanager&task=ajax.getReport&format=json");
var getUrl = JRouter("index.php?option=com_membersmanager&task=ajax.getReport&raw=true&format=json&vdm="+vastDevMod);
if(token.length > 0 && report_key.length > 0){
var request = 'token='+token+'&key='+report_key;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
dataType: 'json',
data: request,
jsonp: 'callback'
jsonp: false
});
}
// get report to display
@ -74,3 +74,43 @@ function loadTheChartInModal(callback, targetDivID){
callback();
}, 800);
}
// Get messages based on id & element from Server
function getListMessages_server(messages_key){
var getUrl = JRouter("index.php?option=com_membersmanager&task=ajax.getListMessages&raw=true&format=json&vdm="+vastDevMod);
if(token.length > 0 && messages_key.length > 0){
var request = 'token='+token+'&key='+messages_key;
}
return jQuery.ajax({
type: 'POST',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
// get messages to display
function getListMessages(messages_key){
// remove old data and add spinner
jQuery('.setlistmessages').html('');
jQuery('.listmessages-spinner').show();
// first we see if we have local storage of this data
getListMessages_server(messages_key).done(function(result) {
if(result.html){
setListMessages(result.html);
} else if(result.error){
// set an error if item date could not return
setListMessages(result.error);
} else {
// set an error if item date could not return
setListMessages('<li>'+Joomla.JText._('COM_MEMBERSMANAGER_THERE_WAS_NO_MESSAGES_FOUND')+'</li>');
}
});
}
// set the Messages
function setListMessages(data) {
// show data
jQuery('.setlistmessages').html(data);
// hide spinner
jQuery('.listmessages-spinner').hide();
}

View File

@ -29,7 +29,7 @@ class MembersmanagerController extends JControllerLegacy
function display($cachable = false, $urlparams = false)
{
// set default view if not set
$view = $this->input->getCmd('view', 'members');
$view = $this->input->getCmd('view', 'cpanel');
$this->input->set('view', $view);
$isEdit = $this->checkEditView($view);
$layout = $this->input->get('layout', null, 'WORD');
@ -68,7 +68,7 @@ class MembersmanagerController extends JControllerLegacy
else
{
// normal redirect back to the list default site view
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=members', false));
$this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=cpanel', false));
}
return false;
}

View File

@ -34,6 +34,7 @@ class MembersmanagerControllerAjax extends JControllerLegacy
$this->registerTask('getChartImageLink', 'ajax');
$this->registerTask('searchMembers', 'ajax');
$this->registerTask('getReport', 'ajax');
$this->registerTask('getListMessages', 'ajax');
}
public function ajax()
@ -395,6 +396,44 @@ class MembersmanagerControllerAjax extends JControllerLegacy
}
}
break;
case 'getListMessages':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$keyValue = $jinput->get('key', NULL, 'STRING');
if($keyValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getListMessages($keyValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode($e).");";
}
else
{
echo "(".json_encode($e).");";
}
}
break;
}
}
else

View File

@ -35,7 +35,7 @@ class MembersmanagerControllerMember extends JControllerForm
*/
public function __construct($config = array())
{
$this->view_list = 'members'; // safeguard for setting the return view listing to the default site view.
$this->view_list = 'cpanel'; // safeguard for setting the return view listing to the default site view.
parent::__construct($config);
}

View File

@ -27,6 +27,7 @@ abstract class MembersmanagerHelper
self::loadSession();
}
/**
* the params
**/
@ -161,7 +162,7 @@ abstract class MembersmanagerHelper
// set edit link
$selection['setMemberEditURL:id|created_by'] = $f . 'edit_url' . $b;
// Get the medium encryption.
$mediumkey = MembersmanagerHelper::getCryptKey('medium');
$mediumkey = self::getCryptKey('medium');
if ($mediumkey)
{
// Get the encryption object.
@ -221,7 +222,17 @@ abstract class MembersmanagerHelper
**/
protected static function setProfileLink($object)
{
return JRoute::_('index.php?option=com_membersmanager&view=profile&id='. $object->get('id') . ':' . $object->get('token') . '&return=' . self::$return_here);
// get the global settings
if (!self::checkObject(self::$params))
{
self::$params = JComponentHelper::getParams('com_membersmanager');
}
// only load link if open to public or is logged in
if (2 == self::$params->get('login_required', 1) || JFactory::getUser()->id > 0)
{
return JRoute::_('index.php?option=com_membersmanager&view=profile&id='. $object->get('id') . ':' . $object->get('token') . '&return=' . self::$return_here);
}
return '';
}
/**
@ -290,9 +301,24 @@ abstract class MembersmanagerHelper
$_return = urlencode(base64_encode((string) JUri::getInstance()));
if ($return)
{
return self::getCreateURL('message', 'message', $return . '&return=' . $_return, 'com_communicate');
return self::getCreateURL('compose', 'compose', $return . '&return=' . $_return, 'com_communicate');
}
return self::getCreateURL('message', 'message', '&return=' . $_return, 'com_communicate');
return self::getCreateURL('compose', 'compose', '&return=' . $_return, 'com_communicate');
}
elseif ($key && 'message_number' === $key && is_numeric($return) && $return > 0)
{
// get the messages numbers
if (($messages = self::getMessages($return)) !== false)
{
// return result
return count( (array) $messages);
}
return 0;
}
elseif ($key && 'list_messages' === $key && is_numeric($default) && $default > 0)
{
// return result
return self::getListMessages($default, $return);
}
// get the global settings of com_communicate (singleton)
$params = JComponentHelper::getParams('com_communicate');
@ -306,6 +332,103 @@ abstract class MembersmanagerHelper
return $default;
}
/**
* return a list of messages
**/
protected static function getListMessages(&$id, &$return)
{
// get the messages
if (($messages = self::getMessages($id)) !== false)
{
// set the return value
$_return = '';
if (self::checkString($return))
{
$_return = '&return=' . $return;
}
// now build the html
$bucket = array('received' => array(), 'send' => array());
foreach($messages as $message)
{
// get time stamp
$timestamp = strtotime($message->created);
$date = self::fancyDynamicDate($timestamp);
// get key
$key = '&key=' . self::lock($message->id); // to insure that the access is only given by the sytem
// build link
$link = JRoute::_('index.php?option=com_communicate&view=message&id=' . $message->id . $_return . $key);
// set read status
$b = '<a href="' . $link . '">';
$_b = '</a>';
if ($message->hits == 0)
{
$b = '<a href="' . $link . '">&bigstar;&nbsp;';
}
// build the bucket of messages
if ($id == $message->recipient)
{
$bucket['received'][] = $b . $message->subject . '<br />&nbsp;&nbsp;<small>&rarr;&nbsp;' . $date . '</small>' . $_b;
}
else
{
if (($name = self::getMemberName($message->recipient, null, null, null, false)) === false)
{
$name = $message->email;
}
$bucket['send'][] = $b . $name . '<br />&nbsp;&nbsp;' . $message->subject . '<br />&nbsp;&nbsp;<small>&larr;&nbsp;' . $date . '</small>' . $_b;
}
}
// now build the actual list
$html = array();
foreach ($bucket as $_name => $_messages)
{
if (self::checkArray($_messages))
{
$html[] = '<li class="uk-nav-header">' . $_name . '</li>';
$html[] = '<li>' . implode('</li><li>', $_messages) . '</li>';
}
}
// make sure we have messages
if (self::checkArray($html))
{
return implode("", $html);
}
}
return false;
}
/**
* get messages
**/
public static function getMessages(&$id)
{
// Get the user object.
$user = JFactory::getUser();
// get database object
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select(array('a.id', 'a.member','a.recipient','a.created','a.subject','a.kind','a.email','a.hits'));
$query->from('#__communicate_message AS a');
$query->where('(a.recipient = ' . (int) $id . ' OR a.member = ' . (int) $id . ')');
$query->where('a.published = 1');
// Implement View Level Access
if (!$user->authorise('core.options', 'com_communicate'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
$query->order('a.created desc');
$db->setQuery($query);
$db->execute();
// check if we have found any
if ($db->getNumRows())
{
// get all messages
return $db->loadObjectList();
}
return false;
}
/**
* remove all groups that are part of target groups in the member types
**/
@ -342,7 +465,7 @@ abstract class MembersmanagerHelper
public static function getAnyPlaceHolders($_component, $type = 'report', $addCompany = false)
{
// check if we are in the correct class
if ('com_membersmanager' !== $_component)
if ('com_membersmanager' !== $_component && 'com_corecomponent' !== $_component)
{
// check if the class and method exist
if (($helperClass = self::getHelperClass($_component)) !== false && method_exists($helperClass, 'getPlaceHolders'))
@ -681,9 +804,57 @@ abstract class MembersmanagerHelper
// check if access is needed
if (!$user->authorise('core.options', 'com_membersmanager'))
{
if (($userID = $user->get('id', false)) !== false && $userID > 0 && ($types = self::getVar('member', $userID, 'user', 'type')) !== false)
// get all types in system
$query = $db->getQuery(true);
$query->select(array('a.groups_access', 'a.groups_target'));
$query->from('#__membersmanager_type AS a');
$query->where($db->quoteName('a.published') . ' >= 1');
// also filter by access (will keep an eye on this)
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
$db->setQuery($query);
$db->execute();
// get all types
$types = $db->loadAssocList();
// make sure we have types, and user access groups
if (self::checkArray($types) && ($userID = $user->get('id', false)) !== false && $userID > 0 && ($member_type = self::getVar('member', $userID, 'user', 'type')) !== false)
{
return self::getMemberGroupsByType($types, 'groups_access');
// get the groups this member belong to
$member_access = self::getMemberGroupsByType($member_type);
// function to setup the group array
$setGroups = function ($groups) {
// convert to array
if (self::checkJson($groups))
{
return (array) json_decode($groups, true);
}
elseif (is_numeric($groups))
{
return array($groups);
}
return false;
};
// our little function to check if two arrays intersect on values
$intersect = function ($a, $b) { $b = array_flip($b); foreach ($a as $v) { if (isset($b[$v])) return true; } return false; };
// type bucket
$bucketTypes = array();
foreach ($types as $groups)
{
$groups_access = $setGroups($groups['groups_access']);
if (self::checkArray($groups_target) && $intersect($groups_access, $member_access))
{
$groups_target = $setGroups($groups['groups_target']);
foreach ($groups_target as $group_target)
{
$bucketTypes[$group_target] = $group_target;
}
}
}
// check if we found any
if (self::checkArray($bucketTypes))
{
return $bucketTypes;
}
}
return false;
}
@ -712,7 +883,7 @@ abstract class MembersmanagerHelper
{
// get all types in system
$query = $db->getQuery(true);
$query->select(array('a.id', 'a.groups_target')); // groups_target = type_link
$query->select(array('a.id', 'a.groups_access'));
$query->from('#__membersmanager_type AS a');
$query->where($db->quoteName('a.published') . ' >= 1');
// also filter by access (will keep an eye on this)
@ -721,10 +892,12 @@ abstract class MembersmanagerHelper
$db->setQuery($query);
$db->execute();
// get all types
$types = $db->loadAssocList('id', 'groups_target');
$types = $db->loadAssocList('id', 'groups_access');
// make sure we have types, and user access groups
if (self::checkArray($types) && ($groups_access = self::getAccessGroups($user, $db)) !== false)
if (self::checkArray($types) && ($userID = $user->get('id', false)) !== false && $userID > 0 && ($member_type = self::getVar('member', $userID, 'user', 'type')) !== false)
{
// get the access groups
$groups_access = self::getMemberGroupsByType($member_type);
// function to setup the group array
$setGroups = function ($groups) {
// convert to array
@ -835,6 +1008,32 @@ abstract class MembersmanagerHelper
return date('jS \o\f F Y',$date);
}
/**
* get date based in period past
*/
public static function fancyDynamicDate($date)
{
if (!self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
// older then year
$lastyear = date("Y", strtotime("-1 year"));
$tragetyear = date("Y", $date);
if ($tragetyear <= $lastyear)
{
return date('m/d/y', $date);
}
// same day
$yesterday = strtotime("-1 day");
if ($date > $yesterday)
{
return date('g:i A', $date);
}
// just month day
return date('M j', $date);
}
/**
* Change to nice fancy day time and date
*/
@ -1992,6 +2191,10 @@ abstract class MembersmanagerHelper
{
$checked_out = (int) $item->checked_out;
}
else
{
$checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (self::checkArray($item) && isset($item['id']))
{
@ -2000,6 +2203,14 @@ abstract class MembersmanagerHelper
{
$checked_out = (int) $item['checked_out'];
}
else
{
$checked_out = self::getVar($view, $item['id'], 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
// set the link title
$title = self::safeString(JText::_('COM_MEMBERSMANAGER_EDIT') . ' ' . $view, 'W');
@ -2051,6 +2262,118 @@ abstract class MembersmanagerHelper
return '';
}
/**
* Get an edit text button
*
* @param string $text The button text
* @param int $item The item to edit
* @param string $view The type of item to edit
* @param string $views The list view controller name
* @param string $ref The return path
* @param string $component The component these views belong to
* @param string $headsup The message to show on click of button
*
* @return string On success the full html link
*
*/
public static function getEditTextButton($text, &$item, $view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true, $class = 'uk-button', $headsup = 'COM_MEMBERSMANAGER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE')
{
// make sure we have text
if (!self::checkString($text))
{
return self::getEditButton($item, $view, $views, $ref, $component, $headsup);
}
// get URL
$url = self::getEditURL($item, $view, $views, $ref, $component, $jRoute);
// check if we found any
if (self::checkString($url))
{
// get the global settings
if (!self::checkObject(self::$params))
{
self::$params = JComponentHelper::getParams('com_membersmanager');
}
// get UIKIT version
$uikit = self::$params->get('uikit_version', 2);
// check that we have the ID
if (self::checkObject($item) && isset($item->id))
{
// check if the checked_out is available
if (isset($item->checked_out))
{
$checked_out = (int) $item->checked_out;
}
else
{
$checked_out = self::getVar($view, $item->id, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (self::checkArray($item) && isset($item['id']))
{
// check if the checked_out is available
if (isset($item['checked_out']))
{
$checked_out = (int) $item['checked_out'];
}
else
{
$checked_out = self::getVar($view, $item['id'], 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
}
elseif (is_numeric($item) && $item > 0)
{
$checked_out = self::getVar($view, $item, 'id', 'checked_out', '=', str_replace('com_', '', $component));
}
// set the link title
$title = self::safeString(JText::_('COM_MEMBERSMANAGER_EDIT') . ' ' . $view, 'W');
// check that there is a check message
if (self::checkString($headsup))
{
if (3 == $uikit)
{
$href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"';
}
else
{
$href = 'onclick="UIkit2.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"';
}
}
else
{
$href = 'href="' . $url . '"';
}
// return UIKIT version 3
if (3 == $uikit)
{
// check if it is checked out
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == JFactory::getUser()->id)
{
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return ' <a class="' . $class . '" href="#" disabled title="' . JText::sprintf('COM_MEMBERSMANAGER__HAS_BEEN_CHECKED_OUT_BY_S', self::safeString($view, 'W'), JFactory::getUser($checked_out)->name) . '">' . $text . '</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
// check if it is checked out (return UIKIT version 2)
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == JFactory::getUser()->id)
{
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return ' <a class="' . $class . '" href="#" disabled title="' . JText::sprintf('COM_MEMBERSMANAGER__HAS_BEEN_CHECKED_OUT_BY_S', self::safeString($view, 'W'), JFactory::getUser($checked_out)->name) . '">' . $text . '</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return '';
}
/**
* Get the edit URL
*
@ -2064,8 +2387,13 @@ abstract class MembersmanagerHelper
* @return string On success the edit url
*
*/
public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true)
public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true)
{
// make sure the user has access to view
if (!JFactory::getUser()->authorise($view. '.access', $component))
{
return false;
}
// build record
$record = new stdClass();
// check that we have the ID
@ -2182,7 +2510,7 @@ abstract class MembersmanagerHelper
public static function getCreateURL($view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true)
{
// can create
if (JFactory::getUser()->authorise($view . '.create', $component))
if (JFactory::getUser()->authorise($view. '.access', $component) && JFactory::getUser()->authorise($view . '.create', $component))
{
// set create task
$create = "&task=" . $view . ".edit";
@ -2348,9 +2676,36 @@ abstract class MembersmanagerHelper
// add and update the header footer and header if setDynamicData is found on placeholder request
if (method_exists(__CLASS__, 'setDynamicData') && 'placeholder' == $method)
{
// get the placeholder prefix
$prefix = self::$params->get('placeholder_prefix', 'member');
// member array keeper
$member_keeper = array('[IF ' . $prefix . '_' => '|!f r3c1p13nt_', '[' . $prefix . '_' => '|r3c1p13nt_');
// get the global templates
$doc_header = self::$params->get('doc_header', '');
if (self::checkString($doc_header))
{
// preserve any possible member placeholders
$doc_header = str_replace(array_keys($member_keeper), array_values($member_keeper), $doc_header);
// update document header with company details
$doc_header = self::setDynamicData($doc_header, self::$companyDetails[$method]);
// reverse the preservation of member placeholders
$doc_header = str_replace(array_values($member_keeper), array_keys($member_keeper), $doc_header);
}
// get the global templates
$doc_footer = self::$params->get('doc_footer', '');
if (self::checkString($doc_footer))
{
// preserve any possible member placeholders
$doc_footer = str_replace(array_keys($member_keeper), array_values($member_keeper), $doc_footer);
// update document footer with company details
$doc_footer = self::setDynamicData($doc_footer, self::$companyDetails[$method]);
// reverse the preservation of member placeholders
$doc_footer = str_replace(array_values($member_keeper), array_keys($member_keeper), $doc_footer);
}
// add document header and footer
self::$companyDetails[$method][$f.'company_doc_header'.$b] = self::setDynamicData(self::$params->get('doc_header', ''), self::$companyDetails[$method]);
self::$companyDetails[$method][$f.'company_doc_footer'.$b] = self::setDynamicData(self::$params->get('doc_footer', ''), self::$companyDetails[$method]);
self::$companyDetails[$method][$f.'company_doc_header'.$b] = $doc_header;
self::$companyDetails[$method][$f.'company_doc_footer'.$b] = $doc_footer;
}
// if object is called for
if ('object' == $method)
@ -2872,11 +3227,11 @@ abstract class MembersmanagerHelper
self::joinMemberDetails($query, $filter, $db);
}
// Implement View Level Access (if set in table)
if (!$user->authorise('core.options', '[[[com_component]]]') && isset($columns['access']))
if (!$user->authorise('core.options', 'com_membersmanager') && isset($columns['access']))
{
// ensure to always filter by access
$accessGroups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $accessGroups . ')');
// $accessGroups = implode(',', $user->getAuthorisedViewLevels()); TODO first fix save to correct access groups
// $query->where('a.access IN (' . $accessGroups . ')');
}
// check if we have more get where details
if (method_exists(__CLASS__, "whereMemberDetails"))
@ -3827,6 +4182,8 @@ abstract class MembersmanagerHelper
*/
protected static function setInfoComponents()
{
// filter per user access
$user = JFactory::getUser();
$db = JFactory::getDBO();
// get components
$query = $db->getQuery(true);
@ -3843,8 +4200,9 @@ abstract class MembersmanagerHelper
// filter out the components we need
$listComponents = array_filter(
$listComponents,
function ($component) {
if (self::checkJson($component->params) && strpos($component->params, 'activate_membersmanager_info') !== false)
function ($component) use($user) {
if (self::checkJson($component->params) && strpos($component->params, 'activate_membersmanager_info') !== false
&& $user->authorise('form.access', $component->element))
{
// check if this component is active
$component->params = json_decode($component->params);
@ -4078,6 +4436,8 @@ abstract class MembersmanagerHelper
*/
protected static function setAssessmentComponents()
{
// filter per user access
$user = JFactory::getUser();
$db = JFactory::getDBO();
// get components
$query = $db->getQuery(true);
@ -4094,8 +4454,9 @@ abstract class MembersmanagerHelper
// filter out the components we need
$listComponents = array_filter(
$listComponents,
function ($component) {
if (self::checkJson($component->params) && strpos($component->params, 'activate_membersmanager_assessment') !== false)
function ($component) use($user) {
if (self::checkJson($component->params) && strpos($component->params, 'activate_membersmanager_assessment') !== false
&& $user->authorise('form.access', $component->element))
{
// check if this component is active
$component->params = json_decode($component->params);
@ -4167,6 +4528,8 @@ abstract class MembersmanagerHelper
return false;
}
);
// get user object
$user = JFactory::getUser();
// get the database object
$db = JFactory::getDBO();
// set the tabs
@ -4190,14 +4553,18 @@ abstract class MembersmanagerHelper
$tables = array();
foreach ($component as $_nr => $comp)
{
if (($ids = self::getVars('form', $item->id, $view, 'id', 'IN', str_replace('com_', '', $comp->element))) !== false && self::checkArray($ids))
// first check access
if ($user->authorise('form.edit', $comp->element))
{
// load the table
$tables[] = self::getTabLinksTable($ids, $item, $comp, $view, $return, $db);
}
elseif (($tmp = self::getTabLinksTable(null, $item, $comp, $view, $return, $db)) !== false)
{
$tables[] = $tmp;
if (($ids = self::getVars('form', $item->id, $view, 'id', 'IN', str_replace('com_', '', $comp->element))) !== false && self::checkArray($ids))
{
// load the table
$tables[] = self::getTabLinksTable($ids, $item, $comp, $view, $return, $db);
}
elseif (($tmp = self::getTabLinksTable(null, $item, $comp, $view, $return, $db)) !== false)
{
$tables[] = $tmp;
}
}
}
// load the tables to the layout
@ -4225,7 +4592,7 @@ abstract class MembersmanagerHelper
$layout = array();
}
}
elseif (self::checkObject($component) && isset($component->element))
elseif (self::checkObject($component) && isset($component->element) && $user->authorise('form.edit', $component->element))
{
if (($id = self::getVar('form', $item->id, $view, 'id', '=', str_replace('com_', '', $component->element))) === false) // get item ID
{
@ -4398,6 +4765,7 @@ abstract class MembersmanagerHelper
* @param int $id The item id
* @param object $component The target component details
* @param array $document The document array to load script
* @param array $footer The document footer array to load scripts
*
* @return string
*
@ -4439,6 +4807,7 @@ abstract class MembersmanagerHelper
*
* @param object $component The target component
* @param array $document The document array to load script
* @param array $footer The document footer array to load scripts
*
* @return string
*
@ -4688,9 +5057,24 @@ abstract class MembersmanagerHelper
return false;
}
);
// set type if not set
if (!isset($data['type']) && $view == 'member')
{
$data['type'] = self::getVar($view, $data['id'], 'id', 'type');
}
// set account if not set
if (!isset($data['account']) && $view == 'member')
{
$data['account'] = self::getVar($view, $data['id'], 'id', 'account');
}
// check if we have methods
if (self::checkArray($methods) && isset($data['type'], $data['account']))
{
// get the global settings
if (!self::checkObject(self::$params))
{
self::$params = JComponentHelper::getParams('com_membersmanager');
}
// get the app object
$app = JFactory::getApplication();
// get the post object
@ -4699,7 +5083,7 @@ abstract class MembersmanagerHelper
$user = JFactory::getUser();
// get the database object
$db = JFactory::getDBO();
// start looping the metods
// start looping the methods
foreach ($methods as $method)
{
// get components
@ -4722,10 +5106,15 @@ abstract class MembersmanagerHelper
// check if user are allowed to edit form values or create form values
if (self::checkArray($_data))
{
// get the local params
$params = JComponentHelper::getParams($_component);
// make sure the ID is set
if (!isset($_data['id']) || !is_numeric($_data['id']))
if (!isset($_data['id']) || !is_numeric($_data['id']) || $_data['id'] == 0)
{
// set id to zero as this will cause new item to be created
$_data['id'] = 0;
// set default access
$_data['access'] = $params->get('default_accesslevel', self::$params->get('default_accesslevel', 1));
}
// check if user may edit
if ($_data['id'] > 0 && !$user->authorise('form.edit', $_component . '.form.' . (int) $_data['id']))
@ -4794,7 +5183,7 @@ abstract class MembersmanagerHelper
continue;
}
// remove all fields not part of the allowed edit fields
if (($fields = JComponentHelper::getParams($_component)->get('edit_fields', false)) !== false && self::checkObject($fields))
if (($fields = $params->get('edit_fields', false)) !== false && self::checkObject($fields))
{
// build a fields array bucket
$fieldActive = array();
@ -4810,6 +5199,7 @@ abstract class MembersmanagerHelper
$fieldActive['created_by'] = 'created_by';
$fieldActive['modified'] = 'modified';
$fieldActive['modified_by'] = 'modified_by';
$fieldActive['access'] = 'access';
$fieldActive['version'] = 'version';
$fieldActive['rules'] = 'rules';
// get the database columns of this table
@ -5109,6 +5499,95 @@ abstract class MembersmanagerHelper
}
/**
* bc math wrapper (very basic not for accounting)
*
* @param string $type The type bc math
* @param int $val1 The first value
* @param int $val2 The second value
* @param int $scale The scale value
*
* @return int
*
*/
public static function bcmath($type, $val1, $val2, $scale = 0)
{
// build function name
$function = 'bc' . $type;
// use the bcmath function if available
if (function_exists($function))
{
return $function($val1, $val2, $scale);
}
// if function does not exist we use +-*/ operators (fallback - not ideal)
switch ($type)
{
// Multiply two numbers
case 'mul':
return (string) round($val1 * $val2, $scale);
break;
// Divide of two numbers
case 'div':
return (string) round($val1 / $val2, $scale);
break;
// Adding two numbers
case 'add':
return (string) round($val1 + $val2, $scale);
break;
// Subtract one number from the other
case 'sub':
return (string) round($val1 - $val2, $scale);
break;
// Raise an arbitrary precision number to another
case 'pow':
return (string) round(pow($val1, $val2), $scale);
break;
// Compare two arbitrary precision numbers
case 'comp':
return (round($val1,2) == round($val2,2));
break;
}
return false;
}
/**
* Basic sum of an array with more precision
*
* @param array $array The values to sum
* @param int $scale The scale value
*
* @return float
*
*/
public static function bcsum($array, $scale = 4)
{
// use the bcadd function if available
if (function_exists('bcadd'))
{
// set the start value
$value = 0.0;
// loop the values and run bcadd
foreach($array as $val)
{
$value = bcadd($value, $val, $scale);
}
return $value;
}
// fall back on array sum
return array_sum($array);
}
/**
* get Core Name
*
* @return string the core component name
*
*/
public static function getCoreName()
{
return 'membersmanager';
}
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
{
// do some table foot work

View File

@ -5,11 +5,12 @@ COM_MEMBERSMANAGER_ACCESS_S_S="Access %s %s"
COM_MEMBERSMANAGER_ADD="Add"
COM_MEMBERSMANAGER_ADD_ONE_OF_THESE_PLACEHOLDERS_IN_TEXT_FOR_CUSTOM_DOWNLOAD_PLACEMENT="Add one of these placeholders in text for custom download placement"
COM_MEMBERSMANAGER_ALLOWED_IMAGE_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR="Allowed image formats are not set in the global settings, please notify your system administrator."
COM_MEMBERSMANAGER_ALL_THE_USERS_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED_INTO_RELATED_MEMBER_TYPE_RELATIONSHIPS="All the users found in Joomla were successfully imported into related member type relationships."
COM_MEMBERSMANAGER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?"
COM_MEMBERSMANAGER_BACK="Back"
COM_MEMBERSMANAGER_BACK_TO_CPANEL="Back to cPanel"
COM_MEMBERSMANAGER_BSB_IS_ALREADY_IN_USE_PLEASE_TRY_ANOTHER="<b>%s</b> is already in use, please try another!"
COM_MEMBERSMANAGER_CLOSE="Close"
COM_MEMBERSMANAGER_CORE_PLACEHOLDERS="Core Placeholders"
COM_MEMBERSMANAGER_COULD_NOT_UPLOAD_THE_FILE="Could not upload the file!"
COM_MEMBERSMANAGER_CPANEL="cPanel"
COM_MEMBERSMANAGER_CPANEL_DESC="Control Panel for Members"
@ -24,6 +25,8 @@ COM_MEMBERSMANAGER_GO_BACK="go Back"
COM_MEMBERSMANAGER_GREAT_SS_IS_AVAILABLE="Great, %s(%s) is available!"
COM_MEMBERSMANAGER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BMEMBERSMANAGERB_WILL_NOT_FUNCTION_CORRECTLYP="<h2>Curl Not Found!</h2><p>Please setup curl on your system, or <b>membersmanager</b> will not function correctly!</p>"
COM_MEMBERSMANAGER_IMAGE="Image"
COM_MEMBERSMANAGER_IMPORT_JOOMLA_USERS="Import Joomla Users"
COM_MEMBERSMANAGER_IMPORT_SUCCESS="Import Success!"
COM_MEMBERSMANAGER_LOADING="Loading"
COM_MEMBERSMANAGER_LOGIN_MODULE_POSITION="Login Module Position"
COM_MEMBERSMANAGER_MAIN_MEMBER="Main Member"
@ -149,6 +152,8 @@ COM_MEMBERSMANAGER_MEMBER_VERSION_DESC="A count of the number of times this Memb
COM_MEMBERSMANAGER_MEMBER_VERSION_LABEL="Revision"
COM_MEMBERSMANAGER_MEMBER_WAS_CREATED_SUCCESSFULLY_AND_THE_LOGIN_DETAILS_WAS_EMAILED_TO_THE_MEMBER="Member was created successfully, and the login details was emailed to the member."
COM_MEMBERSMANAGER_MEMBER_WAS_NOT_ADDED_TO_ANY_GROUPS_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="Member was not added to any groups. Please inform your system administrator."
COM_MEMBERSMANAGER_MESSAGE="Message"
COM_MEMBERSMANAGER_MESSAGES="Messages"
COM_MEMBERSMANAGER_NEW="New"
COM_MEMBERSMANAGER_NOT_AUTHORISED_TO_VIEW_CPANEL="Not authorised to view cpanel!"
COM_MEMBERSMANAGER_NOT_AUTHORISED_TO_VIEW_MEMBERS="Not authorised to view members!"
@ -156,14 +161,20 @@ COM_MEMBERSMANAGER_NOT_AUTHORISED_TO_VIEW_PROFILE="Not authorised to view profil
COM_MEMBERSMANAGER_NOT_ENOUGH_DATA="Not enough data"
COM_MEMBERSMANAGER_NOT_FOUND_OR_ACCESS_DENIED="Not found or access denied!"
COM_MEMBERSMANAGER_NO_ACCESS_GRANTED="No Access Granted!"
COM_MEMBERSMANAGER_NO_ACCESS_TO_VIEW_DETAILS="No Access to View Details"
COM_MEMBERSMANAGER_NO_DETAILS_FOUND="No Details Found"
COM_MEMBERSMANAGER_NO_FORMS_FOUND="No Forms Found"
COM_MEMBERSMANAGER_NO_IMPORT_FILE_SELECTED="No import file selected."
COM_MEMBERSMANAGER_NO_MEMBER_TYPES_ARE_SET_PLEASE_SET_SOME_AND_TRY_AGAIN="No member types are set, please set some and try again."
COM_MEMBERSMANAGER_NO_MEMBER_WAS_FOUND="No member was found"
COM_MEMBERSMANAGER_NO_MESSAGES="No messages"
COM_MEMBERSMANAGER_NO_PROFILE_FOUND="No Profile Found"
COM_MEMBERSMANAGER_NO_REPORTS_FOUND="No reports found"
COM_MEMBERSMANAGER_NO_S_FOUND="No %s found"
COM_MEMBERSMANAGER_NO_S_FOUND_IN_S="No %s found in %s"
COM_MEMBERSMANAGER_NO_TEMPLATE_FOR_BSB_WERE_FOUND="No template for <b>%s</b> were found"
COM_MEMBERSMANAGER_NO_USERS_WERE_FOUND_THAT_MATCH_THE_TARGET_GROUPS_SET_IN_THE_MEMBER_TYPES="No users were found that match the target groups set in the member types."
COM_MEMBERSMANAGER_ONLY_ONE_THOUSAND_MEMBERS_CAN_BE_IMPORTED_AT_A_TIME_SINCE_YOU_HAVE_MORE_THEN_ONE_THOUSAND_USERS_YOU_WILL_NEED_TO_RUN_THE_IMPORT_AGAIN_UNTIL_YOU_SEE_A_GREEN_SUCCESS_MESSAGE="Only 1000 members can be imported at a time. Since you have more then 1000 users, you will need to run the import again until you see a green success message!"
COM_MEMBERSMANAGER_OPEN="Open"
COM_MEMBERSMANAGER_OPEN_CPANEL="Open cPanel"
COM_MEMBERSMANAGER_OPEN_MAIN_MEMBER_PROFILE="Open Main Member Profile"
@ -187,6 +198,7 @@ COM_MEMBERSMANAGER_S_DATA_COULD_NOT_BE_SAVED="%s data could not be saved"
COM_MEMBERSMANAGER_S_OPTIONS="%s Options"
COM_MEMBERSMANAGER_THERE_HAS_BEEN_AN_ERROR="There has been an error."
COM_MEMBERSMANAGER_THERE_WAS_AN_ERROR_PLEASE_TRY_AGAIN_LATER_IF_THIS_ERROR_CONTINUES_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="There was an error, please try again later. If this error continues, contact your system administrator."
COM_MEMBERSMANAGER_THERE_WAS_NO_MESSAGES_FOUND="There was no messages found!"
COM_MEMBERSMANAGER_THERE_WAS_NO_REPORT_FOUND="There was no report found!"
COM_MEMBERSMANAGER_THE_PROFILE_WILL_BE_CROPPED_TO_THIS_SIZE="The profile will be cropped to this size"
COM_MEMBERSMANAGER_TIME_STAMP="Time Stamp"
@ -195,6 +207,7 @@ COM_MEMBERSMANAGER_WARNING_IMPORT_FILE_ERROR="Warning, import file error."
COM_MEMBERSMANAGER_WARNING_IMPORT_UPLOAD_ERROR="Warning, import upload error."
COM_MEMBERSMANAGER_YOU_CAN_NOT_DELETE_BSB_FIRST_MOVE_ALL_SUB_ACCOUNTS_TO_NEW_MAIN_MEMBER="You can not delete <b>%s</b>, first move all sub account/s to new main member."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_ADD_DATA_TO_S_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to add data to %s, please contact your system administrator."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_CREATE_MEMBERS="You do not have permission to create members."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_S_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to edit %s, please contact your system administrator."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_THIS_MEMBER_RELATIONSHIPS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to edit this member relationships, please contact your system administrator."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_THIS_MEMBER_TYPE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to edit this member type, please contact your system administrator."

View File

@ -0,0 +1,29 @@
<?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('Restricted access');
?>
<div class="control-group">
<div class="controls"><?php echo $displayData->input;?></div>
</div>
<div id="members_found"></div>
<script type="text/javascript">
jQuery(function($) {
$('#member_search').keyup(function(e) {
var value = $(this).val();
searchMembers(value);
});
});
</script>

View File

@ -0,0 +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
defined('JPATH_BASE') or die('Restricted access');
?>
<a class="uk-button uk-button-primary uk-width-1-1" href="<?php echo JURI::root(); ?>index.php?option=com_membersmanager&view=members&task=member.edit&return=<?php echo urlencode(base64_encode((string) JUri::getInstance())); ?>">
<span uk-icon="icon: plus"></span> <?php echo JText::_('COM_MEMBERSMANAGER_CREATE'); ?>
</a>

View File

@ -0,0 +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
defined('JPATH_BASE') or die('Restricted access');
?>
<a class="uk-button uk-button-success uk-width-1-1" href="<?php echo JURI::root(); ?>index.php?option=com_membersmanager&view=members&task=member.edit&return=<?php echo urlencode(base64_encode((string) JUri::getInstance())); ?>">
<i class="uk-icon-plus"></i> <?php echo JText::_('COM_MEMBERSMANAGER_CREATE'); ?>
</a>

View File

@ -28,9 +28,10 @@ else
{
$updated = false;
}
$tracker = 0;
?>
<?php if (isset($displayData['data']) && MembersmanagerHelper::checkArray($displayData['data'])) :?>
<?php if (isset($displayData['data']) && MembersmanagerHelper::checkArray($displayData['data'])): ?>
<ul class="uk-list uk-list-striped">
<?php foreach ($displayData['data'] as $name => $value): ?>
<?php if (!in_array($name, $notDisplay) && (MembersmanagerHelper::checkString($value) || is_numeric($value)) && $displayData['user']->authorise('form.view.' . $name, $displayData['com'] . '.form.' . (int) $displayData['data']['id'])): ?>
@ -44,13 +45,16 @@ else
}
?>
<li><?php echo $label; ?>: <b><?php echo $value; ?></b></li>
<?php $tracker++; ?>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php if ($updated > 0 && $tracker > 0): ?>
<br />
<small><?php echo JText::_('COM_MEMBERSMANAGER_TIME_STAMP'); ?>: <?php echo MembersmanagerHelper::fancyDateTime($updated); ?></small>
<?php else: ?>
<small><?php echo JText::_('COM_MEMBERSMANAGER_NO_ACCESS_TO_VIEW_DETAILS'); ?>...</small>
<?php endif; ?>
<?php else: ?>
<small><?php echo JText::_('COM_MEMBERSMANAGER_NO_DETAILS_FOUND'); ?>...</small>
<?php endif; ?>
<?php if ($updated > 0) :?>
<br />
<small><?php echo JText::_('COM_MEMBERSMANAGER_TIME_STAMP'); ?>: <?php echo MembersmanagerHelper::fancyDateTime($updated); ?></small>
<?php endif; ?>

View File

@ -14,14 +14,20 @@ defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
$fields = array(
$fields = $displayData->get('fields') ?: array(
'token',
'account'
'account',
'user'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
?>
<div class="form-inline form-inline-header">
<?php foreach($fields as $field){
echo $form->renderField($field);
} ?>
<?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>

View File

@ -30,20 +30,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -20,20 +20,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -12,11 +12,9 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
'user',
'created',
'created_by',
'modified',
@ -25,20 +23,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -12,7 +12,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
@ -26,20 +25,10 @@ $fields = $displayData->get('fields') ?: array(
$hiddenFields = $displayData->get('hidden_fields') ?: array();
foreach ($fields as $field)
{
$field = is_array($field) ? $field : array($field);
foreach ($field as $f)
{
if ($form->getField($f))
{
if (in_array($f, $hiddenFields))
{
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}
?>
<?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; ?>

View File

@ -28,35 +28,38 @@ if ($displayData->setAssessment)
$displayData->assessments[$_name] = array();
foreach ($assessment as $_nr => $assess)
{
$displayData->assessments[$_name][$_nr] = MembersmanagerHelper::getAnyFormDetails($displayData->id, 'member', $assess->element, 'object', 'profile');
if (MembersmanagerHelper::checkArray($displayData->assessments[$_name][$_nr]))
if ($displayData->_USER->authorise('form.report.viewtab', $assess->element))
{
foreach ($displayData->assessments[$_name][$_nr] as $_pointer => &$value)
$displayData->assessments[$_name][$_nr] = MembersmanagerHelper::getAnyFormDetails($displayData->id, 'member', $assess->element, 'object', 'profile');
if (MembersmanagerHelper::checkArray($displayData->assessments[$_name][$_nr]))
{
if (isset($value->name) && MembersmanagerHelper::checkString($value->name))
foreach ($displayData->assessments[$_name][$_nr] as $_pointer => &$value)
{
$value->name = $assess->name . ' - ' . $value->name;
if (isset($value->name) && MembersmanagerHelper::checkString($value->name))
{
$value->name = $assess->name . ' - ' . $value->name;
}
else
{
$value->name = $assess->name;
}
}
}
elseif (MembersmanagerHelper::checkObject($displayData->assessments[$_name][$_nr]))
{
if (isset($displayData->assessments[$_name][$_nr]->name) && MembersmanagerHelper::checkString($displayData->assessments[$_name][$_nr]->name))
{
$displayData->assessments[$_name][$_nr]->name = $assess->name . ' - ' . $displayData->assessments[$_name][$_nr]->name;
}
else
{
$value->name = $assess->name;
$displayData->assessments[$_name][$_nr]->name = $assess->name;
}
}
}
elseif (MembersmanagerHelper::checkObject($displayData->assessments[$_name][$_nr]))
{
if (isset($displayData->assessments[$_name][$_nr]->name) && MembersmanagerHelper::checkString($displayData->assessments[$_name][$_nr]->name))
{
$displayData->assessments[$_name][$_nr]->name = $assess->name . ' - ' . $displayData->assessments[$_name][$_nr]->name;
}
else
{
$displayData->assessments[$_name][$_nr]->name = $assess->name;
}
}
}
}
elseif (MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
elseif ($displayData->_USER->authorise('form.report.viewtab', $assessment->element) && MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
{
$displayData->assessments[$_name] = MembersmanagerHelper::getAnyFormDetails($displayData->id, 'member', $assessment->element, 'object', 'profile');
if (MembersmanagerHelper::checkObject($displayData->assessments[$_name]))
@ -76,13 +79,15 @@ if ($displayData->setAssessment)
?>
<?php if ($displayData->setAssessment) : ?>
<?php if (MembersmanagerHelper::checkString($displayData->type_name) && $displayData->_USER->authorise('member.view.type', 'com_membersmanager.member.' . (int) $displayData->id)) : ?>
<?php if (isset($displayData->type_name) && MembersmanagerHelper::checkString($displayData->type_name) && $displayData->_USER->authorise('member.view.type', 'com_membersmanager.member.' . (int) $displayData->id)) : ?>
<h5><?php echo JText::sprintf('COM_MEMBERSMANAGER_ACCESS_S_S', MembersmanagerHelper::safeString($displayData->type_name, 'W'), implode(', ', (array) array_keys($displayData->assessmentAvailable))); ?></h5>
<?php else: ?>
<h5><?php echo JText::sprintf('COM_MEMBERSMANAGER_ACCESS_MEMBER_S', implode(', ', (array) array_keys($displayData->assessmentAvailable))); ?></h5>
<?php endif; ?>
<?php echo JLayoutHelper::render('profilebuttons_uikit_three', $displayData); ?>
<?php echo JLayoutHelper::render('profileextra_uikit_three', $displayData); ?>
<?php if ($displayData->_USER->id > 0): ?>
<?php echo JLayoutHelper::render('profilebuttons_uikit_three', $displayData); ?>
<?php echo JLayoutHelper::render('profileextra_uikit_three', $displayData); ?>
<?php endif; ?>
<?php echo JLayoutHelper::render('profilereports_uikit_three', $displayData); ?>
<?php echo JLayoutHelper::render('profileassessmentselection_uikit_three', $displayData); ?>
<?php else: ?>

View File

@ -28,35 +28,38 @@ if ($displayData->setAssessment)
$displayData->assessments[$_name] = array();
foreach ($assessment as $_nr => $assess)
{
$displayData->assessments[$_name][$_nr] = MembersmanagerHelper::getAnyFormDetails($displayData->id, 'member', $assess->element, 'object', 'profile');
if (MembersmanagerHelper::checkArray($displayData->assessments[$_name][$_nr]))
if ($displayData->_USER->authorise('form.report.viewtab', $assess->element))
{
foreach ($displayData->assessments[$_name][$_nr] as $_pointer => &$value)
$displayData->assessments[$_name][$_nr] = MembersmanagerHelper::getAnyFormDetails($displayData->id, 'member', $assess->element, 'object', 'profile');
if (MembersmanagerHelper::checkArray($displayData->assessments[$_name][$_nr]))
{
if (isset($value->name) && MembersmanagerHelper::checkString($value->name))
foreach ($displayData->assessments[$_name][$_nr] as $_pointer => &$value)
{
$value->name = $assess->name . ' - ' . $value->name;
if (isset($value->name) && MembersmanagerHelper::checkString($value->name))
{
$value->name = $assess->name . ' - ' . $value->name;
}
else
{
$value->name = $assess->name;
}
}
}
elseif (MembersmanagerHelper::checkObject($displayData->assessments[$_name][$_nr]))
{
if (isset($displayData->assessments[$_name][$_nr]->name) && MembersmanagerHelper::checkString($displayData->assessments[$_name][$_nr]->name))
{
$displayData->assessments[$_name][$_nr]->name = $assess->name . ' - ' . $displayData->assessments[$_name][$_nr]->name;
}
else
{
$value->name = $assess->name;
$displayData->assessments[$_name][$_nr]->name = $assess->name;
}
}
}
elseif (MembersmanagerHelper::checkObject($displayData->assessments[$_name][$_nr]))
{
if (isset($displayData->assessments[$_name][$_nr]->name) && MembersmanagerHelper::checkString($displayData->assessments[$_name][$_nr]->name))
{
$displayData->assessments[$_name][$_nr]->name = $assess->name . ' - ' . $displayData->assessments[$_name][$_nr]->name;
}
else
{
$displayData->assessments[$_name][$_nr]->name = $assess->name;
}
}
}
}
elseif (MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
elseif ($displayData->_USER->authorise('form.report.viewtab', $assessment->element) && MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
{
$displayData->assessments[$_name] = MembersmanagerHelper::getAnyFormDetails($displayData->id, 'member', $assessment->element, 'object', 'profile');
if (MembersmanagerHelper::checkObject($displayData->assessments[$_name]))
@ -76,13 +79,15 @@ if ($displayData->setAssessment)
?>
<?php if ($displayData->setAssessment) : ?>
<?php if (MembersmanagerHelper::checkString($displayData->type_name) && $displayData->_USER->authorise('member.view.type', 'com_membersmanager.member.' . (int) $displayData->id)) : ?>
<?php if (isset($displayData->type_name) && MembersmanagerHelper::checkString($displayData->type_name) && $displayData->_USER->authorise('member.view.type', 'com_membersmanager.member.' . (int) $displayData->id)) : ?>
<h5><?php echo JText::sprintf('COM_MEMBERSMANAGER_ACCESS_S_S', MembersmanagerHelper::safeString($displayData->type_name, 'W'), implode(', ', (array) array_keys($displayData->assessmentAvailable))); ?></h5>
<?php else: ?>
<h5><?php echo JText::sprintf('COM_MEMBERSMANAGER_ACCESS_MEMBER_S', implode(', ', (array) array_keys($displayData->assessmentAvailable))); ?></h5>
<?php endif; ?>
<?php echo JLayoutHelper::render('profilebuttons_uikit_two', $displayData); ?>
<?php echo JLayoutHelper::render('profileextra_uikit_two', $displayData); ?>
<?php if ($displayData->_USER->id > 0): ?>
<?php echo JLayoutHelper::render('profilebuttons_uikit_two', $displayData); ?>
<?php echo JLayoutHelper::render('profileextra_uikit_two', $displayData); ?>
<?php endif; ?>
<?php echo JLayoutHelper::render('profilereports_uikit_two', $displayData); ?>
<?php echo JLayoutHelper::render('profileassessmentselection_uikit_two', $displayData); ?>
<?php else: ?>

View File

@ -15,23 +15,38 @@ defined('JPATH_BASE') or die('Restricted access');
?>
<div id="assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>" uk-offcanvas="mode: push; overlay: true; flip: true">
<div id="assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>" uk-offcanvas="mode: reveal; overlay: true; flip: true">
<div class="uk-offcanvas-bar uk-flex uk-flex-column">
<ul class="uk-nav uk-nav-primary uk-nav-center uk-margin-auto-vertical">
<?php foreach ($displayData->assessmentAvailable as $typeAssesmentName => $components) : ?>
<?php if (MembersmanagerHelper::checkArray($components) || MembersmanagerHelper::checkObject($components)): ?>
<li class="uk-nav-header"><?php echo JText::sprintf('COM_MEMBERSMANAGER_S_OPTIONS', $typeAssesmentName); ?></li>
<?php if (MembersmanagerHelper::checkArray($components)): ?>
<?php $has = 0; ?>
<?php foreach ($components as $component) : ?>
<li><a href="index.php?option=<?php echo $component->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $component->name; ?></a></li>
<?php if ($displayData->_USER->authorise('form.create', $component->element)): ?>
<li><a href="index.php?option=<?php echo $component->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $component->name; ?></a></li>
<?php $has++; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($has == 0): ?>
<li><a href="#"><?php echo JText::_('COM_MEMBERSMANAGER_NO_FORMS_FOUND'); ?></a></li>
<?php endif; ?>
<?php elseif (MembersmanagerHelper::checkObject($components)): ?>
<?php $has = 0; ?>
<?php if (($id = MembersmanagerHelper::getVar('form', $displayData->id, 'member', 'id', '=', str_replace("com_", "", $components->element))) !== false): ?>
<?php if (($link = MembersmanagerHelper::getEditURL($id, 'form', 'form', '&return=' . $displayData->return_path, $components->element)) !== false): ?>
<li><a href="<?php echo $link; ?>"><?php echo $components->name; ?></a></li>
<?php $has++; ?>
<?php endif; ?>
<?php else: ?>
<li><a href="index.php?option=<?php echo $components->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $components->name; ?></a></li>
<?php if ($displayData->_USER->authorise('form.create', $components->element)): ?>
<li><a href="index.php?option=<?php echo $components->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $components->name; ?></a></li>
<?php $has++; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($has == 0): ?>
<li><a href="#"><?php echo JText::_('COM_MEMBERSMANAGER_NO_FORMS_FOUND'); ?></a></li>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>

View File

@ -22,16 +22,31 @@ defined('JPATH_BASE') or die('Restricted access');
<?php if (MembersmanagerHelper::checkArray($components) || MembersmanagerHelper::checkObject($components)): ?>
<li class="uk-nav-header"><?php echo JText::sprintf('COM_MEMBERSMANAGER_S_OPTIONS', $typeAssesmentName); ?></li>
<?php if (MembersmanagerHelper::checkArray($components)): ?>
<?php $has = 0; ?>
<?php foreach ($components as $component) : ?>
<li><a href="index.php?option=<?php echo $component->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $component->name; ?></a></li>
<?php if ($displayData->_USER->authorise('form.create', $component->element)): ?>
<li><a href="index.php?option=<?php echo $component->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $component->name; ?></a></li>
<?php $has++; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($has == 0): ?>
<li><a href="#"><?php echo JText::_('COM_MEMBERSMANAGER_NO_FORMS_FOUND'); ?></a></li>
<?php endif; ?>
<?php elseif (MembersmanagerHelper::checkObject($components)): ?>
<?php $has = 0; ?>
<?php if (($id = MembersmanagerHelper::getVar('form', $displayData->id, 'member', 'id', '=', str_replace("com_", "", $components->element))) !== false): ?>
<?php if (($link = MembersmanagerHelper::getEditURL($id, 'form', 'form', '&return=' . $displayData->return_path, $components->element)) !== false): ?>
<li><a href="<?php echo $link; ?>"><?php echo $components->name; ?></a></li>
<?php $has++; ?>
<?php endif; ?>
<?php else: ?>
<li><a href="index.php?option=<?php echo $components->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $components->name; ?></a></li>
<?php if ($displayData->_USER->authorise('form.create', $components->element)): ?>
<li><a href="index.php?option=<?php echo $components->element; ?>&view=form&field=member&field_id=<?php echo $displayData->id; ?>&layout=edit&return=<?php echo $displayData->return_path; ?>"><?php echo $components->name; ?></a></li>
<?php $has++; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($has == 0): ?>
<li><a href="#"><?php echo JText::_('COM_MEMBERSMANAGER_NO_FORMS_FOUND'); ?></a></li>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>

View File

@ -15,24 +15,26 @@ defined('JPATH_BASE') or die('Restricted access');
?>
<div class="uk-button-group uk-width-1-1">
<?php if (($communicate_url = MembersmanagerHelper::communicate('create_url', false, '&field=member&field_id=' . $displayData->id)) !== false) : ?>
<button class="uk-button uk-width-1-3 uk-button-primary uk-button-small" type="button" uk-toggle="target: #assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>">
<span uk-icon="icon: pencil"></span> <?php echo MembersmanagerHelper::getButtonName('forms', JText::_('COM_MEMBERSMANAGER_FORMS')); ?>
</button>
<button class="uk-button uk-width-1-3 uk-button-primary uk-button-small" type="button" uk-toggle="target: .extra<?php echo $displayData->id; ?>">
<span uk-icon="icon: heart"></span> <?php echo MembersmanagerHelper::getButtonName('report', JText::_('COM_MEMBERSMANAGER_REPORTS')); ?>
</button>
<a class="uk-button uk-width-1-3 uk-button-primary uk-button-small" href="<?php echo $communicate_url; ?>">
<span uk-icon="icon: mail"></span> <?php echo MembersmanagerHelper::communicate('form_name', JText::_('COM_MEMBERSMANAGER_SEND_REPORT')); ?>
</a>
<?php else: ?>
<button class="uk-button uk-width-1-2 uk-button-primary uk-button-small" type="button" uk-toggle="target: #assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>">
<span uk-icon="icon: pencil"></span> <?php echo MembersmanagerHelper::getButtonName('forms', JText::_('COM_MEMBERSMANAGER_FORMS')); ?>
</button>
<button class="uk-button uk-width-1-2 uk-button-primary uk-button-small" type="button" uk-toggle="target: .extra<?php echo $displayData->id; ?>">
<span uk-icon="icon: heart"></span> <?php echo MembersmanagerHelper::getButtonName('report', JText::_('COM_MEMBERSMANAGER_REPORTS')); ?>
</button>
<?php endif; ?>
</div>
<br /><br />
<?php if ($displayData->_USER->id > 0): ?>
<div class="uk-button-group uk-width-1-1">
<?php if (($communicate_url = MembersmanagerHelper::communicate('create_url', false, '&field=member&field_id=' . $displayData->id)) !== false) : ?>
<button class="uk-button uk-width-1-3 uk-button-primary uk-button-small" type="button" uk-toggle="target: #assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>">
<span uk-icon="icon: pencil"></span> <?php echo MembersmanagerHelper::getButtonName('forms', JText::_('COM_MEMBERSMANAGER_FORMS')); ?>
</button>
<button class="uk-button uk-width-1-3 uk-button-primary uk-button-small" type="button" uk-toggle="target: .extra<?php echo $displayData->id; ?>">
<span uk-icon="icon: heart"></span> <?php echo MembersmanagerHelper::getButtonName('report', JText::_('COM_MEMBERSMANAGER_REPORTS')); ?>
</button>
<a class="uk-button uk-width-1-3 uk-button-primary uk-button-small" href="<?php echo $communicate_url; ?>">
<span uk-icon="icon: mail"></span> <?php echo MembersmanagerHelper::communicate('form_name', JText::_('COM_MEMBERSMANAGER_SEND_REPORT')); ?>
</a>
<?php else: ?>
<button class="uk-button uk-width-1-2 uk-button-primary uk-button-small" type="button" uk-toggle="target: #assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>">
<span uk-icon="icon: pencil"></span> <?php echo MembersmanagerHelper::getButtonName('forms', JText::_('COM_MEMBERSMANAGER_FORMS')); ?>
</button>
<button class="uk-button uk-width-1-2 uk-button-primary uk-button-small" type="button" uk-toggle="target: .extra<?php echo $displayData->id; ?>">
<span uk-icon="icon: heart"></span> <?php echo MembersmanagerHelper::getButtonName('report', JText::_('COM_MEMBERSMANAGER_REPORTS')); ?>
</button>
<?php endif; ?>
</div>
<br /><br />
<?php endif; ?>

View File

@ -15,24 +15,26 @@ defined('JPATH_BASE') or die('Restricted access');
?>
<div class="uk-button-group uk-width-1-1">
<?php if (($communicate_url = MembersmanagerHelper::communicate('create_url', false, '&field=member&field_id=' . $displayData->id)) !== false) : ?>
<a class="uk-button uk-width-1-3 uk-button-primary uk-button-small" href="#assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>" data-uk-offcanvas="{mode:'slide'}">
<i class="uk-icon-check-square-o"></i> <?php echo MembersmanagerHelper::getButtonName('forms', JText::_('COM_MEMBERSMANAGER_FORMS')); ?>
</a>
<button class="uk-button uk-width-1-3 uk-button-primary uk-button-small" data-uk-toggle="{target:'.extra<?php echo $displayData->id; ?>'}">
<i class="uk-icon-bar-chart"></i> <?php echo MembersmanagerHelper::getButtonName('report', JText::_('COM_MEMBERSMANAGER_REPORTS')); ?>
</button>
<a class="uk-button uk-width-1-3 uk-button-primary uk-button-small" href="<?php echo $communicate_url; ?>">
<i class="uk-icon-paper-plane"></i> <?php echo MembersmanagerHelper::communicate('form_name', JText::_('COM_MEMBERSMANAGER_SEND_REPORT')); ?>
</a>
<?php else : ?>
<a class="uk-button uk-width-1-2 uk-button-primary uk-button-small" href="#assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>" data-uk-offcanvas="{mode:'slide'}">
<i class="uk-icon-check-square-o"></i> <?php echo MembersmanagerHelper::getButtonName('forms', JText::_('COM_MEMBERSMANAGER_FORMS')); ?>
</a>
<button class="uk-button uk-width-1-2 uk-button-primary uk-button-small" data-uk-toggle="{target:'.extra<?php echo $displayData->id; ?>'}">
<i class="uk-icon-bar-chart"></i> <?php echo MembersmanagerHelper::getButtonName('report', JText::_('COM_MEMBERSMANAGER_REPORTS')); ?>
</button>
<?php endif; ?>
</div>
<br /><br />
<?php if ($displayData->_USER->id > 0): ?>
<div class="uk-button-group uk-width-1-1">
<?php if (($communicate_url = MembersmanagerHelper::communicate('create_url', false, '&field=member&field_id=' . $displayData->id)) !== false) : ?>
<a class="uk-button uk-width-1-3 uk-button-primary uk-button-small" href="#assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>" data-uk-offcanvas="{mode:'reveal'}">
<i class="uk-icon-check-square-o"></i> <?php echo MembersmanagerHelper::getButtonName('forms', JText::_('COM_MEMBERSMANAGER_FORMS')); ?>
</a>
<button class="uk-button uk-width-1-3 uk-button-primary uk-button-small" data-uk-toggle="{target:'.extra<?php echo $displayData->id; ?>'}">
<i class="uk-icon-bar-chart"></i> <?php echo MembersmanagerHelper::getButtonName('report', JText::_('COM_MEMBERSMANAGER_REPORTS')); ?>
</button>
<a class="uk-button uk-width-1-3 uk-button-primary uk-button-small" href="<?php echo $communicate_url; ?>">
<i class="uk-icon-paper-plane"></i> <?php echo MembersmanagerHelper::communicate('form_name', JText::_('COM_MEMBERSMANAGER_SEND_REPORT')); ?>
</a>
<?php else : ?>
<a class="uk-button uk-width-1-2 uk-button-primary uk-button-small" href="#assess-<?php echo MembersmanagerHelper::safeString($displayData->id); ?>" data-uk-offcanvas="{mode:'slide'}">
<i class="uk-icon-check-square-o"></i> <?php echo MembersmanagerHelper::getButtonName('forms', JText::_('COM_MEMBERSMANAGER_FORMS')); ?>
</a>
<button class="uk-button uk-width-1-2 uk-button-primary uk-button-small" data-uk-toggle="{target:'.extra<?php echo $displayData->id; ?>'}">
<i class="uk-icon-bar-chart"></i> <?php echo MembersmanagerHelper::getButtonName('report', JText::_('COM_MEMBERSMANAGER_REPORTS')); ?>
</button>
<?php endif; ?>
</div>
<br /><br />
<?php endif; ?>

View File

@ -33,28 +33,31 @@ if ($displayData->setAssessment)
{
foreach ($assessment as $_nr => $assess)
{
foreach ($targets as $target)
if ($displayData->_USER->authorise('form.report.viewtab', $assess->element))
{
if (($carts = MembersmanagerHelper::getAnyAvailableCharts(null, $target, $assess->element)) !== false)
foreach ($targets as $target)
{
foreach ($carts as $key => $cartData)
if (($carts = MembersmanagerHelper::getAnyAvailableCharts(null, $target, $assess->element)) !== false)
{
if (($dataTable = MembersmanagerHelper::getAnyMultiChartDataTable($displayData->id, $target, $key, $assess->element)) !== ''
&& ($code = MembersmanagerHelper::getAnyChartCode($key . $_y, $dataTable, $cartData['details'], 'profile', $assess->element)) !== false)
foreach ($carts as $key => $cartData)
{
// load code
$displayData->charts[$_name][] = $code;
// add script to document
$document->addScriptDeclaration($code['script']);
// set loading of charts
$displayData->setCharts = true;
if (($dataTable = MembersmanagerHelper::getAnyMultiChartDataTable($displayData->id, $target, $key, $assess->element)) !== ''
&& ($code = MembersmanagerHelper::getAnyChartCode($key . $_y, $dataTable, $cartData['details'], 'profile', $assess->element)) !== false)
{
// load code
$displayData->charts[$_name][] = $code;
// add script to document
$document->addScriptDeclaration($code['script']);
// set loading of charts
$displayData->setCharts = true;
}
}
}
}
}
}
}
elseif (MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
elseif ($displayData->_USER->authorise('form.report.viewtab', $assessment->element) && MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
{
foreach ($targets as $target)
{
@ -78,9 +81,11 @@ if ($displayData->setAssessment)
}
}
}
// switch hidden state
$hidden = ($displayData->setCharts) ? '' : ' hidden';
?>
<div class="extra<?php echo $displayData->id; ?>">
<div class="extra<?php echo $displayData->id; ?>"<?php echo $hidden; ?>>
<?php if ($displayData->setCharts): ?>
<?php foreach ($displayData->charts as $name => $codes): ?>
<?php foreach ($codes as $code): ?>

View File

@ -33,28 +33,31 @@ if ($displayData->setAssessment)
{
foreach ($assessment as $_nr => $assess)
{
foreach ($targets as $target)
if ($displayData->_USER->authorise('form.report.viewtab', $assess->element))
{
if (($carts = MembersmanagerHelper::getAnyAvailableCharts(null, $target, $assess->element)) !== false)
foreach ($targets as $target)
{
foreach ($carts as $key => $cartData)
if (($carts = MembersmanagerHelper::getAnyAvailableCharts(null, $target, $assess->element)) !== false)
{
if (($dataTable = MembersmanagerHelper::getAnyMultiChartDataTable($displayData->id, $target, $key, $assess->element)) !== ''
&& ($code = MembersmanagerHelper::getAnyChartCode($key . $_y, $dataTable, $cartData['details'], 'profile', $assess->element)) !== false)
foreach ($carts as $key => $cartData)
{
// load code
$displayData->charts[$_name][] = $code;
// add script to document
$document->addScriptDeclaration($code['script']);
// set loading of charts
$displayData->setCharts = true;
if (($dataTable = MembersmanagerHelper::getAnyMultiChartDataTable($displayData->id, $target, $key, $assess->element)) !== ''
&& ($code = MembersmanagerHelper::getAnyChartCode($key . $_y, $dataTable, $cartData['details'], 'profile', $assess->element)) !== false)
{
// load code
$displayData->charts[$_name][] = $code;
// add script to document
$document->addScriptDeclaration($code['script']);
// set loading of charts
$displayData->setCharts = true;
}
}
}
}
}
}
}
elseif (MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
elseif ($displayData->_USER->authorise('form.report.viewtab', $assessment->element) && MembersmanagerHelper::checkObject($assessment) && isset($assessment->element))
{
foreach ($targets as $target)
{
@ -78,9 +81,11 @@ if ($displayData->setAssessment)
}
}
}
// switch hidden state
$hidden = ($displayData->setCharts) ? '' : ' uk-hidden';
?>
<div class="extra<?php echo $displayData->id; ?>">
<div class="extra<?php echo $displayData->id; echo $hidden; ?>">
<?php if ($displayData->setCharts): ?>
<?php foreach ($displayData->charts as $name => $codes): ?>
<?php foreach ($codes as $code): ?>

View File

@ -25,10 +25,42 @@ else
// build Meta
$meta = array();
// check if the type is to be set
if (MembersmanagerHelper::checkString($displayData->type_name) && $displayData->_USER->authorise('member.view.type', 'com_membersmanager.member.' . (int) $displayData->id))
if (isset($displayData->type_name) && MembersmanagerHelper::checkString($displayData->type_name) && $displayData->_USER->authorise('member.view.type', 'com_membersmanager.member.' . (int) $displayData->id))
{
$meta[] = $displayData->type_name;
}
// check if there is messages for this member
if (($number_messages = MembersmanagerHelper::communicate('message_number', false, $displayData->id)) !== false && $displayData->_USER->authorise('message.access', 'com_communicate'))
{
// check if we have any mages for this member
if ($number_messages > 0)
{
// set key
$messages_key = MembersmanagerHelper::lock(array('id' => $displayData->id, 'return' => $displayData->return_path));
// set the string
if ($number_messages == 1)
{
$message_name = JText::_('COM_MEMBERSMANAGER_MESSAGE');
}
else
{
$message_name = JText::_('COM_MEMBERSMANAGER_MESSAGES');
}
// load the link
if (2 == $displayData->_UIKIT)
{
$meta[] = '<a href="#getlistmessages" onclick="getListMessages(\'' . $messages_key . '\');" data-uk-offcanvas="{mode:\'reveal\'}">' . $message_name . '</a> (' . $number_messages . ')';
}
else
{
$meta[] = '<a href="#getlistmessages" onclick="getListMessages(\'' . $messages_key . '\');" uk-toggle>' . $message_name . '</a> (' . $number_messages . ')';
}
}
else
{
$meta[] = JText::_('COM_MEMBERSMANAGER_NO_MESSAGES');
}
}
// set add profile link switch
$addProfileLink = false;
// if this is a sub account load main account details
@ -49,7 +81,7 @@ if ((3 == $displayData->account || 4 == $displayData->account) && $displayData->
$addProfileLink = true;
}
// check if the edit button is to be added
$editButton = MembersmanagerHelper::getEditButton($displayData, 'member', 'members', '&ref=profile&refid=' . $displayData->_REFID, 'com_membersmanager', null);
$editButton = MembersmanagerHelper::getEditButton($displayData, 'member', 'members', '&ref=profile&refid=' . $displayData->_REFID . '&return=' . $displayData->return_path, 'com_membersmanager', null);
// set the header
$header = array();
$header[] = '<header class="uk-comment-header uk-grid-medium uk-flex-middle" uk-grid>';

View File

@ -25,10 +25,42 @@ else
// build Meta
$meta = array();
// check if the type is to be set
if (MembersmanagerHelper::checkString($displayData->type_name) && $displayData->_USER->authorise('member.view.type', 'com_membersmanager.member.' . (int) $displayData->id))
if (isset($displayData->type_name) && MembersmanagerHelper::checkString($displayData->type_name) && $displayData->_USER->authorise('member.view.type', 'com_membersmanager.member.' . (int) $displayData->id))
{
$meta[] = $displayData->type_name;
}
// check if there is messages for this member
if (($number_messages = MembersmanagerHelper::communicate('message_number', false, $displayData->id)) !== false && $displayData->_USER->authorise('message.access', 'com_communicate'))
{
// check if we have any mages for this member
if ($number_messages > 0)
{
// set key
$messages_key = MembersmanagerHelper::lock(array('id' => $displayData->id, 'return' => $displayData->return_path));
// set the string
if ($number_messages == 1)
{
$message_name = JText::_('COM_MEMBERSMANAGER_MESSAGE');
}
else
{
$message_name = JText::_('COM_MEMBERSMANAGER_MESSAGES');
}
// load the link
if (2 == $displayData->_UIKIT)
{
$meta[] = '<a href="#getlistmessages" onclick="getListMessages(\'' . $messages_key . '\');" data-uk-offcanvas="{mode:\'reveal\'}">' . $message_name . '</a> (' . $number_messages . ')';
}
else
{
$meta[] = '<a href="#getlistmessages" onclick="getListMessages(\'' . $messages_key . '\');" uk-toggle>' . $message_name . '</a> (' . $number_messages . ')';
}
}
else
{
$meta[] = JText::_('COM_MEMBERSMANAGER_NO_MESSAGES');
}
}
// set add profile link switch
$addProfileLink = false;
// if this is a sub account load main account details
@ -49,7 +81,7 @@ if ((3 == $displayData->account || 4 == $displayData->account) && $displayData->
$addProfileLink = true;
}
// check if the edit button is to be added
$editButton = MembersmanagerHelper::getEditButton($displayData, 'member', 'members', '&ref=profile&refid=' . $displayData->_REFID, 'com_membersmanager', null);
$editButton = MembersmanagerHelper::getEditButton($displayData, 'member', 'members', '&ref=profile&refid=' . $displayData->_REFID . '&return=' . $displayData->return_path, 'com_membersmanager', null);
// set the header
$header = array();
$header[] = '<header class="uk-comment-header">';

View File

@ -12,10 +12,13 @@
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
// switch hidden state
$hidden = ($displayData->setCharts) ? ' hidden' : '';
?>
<div class="extra<?php echo $displayData->id; ?>" hidden>
<?php if ($displayData->_USER->id > 0): ?>
<div class="extra<?php echo $displayData->id; ?>"<?php echo $hidden; ?>>
<?php endif; ?>
<?php if ($displayData->setAssessment): ?>
<div class="uk-overflow-auto uk-height-small">
<ul class="uk-list uk-list-striped">
@ -76,4 +79,6 @@ defined('JPATH_BASE') or die('Restricted access');
<?php else: ?>
<small><?php echo JText::sprintf('COM_MEMBERSMANAGER_NO_S_FOUND', MembersmanagerHelper::getButtonName('report', JText::_('COM_MEMBERSMANAGER_REPORTS'))); ?>...</small>
<?php endif; ?>
<?php if ($displayData->_USER->id > 0): ?>
</div>
<?php endif; ?>

View File

@ -12,10 +12,13 @@
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
// switch hidden state
$hidden = ($displayData->setCharts) ? ' uk-hidden' : '';
?>
<div class="extra<?php echo $displayData->id; ?> uk-hidden">
<?php if ($displayData->_USER->id > 0): ?>
<div class="extra<?php echo $displayData->id; echo $hidden; ?>">
<?php endif; ?>
<?php if ($displayData->setAssessment): ?>
<div class="uk-scrollable-box">
<ul class="uk-list">
@ -76,4 +79,6 @@ defined('JPATH_BASE') or die('Restricted access');
<?php else: ?>
<small><?php echo JText::_('COM_MEMBERSMANAGER_NO_REPORTS_FOUND'); ?>...</small>
<?php endif; ?>
<?php if ($displayData->_USER->id > 0): ?>
</div>
<?php endif; ?>

View File

@ -64,9 +64,10 @@ class MembersmanagerModelAjax extends JModelList
// get placeholder header if available
public function getPlaceHolderHeaders($component)
{
if ('com_membersmanager' === $component)
if ('com_membersmanager' === $component || 'com_corecomponent' === $component)
{
return JText::_('COM_MEMBERSMANAGER');
// just return the core placeholders
return JText::_('COM_MEMBERSMANAGER_CORE_PLACEHOLDERS');
}
return MembersmanagerHelper::getComponentName($component);
}
@ -76,7 +77,7 @@ class MembersmanagerModelAjax extends JModelList
{
$view = $this->getViewID();
// make sure we are in the (allowed) view
if (isset($view['a_view']) && ($view['a_view'] === 'message' || $view['a_view'] === 'profile'))
if (isset($view['a_view']) && ($view['a_view'] === 'compose' || $view['a_view'] === 'profile'))
{
// build image name
$imageName = md5($image . 'jnst_f0r_dumm!es');
@ -207,7 +208,7 @@ class MembersmanagerModelAjax extends JModelList
{
MembersmanagerHelper::resizeImage($this->fileName, $this->fileFormat, $this->target, $this->folderPath, $this->fullPath);
}
// Get the basic encription.
// Get the basic encryption.
$basickey = MembersmanagerHelper::getCryptKey('basic');
$basic = null;
// set link options
@ -440,8 +441,8 @@ class MembersmanagerModelAjax extends JModelList
protected function _getPackageFromUpload()
{
// Get the uploaded file information
$app = JFactory::getApplication();
$input = $app->input;
$app = JFactory::getApplication();
$input = $app->input;
// See JInputFiles::get.
$userfiles = $input->files->get('files', null, 'array');
@ -475,9 +476,9 @@ class MembersmanagerModelAjax extends JModelList
}
// Build the appropriate paths
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name'];
$tmp_src = $userfile['tmp_name'];
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path') . '/' . $userfile['name'];
$tmp_src = $userfile['tmp_name'];
// Move uploaded file
jimport('joomla.filesystem.file');
@ -547,12 +548,12 @@ class MembersmanagerModelAjax extends JModelList
}
}
$config = JFactory::getConfig();
$config = JFactory::getConfig();
// set Package Name
$check['packagename'] = $archivename;
$check['packagename'] = $archivename;
// set directory
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
return $check;
}
@ -569,8 +570,8 @@ class MembersmanagerModelAjax extends JModelList
{
jimport('joomla.filesystem.file');
$config = JFactory::getConfig();
$package = $config->get('tmp_path'). '/' .$package;
$config = JFactory::getConfig();
$package = $config->get('tmp_path'). '/' .$package;
// Is the package file a valid file?
if (is_file($package))
@ -670,8 +671,8 @@ class MembersmanagerModelAjax extends JModelList
$string = '';
$header = '';
}
// get placeholders
if ($placeholders = MembersmanagerHelper::getAnyPlaceHolders($getType))
// get the core component helper class & get placeholders
if (($helperClass = MembersmanagerHelper::getHelperClass(MembersmanagerHelper::getCoreName())) !== false && ($placeholders = $helperClass::getAnyPlaceHolders($getType)) !== false)
{
return '<div>' . $header . '<code style="display: inline-block; padding: 2px; margin: 3px;">' .
implode('</code> <code style="display: inline-block; padding: 2px; margin: 3px;">', $placeholders) .
@ -762,9 +763,9 @@ class MembersmanagerModelAjax extends JModelList
return (array) array_map( function ($member){
// build the details
$slug = (isset($member->token)) ? $member->id . ':' . $member->token : $member->id;
$profile_link = JRoute::_(membersmanagerHelperRoute::getProfileRoute($slug));
$name = (isset($member->user_name) && membersmanagerHelper::checkString($member->user_name)) ? $member->user_name : $member->name;
$email = (isset($member->user_email) && membersmanagerHelper::checkString($member->user_email)) ? $member->user_email : $member->email;
$profile_link = JRoute::_(MembersmanagerHelperRoute::getProfileRoute($slug));
$name = (isset($member->user_name) && MembersmanagerHelper::checkString($member->user_name)) ? $member->user_name : $member->name;
$email = (isset($member->user_email) && MembersmanagerHelper::checkString($member->user_email)) ? $member->user_email : $member->email;
// build the link to the member
return '<a href="' . $profile_link . '" title="' . JText::_('COM_MEMBERSMANAGER_OPEN') . ' ' . $name . '" >' . $name . ' ' . $email . ' (' . $member->token . ')</a>';
}, $members);
@ -812,6 +813,8 @@ class MembersmanagerModelAjax extends JModelList
' OR g.username LIKE '.$search. // user username
' OR g.email LIKE '.$search. // user email
' OR a.name LIKE '.$search.
' OR a.surname LIKE '.$search.
' OR a.email LIKE '.$search.
' OR a.token LIKE '.$search.
')');
@ -869,18 +872,45 @@ class MembersmanagerModelAjax extends JModelList
// Used in profile
public function getReport($key)
{
// unlock the request
if (($check = MembersmanagerHelper::unlock($key)) !== false &&
MembersmanagerHelper::checkArray($check) &&
isset($check['id']) && $check['id'] > 0 &&
isset($check['element']) && MembersmanagerHelper::checkString($check['element']) &&
isset($check['type']) && $check['type'] > 0 &&
isset($check['account']) && $check['account'] > 0)
// first we check if this is an allowed query
$view = $this->getViewID();
if (isset($view['a_view']) && 'profile' === $view['a_view'])
{
// now check if this component is active to this member
if (($html = MembersmanagerHelper::getReport($check['id'], $check['element'])) !== false && MembersmanagerHelper::checkString($html))
// unlock the request
if (($check = MembersmanagerHelper::unlock($key)) !== false &&
MembersmanagerHelper::checkArray($check) &&
isset($check['id']) && $check['id'] > 0 &&
isset($check['element']) && MembersmanagerHelper::checkString($check['element']) &&
isset($check['type']) && $check['type'] > 0 &&
isset($check['account']) && $check['account'] > 0)
{
return array('html' => $html);
// now check if this component is active to this member
if (($html = MembersmanagerHelper::getReport($check['id'], $check['element'])) !== false && MembersmanagerHelper::checkString($html))
{
return array('html' => $html);
}
}
}
return false;
}
public function getListMessages($key)
{
// first we check if this is an allowed query
$view = $this->getViewID();
if (isset($view['a_view']) && 'profile' === $view['a_view'])
{
// unlock the request
if (($check = MembersmanagerHelper::unlock($key)) !== false &&
MembersmanagerHelper::checkArray($check) &&
isset($check['id']) && $check['id'] > 0 &&
isset($check['return']) && MembersmanagerHelper::checkString($check['return']))
{
// now check if this component is active to this member
if (($html = MembersmanagerHelper::communicate('list_messages', $check['id'], $check['return'])) !== false && MembersmanagerHelper::checkString($html))
{
return array('html' => $html);
}
}
}
return false;

View File

@ -81,8 +81,8 @@ class MembersmanagerModelCpanel extends JModelItem
{
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_NOT_AUTHORISED_TO_VIEW_CPANEL'), 'error');
// redirect away to the default view if no access allowed.
$app->redirect(JRoute::_('index.php?option=com_membersmanager&view=members'));
// redirect away to the home page if no access allowed.
$app->redirect(JURI::root());
return false;
}
$this->userId = $this->user->get('id');
@ -132,7 +132,7 @@ class MembersmanagerModelCpanel extends JModelItem
$app = JFactory::getApplication();
// If no data is found redirect to default page and show warning.
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_NOT_FOUND_OR_ACCESS_DENIED'), 'warning');
$app->redirect(JRoute::_('index.php?option=com_membersmanager&view=members'));
$app->redirect(JURI::root());
return false;
}

View File

@ -1584,7 +1584,7 @@ class MembersmanagerModelMember extends JModelAdmin
// start message bucket
$message = array();
// check if user already linked
if (isset($data['user']) && $data['user'] > 0)
if (isset($data['user']) && is_numeric($data['user']) && $data['user'] > 0)
{
// set user ID
$bucket['id'] = $data['user'];
@ -1636,32 +1636,33 @@ class MembersmanagerModelMember extends JModelAdmin
{
// make sure to set the user value
$data['user'] = $done;
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_MEMBER_WAS_CREATED_SUCCESSFULLY_AND_THE_LOGIN_DETAILS_WAS_EMAILED_TO_THE_MEMBER'), 'Success');
}
else
{
// set the error
$app->enqueueMessage($done, 'Error');
// we still check if user was created.... (TODO)
if (($didCreate = JUserHelper::getUserId($bucket['username'])))
{
$data['user'] = $didCreate;
}
}
// once we are sure we have an user ID
if (isset($data['user']) && is_numeric($data['user']) && $data['user'] > 0)
{
// check if we have groups
if (($typeGroups = MembersmanagerHelper::getMemberGroupsByType($data['type'])) !== false)
{
// update the user groups
JUserHelper::setUserGroups((int) $done, (array) $typeGroups);
JUserHelper::setUserGroups((int) $data['user'], (array) $typeGroups);
}
else
{
// notice that the group was not set for this user
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_MEMBER_WAS_NOT_ADDED_TO_ANY_GROUPS_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR'), 'Error');
}
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_MEMBER_WAS_CREATED_SUCCESSFULLY_AND_THE_LOGIN_DETAILS_WAS_EMAILED_TO_THE_MEMBER'), 'Success');
}
else
{
$app->enqueueMessage($done, 'Error');
}
// we still check if user was created.... (TODO)
if (!is_numeric($done) && ($didCreate = JUserHelper::getUserId($bucket['username'])))
{
$data['user'] = $didCreate;
}
}
// check if the user was set
if (isset($data['user']) && $data['user'] > 0)
{
// the login member must always own it self for edit permissions
$data['created_by'] = $data['user'];
}

View File

@ -146,6 +146,31 @@ class MembersmanagerModelMembers extends JModelList
// get member details
$item = (object) MembersmanagerHelper::getAnyFormDetails($id, 'id', 'com_membersmanager', 'placeholder', 'report', 'id', 'member', 1);
// add company details
if (($tmp = MembersmanagerHelper::getAnyCompanyDetails('com_membersmanager', 'placeholder')) !== false && MembersmanagerHelper::checkArray($tmp))
{
foreach ($tmp as $placeholder_key => $value)
{
$item->{$placeholder_key} = $value;
}
// not needed
unset($tmp);
}
// also as related to the current logged in member
$current_member_id = MembersmanagerHelper::getVar('member', JFactory::getUser()->get('id'), 'user', 'id', '=', 'membersmanager');
if ($current_member_id && ($tmp = MembersmanagerHelper::getAnyFormDetails($current_member_id, 'id', 'com_membersmanager', 'placeholder', 'report', 'id', 'member', 1)) !== false && MembersmanagerHelper::checkArray($tmp))
{
foreach ($tmp as $placeholder_key => $value)
{
if (strpos($placeholder_key, '[member_') !== false)
{
$placeholder_key = str_replace('[member_', '[staff_', $placeholder_key);
$item->{$placeholder_key} = $value;
}
}
// not needed
unset($tmp);
}
// now load the one to one component data
if (MembersmanagerHelper::checkArray($components))
{
@ -155,12 +180,31 @@ class MembersmanagerModelMembers extends JModelList
if (($tmp = MembersmanagerHelper::getAnyFormDetails($id, 'member', $component, 'placeholder', 'report', 'member', 'form', 1)) !== false && MembersmanagerHelper::checkArray($tmp))
{
// add to the item array
foreach ($tmp as $placholder_key => $value)
foreach ($tmp as $placeholder_key => $value)
{
// keep first data set
if (!isset($item->{$placholder_key}))
if (!isset($item->{$placeholder_key}))
{
$item->{$placholder_key} = $value;
$item->{$placeholder_key} = $value;
}
}
// not needed
unset($tmp);
}
// also as related to the current logged in member
if ($current_member_id && ($tmp = MembersmanagerHelper::getAnyFormDetails($current_member_id, 'member', $component, 'placeholder', 'report', 'member', 'form', 1)) !== false && MembersmanagerHelper::checkArray($tmp))
{
// add to the item array
foreach ($tmp as $placeholder_key => $value)
{
if (strpos($placeholder_key, '[member_') !== false)
{
$placeholder_key = str_replace('[member_', '[staff_', $placeholder_key);
// keep first data set
if (!isset($item->{$placeholder_key}))
{
$item->{$placeholder_key} = $value;
}
}
}
// not needed

View File

@ -82,7 +82,7 @@ class MembersmanagerModelProfile extends JModelItem
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_NOT_AUTHORISED_TO_VIEW_PROFILE'), 'error');
// redirect away to the default view if no access allowed.
$app->redirect(JRoute::_('index.php?option=com_membersmanager&view=members'));
$app->redirect(JRoute::_('index.php?option=com_membersmanager&view=cpanel'));
return false;
}
$this->userId = $this->user->get('id');
@ -120,12 +120,6 @@ class MembersmanagerModelProfile extends JModelItem
array('id','account','token','type','name','surname','email','main_member','user','profile_image','published','created_by','modified_by','created','modified','version','hits','checked_out')));
$query->from($db->quoteName('#__membersmanager_member', 'a'));
// Get from #__membersmanager_type as d
$query->select($db->quoteName(
array('d.description','d.name'),
array('type_description','type_name')));
$query->join('LEFT', ($db->quoteName('#__membersmanager_type', 'd')) . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('d.id') . ')');
// Get from #__membersmanager_member as aa
$query->select($db->quoteName(
array('aa.name','aa.surname','aa.email','aa.user','aa.token'),
@ -156,12 +150,9 @@ class MembersmanagerModelProfile extends JModelItem
$app = JFactory::getApplication();
// If no data is found redirect to default page and show warning.
$app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_NOT_FOUND_OR_ACCESS_DENIED'), 'warning');
$app->redirect(JRoute::_('index.php?option=com_membersmanager&view=members'));
$app->redirect(JRoute::_('index.php?option=com_membersmanager&view=cpanel'));
return false;
}
// Load the JEvent Dispatcher
JPluginHelper::importPlugin('content');
$this->_dispatcher = JEventDispatcher::getInstance();
// Check if we can decode profile_image
if (!empty($data->profile_image) && $mediumkey && !is_numeric($data->profile_image) && $data->profile_image === base64_encode(base64_decode($data->profile_image, true)))
{
@ -174,15 +165,6 @@ class MembersmanagerModelProfile extends JModelItem
// Decode type
$data->type = json_decode($data->type, true);
}
// Check if item has params, or pass whole item.
$params = (isset($data->params) && MembersmanagerHelper::checkJson($data->params)) ? json_decode($data->params) : $data;
// Make sure the content prepare plugins fire on type_description
$_type_description = new stdClass();
$_type_description->text =& $data->type_description; // value must be in text
// Since all values are now in text (Joomla Limitation), we also add the field name (type_description) to context
$this->_dispatcher->trigger("onContentPrepare", array('com_membersmanager.member.type_description', &$_type_description, &$params, 0));
// Checking if type_description has uikit components that must be loaded.
$this->uikitComp = MembersmanagerHelper::getUikitComp($data->type_description,$this->uikitComp);
// set idMain_memberMemberB to the $data object.
$data->idMain_memberMemberB = $this->getIdMain_memberMemberDdbb_B($data->id);
@ -204,19 +186,31 @@ class MembersmanagerModelProfile extends JModelItem
}
}
// get the return value.
$_uri = (string) JUri::getInstance();
$_return = urlencode(base64_encode($_uri));
// build a return path
$this->_item[$pk]->return_path = $_return;
// set name
$this->_item[$pk]->name = MembersmanagerHelper::getMemberName($this->_item[$pk]->id, $this->_item[$pk]->user, $this->_item[$pk]->name, $this->_item[$pk]->surname);
// Build the item slug
$this->_item[$pk]->slug = (isset($this->_item[$pk]->token)) ? $this->_item[$pk]->id . ':' . $this->_item[$pk]->token : $this->_item[$pk]->id;
$this->_item[$pk]->main_member_slug = (isset($this->_item[$pk]->main_member_token)) ? $this->_item[$pk]->main_member . ':' . $this->_item[$pk]->main_member_token : $this->_item[$pk]->main_member;
// setup the link to profile
$profile_link = MembersmanagerHelperRoute::getProfileRoute($this->_item[$pk]->slug);
$this->_item[$pk]->profile_link = JRoute::_($profile_link);
$this->_item[$pk]->main_member_profile_link = JRoute::_(MembersmanagerHelperRoute::getProfileRoute($this->_item[$pk]->main_member_slug));
$this->_item[$pk]->profile_link = JRoute::_(MembersmanagerHelperRoute::getProfileRoute($this->_item[$pk]->slug) . '&return=' . $_return);
$this->_item[$pk]->main_member_profile_link = JRoute::_(MembersmanagerHelperRoute::getProfileRoute($this->_item[$pk]->main_member_slug) . '&return=' . $_return);
// set main member name
$this->_item[$pk]->main_member_name = MembersmanagerHelper::getMemberName($this->_item[$pk]->main_member, $this->_item[$pk]->main_member_user, $this->_item[$pk]->main_member_name, $this->_item[$pk]->main_member_surname);
// build a return path
$this->_item[$pk]->return_path = urlencode(base64_encode($profile_link));
// set the type names
if (isset($this->_item[$pk]->type) && MembersmanagerHelper::checkArray($this->_item[$pk]->type))
{
$types = array();
foreach ($this->_item[$pk]->type as $type)
{
$types[] = ($_type_name = MembersmanagerHelper::getVar('type', $type, 'id', 'name', '=', 'membersmanager')) ? $_type_name : '';
}
$this->_item[$pk]->type_name = implode(', ', $types);
}
// check if we have children members
if (isset($this->_item[$pk]->idMain_memberMemberB) && MembersmanagerHelper::checkArray($this->_item[$pk]->idMain_memberMemberB))
{
@ -227,11 +221,19 @@ class MembersmanagerModelProfile extends JModelItem
// set sub member name
$item->name = MembersmanagerHelper::getMemberName($item->id, $item->user, $item->name, $item->surname);
// setup the link to profile
$profile_link = MembersmanagerHelperRoute::getProfileRoute($item->slug);
// setup the link to profile
$item->profile_link = JRoute::_($profile_link);
$item->profile_link = JRoute::_(MembersmanagerHelperRoute::getProfileRoute($item->slug) . '&return=' . $_return);
// set the type names
if (isset($item->type) && MembersmanagerHelper::checkArray($item->type))
{
$types = array();
foreach ($item->type as $type)
{
$types[] = ($_type_name = MembersmanagerHelper::getVar('type', $type, 'id', 'name', '=', 'membersmanager')) ? $_type_name : '';
}
$item->type_name = implode(', ', $types);
}
// build a return path
$item->return_path = urlencode(base64_encode($profile_link));
$item->return_path = $_return;
}
}
@ -289,12 +291,6 @@ class MembersmanagerModelProfile extends JModelItem
$query->from($db->quoteName('#__membersmanager_member', 'b'));
$query->where('b.main_member = ' . $db->quote($id));
// Get from #__membersmanager_type as e
$query->select($db->quoteName(
array('e.description','e.name'),
array('type_description','type_name')));
$query->join('LEFT', ($db->quoteName('#__membersmanager_type', 'e')) . ' ON (' . $db->quoteName('b.type') . ' = ' . $db->quoteName('e.id') . ')');
// Get from #__users as g
$query->select($db->quoteName(
array('g.name','g.username','g.email'),

View File

@ -15,30 +15,15 @@ defined('_JEXEC') or die('Restricted access');
?>
<?php if ($this->user->id > 0): ?>
<?php echo $this->item->event->onContentBeforeDisplay; ?>
<h1><?php echo JText::_('COM_MEMBERSMANAGER_CPANEL'); ?></h1>
<div class="uk-grid">
<div class="uk-width-medium-1-2">
<?php if ($this->searchForm): ?>
<div class="control-group">
<div class="controls"><?php echo $this->searchForm->input;?></div>
</div>
<div id="members_found"></div>
<script type="text/javascript">
jQuery(function($) {
$('#member_search').keyup(function(e) {
var value = $(this).val();
searchMembers(value);
});
});
</script>
<?php endif; ?>
</div>
<div class="uk-width-medium-1-2">
<a class="uk-button uk-button-success uk-width-1-1" href="<?php echo JURI::root(); ?>index.php?option=com_membersmanager&view=members&task=member.edit&return=<?php echo urlencode(base64_encode((string) JUri::getInstance())); ?>">
<i class="uk-icon-plus"></i> <?php echo JText::_('COM_MEMBERSMANAGER_CREATE'); ?>
</a>
</div>
</div>
<?php echo $this->item->event->onContentAfterTitle; ?>
<?php if (3 == $this->uikitVersion) : ?>
<?php echo $this->loadTemplate('cpanel_uikit_three'); ?>
<?php else: ?>
<?php echo $this->loadTemplate('cpanel_uikit_two'); ?>
<?php endif; ?>
<?php echo $this->item->event->onContentAfterDisplay; ?>
<?php else: ?>
<?php echo $this->loadTemplate('loginmodule'); ?>
<?php endif; ?>

View File

@ -0,0 +1,29 @@
<?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 uk-grid>
<?php if ($this->searchForm && $this->user->authorise('member.create', 'com_membersmanager')): ?>
<div class="uk-width-1-2@m">
<?php echo JLayoutHelper::render('cpanel_search_form', $this->searchForm); ?>
</div>
<div class="uk-width-1-2@m">
<?php echo JLayoutHelper::render('cpanel_uikit_three_buttons', true) ?>
</div>
<?php elseif ($this->searchForm): ?>
<?php echo JLayoutHelper::render('cpanel_search_form', $this->searchForm); ?>
<?php elseif ($this->user->authorise('member.create', 'com_membersmanager')): ?>
<?php echo JLayoutHelper::render('cpanel_uikit_three_buttons', true) ?>
<?php endif; ?>
</div>

View File

@ -0,0 +1,29 @@
<?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 class="uk-grid">
<?php if ($this->searchForm && $this->user->authorise('member.create', 'com_membersmanager')): ?>
<div class="uk-width-medium-1-2">
<?php echo JLayoutHelper::render('cpanel_search_form', $this->searchForm); ?>
</div>
<div class="uk-width-medium-1-2">
<?php echo JLayoutHelper::render('cpanel_uikit_two_buttons', true) ?>
</div>
<?php elseif ($this->searchForm): ?>
<?php echo JLayoutHelper::render('cpanel_search_form', $this->searchForm); ?>
<?php elseif ($this->user->authorise('member.create', 'com_membersmanager')): ?>
<?php echo JLayoutHelper::render('cpanel_uikit_two_buttons', true) ?>
<?php endif; ?>
</div>

View File

@ -27,6 +27,8 @@ class MembersmanagerViewCpanel extends JViewLegacy
$this->menu = $this->app->getMenu()->getActive();
// get the user object
$this->user = JFactory::getUser();
// Initialise dispatcher.
$dispatcher = JEventDispatcher::getInstance();
// Initialise variables.
$this->item = $this->get('Item');
// get the search form
@ -43,6 +45,21 @@ class MembersmanagerViewCpanel extends JViewLegacy
{
throw new Exception(implode("\n", $errors), 500);
}
// Process the content plugins.
JPluginHelper::importPlugin('content');
// Setup Event Object.
$this->item->event = new stdClass;
// Check if item has params, or pass global params
$params = (isset($this->item->params) && MembersmanagerHelper::checkJson($this->item->params)) ? json_decode($this->item->params) : $this->params;
// onContentAfterTitle Event Trigger.
$results = $dispatcher->trigger('onContentAfterTitle', array('com_membersmanager.member', &$this->item, &$params, 0));
$this->item->event->onContentAfterTitle = trim(implode("\n", $results));
// onContentBeforeDisplay Event Trigger.
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_membersmanager.member', &$this->item, &$params, 0));
$this->item->event->onContentBeforeDisplay = trim(implode("\n", $results));
// onContentAfterDisplay Event Trigger.
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_membersmanager.member', &$this->item, &$params, 0));
$this->item->event->onContentAfterDisplay = trim(implode("\n", $results));
parent::display($tpl);
}

View File

@ -13,19 +13,9 @@ Joomla.submitbutton = function(task)
if (task == ''){
return false;
} else {
var isValid=true;
var action = task.split('.');
if (action[1] != 'cancel' && action[1] != 'close'){
var forms = $$('form.form-validate');
for (var i=0;i<forms.length;i++){
if (!document.formvalidator.isValid(forms[i])){
isValid = false;
break;
}
}
}
if (isValid){
Joomla.submitform(task);
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'));

View File

@ -171,7 +171,7 @@ class MembersmanagerViewMember extends JViewLegacy
{
if(strlen($var) > 30)
{
// use the helper htmlEscape method instead and shorten the string
// use the helper htmlEscape method instead and shorten the string
return MembersmanagerHelper::htmlEscape($var, $this->_charset, true, 30);
}
// use the helper htmlEscape method instead.
@ -191,15 +191,22 @@ class MembersmanagerViewMember extends JViewLegacy
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_($isNew ? 'COM_MEMBERSMANAGER_MEMBER_NEW' : 'COM_MEMBERSMANAGER_MEMBER_EDIT'));
// we need this to fix the form display (TODO)
$this->document->addStyleSheet(JURI::root()."administrator/templates/isis/css/template.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addScript(JURI::root()."administrator/templates/isis/js/template.js", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
// only add the ISIS template css & js if needed (default is 1 = true)
// you can override this in the global component options
// just add a (radio yes/no field) with a name called add_isis_template
// to your components config area
if ($this->params->get('add_isis_template', 1))
{
// we need this to fix the form display (TODO)
$this->document->addStyleSheet(JURI::root() . "administrator/templates/isis/css/template.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addScript(JURI::root() . "administrator/templates/isis/js/template.js", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
// the default style of this view
$this->document->addStyleSheet(JURI::root()."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()."';");
// default javascript of this view
$this->document->addScript(JURI::root().$this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root(). $this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root(). "components/com_membersmanager/views/member/submitbutton.js", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
// get Uikit Version

View File

@ -22,20 +22,28 @@ if (!is_null($return_to) && \JUri::isInternal(base64_decode($return_to)))
?>
<?php if ($this->user->id > 0): ?>
<?php if ($this->user->id > 0 || 2 == $this->params->get('login_required', 1)): ?>
<?php if (!MembersmanagerHelper::checkString($return_to)): ?>
<a class="uk-button uk-width-1-1 uk-button-primary uk-button-small uk-margin-small-bottom" href="<?php echo JRoute::_(MembersmanagerHelperRoute::getCpanelRoute()); ?>" title="<?php echo JText::_('COM_MEMBERSMANAGER_OPEN_CPANEL'); ?>">
<?php echo JText::_('COM_MEMBERSMANAGER_BACK_TO_CPANEL'); ?>
</a>
<?php else: ?>
<div class="uk-button-group uk-width-1-1">
<a class="uk-button uk-width-1-2 uk-button-primary uk-button-small uk-margin-small-bottom" href="<?php echo JRoute::_($return_to); ?>" title="<?php echo JText::_('COM_MEMBERSMANAGER_GO_BACK'); ?>">
<?php echo JText::_('COM_MEMBERSMANAGER_BACK'); ?>
</a>
<a class="uk-button uk-width-1-2 uk-button-primary uk-button-small uk-margin-small-bottom" href="<?php echo JRoute::_(MembersmanagerHelperRoute::getCpanelRoute()); ?>" title="<?php echo JText::_('COM_MEMBERSMANAGER_OPEN_CPANEL'); ?>">
<?php if ($this->user->authorise('site.cpanel.access', 'com_[[[core]]')): ?>
<a class="uk-button uk-width-1-1 uk-button-primary uk-button-small uk-margin-small-bottom" href="<?php echo JRoute::_(MembersmanagerHelperRoute::getCpanelRoute()); ?>" title="<?php echo JText::_('COM_MEMBERSMANAGER_OPEN_CPANEL'); ?>">
<?php echo JText::_('COM_MEMBERSMANAGER_CPANEL'); ?>
</a>
</div>
<?php endif; ?>
<?php else: ?>
<?php if ($this->user->authorise('site.cpanel.access', 'com_[[[core]]')): ?>
<div class="uk-button-group uk-width-1-1">
<a class="uk-button uk-width-1-2 uk-button-primary uk-button-small uk-margin-small-bottom" href="<?php echo JRoute::_($return_to); ?>" title="<?php echo JText::_('COM_MEMBERSMANAGER_GO_BACK'); ?>">
<?php echo JText::_('COM_MEMBERSMANAGER_BACK'); ?>
</a>
<a class="uk-button uk-width-1-2 uk-button-primary uk-button-small uk-margin-small-bottom" href="<?php echo JRoute::_(MembersmanagerHelperRoute::getCpanelRoute()); ?>" title="<?php echo JText::_('COM_MEMBERSMANAGER_OPEN_CPANEL'); ?>">
<?php echo JText::_('COM_MEMBERSMANAGER_CPANEL'); ?>
</a>
</div>
<?php else: ?>
<a class="uk-button uk-width-1-1 uk-button-primary uk-button-small uk-margin-small-bottom" href="<?php echo JRoute::_($return_to); ?>" title="<?php echo JText::_('COM_MEMBERSMANAGER_GO_BACK'); ?>">
<?php echo JText::_('COM_MEMBERSMANAGER_BACK'); ?>
</a>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->loadTemplate('profiles'); ?>
<script type="text/javascript">

View File

@ -20,6 +20,7 @@ defined('_JEXEC') or die('Restricted access');
<div class="uk-block">
<?php $this->item->_USER = &$this->user; ?>
<?php $this->item->_REFID = $this->item->id; ?>
<?php $this->item->_UIKIT = $this->uikitVersion; ?>
<?php $this->item->_IMAGELINK = MembersmanagerHelper::getFolderPath('url'); ?>
<ul class="uk-comment-list">
<li>
@ -28,11 +29,12 @@ defined('_JEXEC') or die('Restricted access');
<?php else: ?>
<?php echo JLayoutHelper::render('profile_uikit_two', $this->item); ?>
<?php endif; ?>
<?php if (isset($this->item->idMain_memberMemberB) && MembersmanagerHelper::checkArray($this->item->idMain_memberMemberB)): ?>
<?php if ($this->user->id > 0 && isset($this->item->idMain_memberMemberB) && MembersmanagerHelper::checkArray($this->item->idMain_memberMemberB)): ?>
<ul>
<?php foreach ($this->item->idMain_memberMemberB as $item): ?>
<?php $item->_USER = &$this->user; ?>
<?php $item->_REFID = $this->item->id; ?>
<?php $item->_UIKIT = $this->uikitVersion; ?>
<?php $item->_IMAGELINK = $this->item->_IMAGELINK; ?>
<li>
<?php if ($this->uikitVersion == 3) : ?>
@ -56,6 +58,13 @@ defined('_JEXEC') or die('Restricted access');
<div class="report-spinner"><?php echo JText::_('COM_MEMBERSMANAGER_LOADING'); ?><span class="loading-dots"></span>.</div>
</div>
</div>
<div id="getlistmessages" uk-offcanvas="mode: reveal; overlay: true">
<div class="uk-offcanvas-bar">
<button class="uk-offcanvas-close" type="button" uk-close></button>
<ul class="setlistmessages uk-nav uk-nav-primary uk-nav-center uk-margin-auto-vertical"></ul>
<div class="listmessages-spinner uk-panel"><?php echo JText::_('COM_MEMBERSMANAGER_LOADING'); ?><span class="loading-dots"></span>.</div>
</div>
</div>
<?php else: ?>
<div id="getreport" class="uk-modal">
<div class="uk-modal-dialog">
@ -64,6 +73,12 @@ defined('_JEXEC') or die('Restricted access');
<div class="report-spinner"><?php echo JText::_('COM_MEMBERSMANAGER_LOADING'); ?><span class="loading-dots"></span>.</div>
</div>
</div>
<div id="getlistmessages" class="uk-offcanvas">
<div class="uk-offcanvas-bar">
<ul class="setlistmessages uk-nav uk-nav-offcanvas" data-uk-nav></ul>
<div class="listmessages-spinner uk-panel"><?php echo JText::_('COM_MEMBERSMANAGER_LOADING'); ?><span class="loading-dots"></span>.</div>
</div>
</div>
<?php endif; ?>
<?php else: ?>
<h3><?php echo JText::_('COM_MEMBERSMANAGER_NO_PROFILE_FOUND'); ?></h3>

View File

@ -102,33 +102,6 @@ class MembersmanagerViewProfile extends JViewLegacy
{
$this->document->addScript(JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/uikit'.$size.'.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
// Load the needed uikit components in this view.
$uikitComp = $this->get('UikitComp');
if ($uikit != 2 && isset($uikitComp) && MembersmanagerHelper::checkArray($uikitComp))
{
// load just in case.
jimport('joomla.filesystem.file');
// loading...
foreach ($uikitComp as $class)
{
foreach (MembersmanagerHelper::$uk_components[$class] as $name)
{
// check if the CSS file exists.
if (JFile::exists(JPATH_ROOT.'/media/com_membersmanager/uikit-v2/css/components/'.$name.$style.$size.'.css'))
{
// load the css.
$this->document->addStyleSheet(JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/'.$name.$style.$size.'.css', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
}
// check if the JavaScript file exists.
if (JFile::exists(JPATH_ROOT.'/media/com_membersmanager/uikit-v2/js/components/'.$name.$size.'.js'))
{
// load the js.
$this->document->addScript(JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/'.$name.$size.'.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
}
}
}
}
}
// Use Uikit Version 3
elseif (3 == $this->uikitVersion)
@ -185,8 +158,9 @@ class MembersmanagerViewProfile extends JViewLegacy
$this->document->addScriptDeclaration("google.charts.load('current');");
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '".$this->get('VDM')."';");
// add javascript lang strings
// add JavaScript lang strings
JText::script('COM_MEMBERSMANAGER_THERE_WAS_NO_REPORT_FOUND');
JText::script('COM_MEMBERSMANAGER_THERE_WAS_NO_MESSAGES_FOUND');
// add the document default css file
$this->document->addStyleSheet(JURI::root(true) .'/components/com_membersmanager/assets/css/profile.css', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
// Set the Custom CSS script to view