diff --git a/src/languages/site/en-GB/en-GB.com_subusers.ini b/src/languages/site/en-GB/en-GB.com_subusers.ini deleted file mode 100755 index c9aa484..0000000 --- a/src/languages/site/en-GB/en-GB.com_subusers.ini +++ /dev/null @@ -1,307 +0,0 @@ -COM_SUBUSERS="Subusers" -COM_SUBUSERS_ITEM_SAVED_SUCCESSFULLY="Item saved successfully" -COM_SUBUSERS_ITEM_DELETED_SUCCESSFULLY="Item deleted successfully" -COM_SUBUSERS_ITEM_NOT_LOADED="Could not load the item" -COM_SUBUSERS_VIEW_FILE="[View File]" -COM_SUBUSERS_ADD_ITEM="Add" -COM_SUBUSERS_EDIT_ITEM="Edit" -COM_SUBUSERS_DELETE_ITEM="Delete" -COM_SUBUSERS_DELETE_MESSAGE="Are you sure that you want delete this item?" -COM_SUBUSERS_PUBLISH_ITEM="Publish" -COM_SUBUSERS_UNPUBLISH_ITEM="Unpublish" -COM_SUBUSERS_NO_ITEMS="There are no items in the list" -COM_SUBUSERS_SEARCH_TOOLS="Search Tools" -COM_SUBUSERS_SEARCH_TOOLS_DESC="" -COM_SUBUSERS_SEARCH_FILTER_SUBMIT="Search" -COM_SUBUSERS_SEARCH_FILTER_CLEAR="Clear" -COM_SUBUSERS_SEARCH_FILTER_DATE_FORMAT="Dates should be in this format: \"YYYY-MM-DD\". Some filter fields have been ignored." -COM_SUBUSERS_TITLE_ORGANISATIONS="Organisations" -COM_SUBUSERS_ORGANISATIONS_ID="ID" -COM_SUBUSERS_ORGANISATIONS_NAME="Organisation Name" -COM_SUBUSERS_ORGANIZATION_ADMIN="Organisation Admin" -COM_SUBUSERS_ORGANISATIONS_CREATED_BY="Organisation Admin" -COM_SUBUSERS_ORGANISATIONS_CHECKED_OUT="N/A" -COM_SUBUSERS_ORGANISATIONS_CHECKED_OUT_TIME="N/A" -COM_SUBUSERS_ORGANISATIONS_ORDERING="Order" -COM_SUBUSERS_ORGANISATIONS_STATE="State" -COM_SUBUSERS_ORGANISATIONS_EMAIL="Organisation Email" -COM_SUBUSERS_ORGANISATIONS_LOGO="Logo" -COM_SUBUSERS_TITLE_USERS="Users" -COM_SUBUSERS_USERS_ID="ID" -COM_SUBUSERS_USERS_USER_ID="User Name" -COM_SUBUSERS_USERS_USER_ID_FILTER="- Select User Name -" -COM_SUBUSERS_USERS_CLIENT="Client" -COM_SUBUSERS_USERS_CLIENT_ID="Organisation" -COM_SUBUSERS_USERS_ROLE_ID="User Role" -COM_SUBUSERS_USERS_CREATED_BY="Organisation Admin" -COM_SUBUSERS_USERS_CHECKED_OUT="Checked_out" -COM_SUBUSERS_USERS_CHECKED_OUT_TIME="Checked_out_time" -COM_SUBUSERS_USERS_ORGANIZATION_NAME="Organization Name" -COM_SUBUSERS_USERS_ORDERING="Ordering" -COM_SUBUSERS_USERS_STATE="State" -COM_SUBUSERS_TITLE_ROLES="Roles" -COM_SUBUSERS_ROLES_ID="ID" -COM_SUBUSERS_ROLES_NAME="Name" -COM_SUBUSERS_ROLES_CLIENT="Client" -COM_SUBUSERS_ROLES_CREATED_BY="Created by" -COM_SUBUSERS_ROLES_CHECKED_OUT="N/A" -COM_SUBUSERS_ROLES_CHECKED_OUT_TIME="N/A" -COM_SUBUSERS_ROLES_ORDERING="Order" -COM_SUBUSERS_ROLES_STATE="State" -COM_SUBUSERS_TITLE_ACTIONS="Actions" -COM_SUBUSERS_ACTIONS_ID="ID" -COM_SUBUSERS_ACTIONS_NAME="Name" -COM_SUBUSERS_ACTIONS_CLIENT="Client" -COM_SUBUSERS_ACTIONS_CREATED_BY="Created by" -COM_SUBUSERS_ACTIONS_CHECKED_OUT="N/A" -COM_SUBUSERS_ACTIONS_CHECKED_OUT_TIME="N/A" -COM_SUBUSERS_ACTIONS_ORDERING="Order" -COM_SUBUSERS_ACTIONS_STATE="State" -COM_SUBUSERS_TITLE_MAPPINGS="Role Action Mappings" -COM_SUBUSERS_MAPPINGS_ID="ID" -COM_SUBUSERS_MAPPINGS_ROLE_ID="Role" -COM_SUBUSERS_MAPPINGS_ACTION_ID="Action" -COM_SUBUSERS_MAPPINGS_CLIENT="Client" -COM_SUBUSERS_MAPPINGS_CREATED_BY="Created by" -COM_SUBUSERS_MAPPINGS_CHECKED_OUT="N/A" -COM_SUBUSERS_MAPPINGS_CHECKED_OUT_TIME="N/A" -COM_SUBUSERS_MAPPINGS_ORDERING="Order" -COM_SUBUSERS_MAPPINGS_STATE="State" -COM_SUBUSERS_TITLE_ORGANISATION="Add Organisation" -COM_SUBUSERS_LEGEND_ORGANISATION="Add Organisation" -COM_SUBUSERS_FORM_LBL_ORGANISATION_ID="ID" -COM_SUBUSERS_FORM_DESC_ORGANISATION_ID="" -COM_SUBUSERS_FORM_LBL_ORGANISATION_NAME="Organisation Name" -COM_SUBUSERS_FORM_DESC_ORGANISATION_NAME="Enter Organisation name" -COM_SUBUSERS_FORM_LBL_ORGANISATION_CREATED_BY="Created_by" -COM_SUBUSERS_FORM_DESC_ORGANISATION_CREATED_BY="Enter user " -COM_SUBUSERS_FORM_LBL_ORGANISATION_CHECKED_OUT="N/A" -COM_SUBUSERS_FORM_DESC_ORGANISATION_CHECKED_OUT="" -COM_SUBUSERS_FORM_LBL_ORGANISATION_CHECKED_OUT_TIME="N/A" -COM_SUBUSERS_FORM_DESC_ORGANISATION_CHECKED_OUT_TIME="" -COM_SUBUSERS_FORM_LBL_ORGANISATION_ORDERING="Order" -COM_SUBUSERS_FORM_DESC_ORGANISATION_ORDERING="" -COM_SUBUSERS_FORM_LBL_ORGANISATION_STATE="State" -COM_SUBUSERS_FORM_DESC_ORGANISATION_STATE="" -COM_SUBUSERS_FORM_LBL_ORGANISATION_EMAIL="Organisation Email" -COM_SUBUSERS_FORM_DESC_ORGANISATION_EMAIL="Enter organisation email" -COM_SUBUSERS_FORM_LBL_ORGANISATION_LOGO="Organisation Logo" -COM_SUBUSERS_FORM_DESC_ORGANISATION_LOGO="Choose image file" -COM_SUBUSERS_TITLE_LIST_VIEW_ORGANISATIONS="Organisations" -COM_SUBUSERS_TITLE_LIST_VIEW_ORGANISATIONS_DESC="Show a list of Organisations" -COM_SUBUSERS_ORGANISATIONS_ACTIONS="Actions" -COM_SUBUSERS_ORGANISATIONS_EDIT="Edit" -COM_SUBUSERS_ORGANISATIONS_DELETE="Delete" -COM_SUBUSERS_TITLE_ITEM_VIEW_ORGANISATION="Single Organisation" -COM_SUBUSERS_TITLE_ITEM_VIEW_ORGANISATION_DESC="Show a specific Organisation" -COM_SUBUSERS_TITLE_FORM_VIEW_ORGANISATION="Organisation Form" -COM_SUBUSERS_TITLE_FORM_VIEW_ORGANISATION_DESC="Show a form to add or edit a Organisation" -COM_SUBUSERS_TITLE_USER="Add User" -COM_SUBUSERS_LEGEND_USER="Add User" -COM_SUBUSERS_FORM_LBL_USER_ID="Id" -COM_SUBUSERS_FORM_DESC_USER_ID="" -COM_SUBUSERS_FORM_LBL_USER_USER_ID="Name" -COM_SUBUSERS_FORM_DESC_USER_USER_ID="Choose user" -COM_SUBUSERS_FORM_LBL_USER_CLIENT="Client" -COM_SUBUSERS_FORM_DESC_USER_CLIENT="Client" -COM_SUBUSERS_FORM_LBL_USER_CLIENT_ID="Organisation" -COM_SUBUSERS_FORM_DESC_USER_CLIENT_ID="Choose Organisation" -COM_SUBUSERS_FORM_LBL_USER_ROLE_ID="0" -COM_SUBUSERS_FORM_DESC_USER_ROLE_ID="" -COM_SUBUSERS_FORM_LBL_USER_CREATED_BY="Created_by" -COM_SUBUSERS_FORM_DESC_USER_CREATED_BY="Creator" -COM_SUBUSERS_FORM_LBL_USER_CHECKED_OUT="Checked_out" -COM_SUBUSERS_FORM_DESC_USER_CHECKED_OUT="" -COM_SUBUSERS_FORM_LBL_USER_CHECKED_OUT_TIME="Checked_out_time" -COM_SUBUSERS_FORM_DESC_USER_CHECKED_OUT_TIME="" -COM_SUBUSERS_FORM_LBL_USER_ORDERING="Ordering" -COM_SUBUSERS_FORM_DESC_USER_ORDERING="" -COM_SUBUSERS_FORM_LBL_USER_STATE="State" -COM_SUBUSERS_FORM_DESC_USER_STATE="State" -COM_SUBUSERS_TITLE_LIST_VIEW_USERS="Users" -COM_SUBUSERS_TITLE_LIST_VIEW_USERS_DESC="Show a list of Users" -COM_SUBUSERS_USERS_ACTIONS="Actions" -COM_SUBUSERS_USERS_EDIT="Edit" -COM_SUBUSERS_USERS_DELETE="Delete" -COM_SUBUSERS_USER_ENTER_PASSWORD="Enter Password"; -COM_SUBUSERS_USER_ENTER_REPEAT_PASSWORD="Repeat Password"; -COM_SUBUSERS_TITLE_ITEM_VIEW_USER="Single User" -COM_SUBUSERS_TITLE_ITEM_VIEW_USER_DESC="Show a specific User" -COM_SUBUSERS_TITLE_FORM_VIEW_USER="UserForm" -COM_SUBUSERS_TITLE_FORM_VIEW_USER_DESC="Show a form to add or edit a User" -COM_SUBUSERS_TITLE_ROLE="Role" -COM_SUBUSERS_LEGEND_ROLE="Role" -COM_SUBUSERS_FORM_LBL_ROLE_ID="ID" -COM_SUBUSERS_FORM_DESC_ROLE_ID="" -COM_SUBUSERS_FORM_LBL_ROLE_NAME="Name" -COM_SUBUSERS_FORM_DESC_ROLE_NAME="Role Name" -COM_SUBUSERS_FORM_LBL_ROLE_CLIENT="Client" -COM_SUBUSERS_FORM_DESC_ROLE_CLIENT="Client" -COM_SUBUSERS_FORM_LBL_ROLE_CREATED_BY="Created by" -COM_SUBUSERS_FORM_DESC_ROLE_CREATED_BY="" -COM_SUBUSERS_FORM_LBL_ROLE_CHECKED_OUT="N/A" -COM_SUBUSERS_FORM_DESC_ROLE_CHECKED_OUT="" -COM_SUBUSERS_FORM_LBL_ROLE_CHECKED_OUT_TIME="N/A" -COM_SUBUSERS_FORM_DESC_ROLE_CHECKED_OUT_TIME="" -COM_SUBUSERS_FORM_LBL_ROLE_ORDERING="Order" -COM_SUBUSERS_FORM_DESC_ROLE_ORDERING="" -COM_SUBUSERS_FORM_LBL_ROLE_STATE="State" -COM_SUBUSERS_FORM_DESC_ROLE_STATE="" -COM_SUBUSERS_TITLE_LIST_VIEW_ROLES="Roles" -COM_SUBUSERS_TITLE_LIST_VIEW_ROLES_DESC="Show a list of Roles" -COM_SUBUSERS_ROLES_ACTIONS="Actions" -COM_SUBUSERS_ROLES_ADD="Add" -COM_SUBUSERS_ROLES_EDIT="Edit" -COM_SUBUSERS_ROLES_DELETE="Delete" -COM_SUBUSERS_TITLE_ITEM_VIEW_ROLE="Single Role" -COM_SUBUSERS_TITLE_ITEM_VIEW_ROLE_DESC="Show a specific Role" -COM_SUBUSERS_TITLE_FORM_VIEW_ROLE="RoleForm" -COM_SUBUSERS_TITLE_FORM_VIEW_ROLE_DESC="Show a form to add or edit a Role" -COM_SUBUSERS_TITLE_ACTION="Action" -COM_SUBUSERS_LEGEND_ACTION="Action" -COM_SUBUSERS_FORM_LBL_ACTION_ID="ID" -COM_SUBUSERS_FORM_DESC_ACTION_ID="" -COM_SUBUSERS_FORM_LBL_ACTION_NAME="Name" -COM_SUBUSERS_FORM_DESC_ACTION_NAME="Role Name" -COM_SUBUSERS_FORM_LBL_ACTION_CLIENT="Client" -COM_SUBUSERS_FORM_DESC_ACTION_CLIENT="Client" -COM_SUBUSERS_FORM_LBL_ACTION_CREATED_BY="Created by" -COM_SUBUSERS_FORM_DESC_ACTION_CREATED_BY="" -COM_SUBUSERS_FORM_LBL_ACTION_CHECKED_OUT="N/A" -COM_SUBUSERS_FORM_DESC_ACTION_CHECKED_OUT="" -COM_SUBUSERS_FORM_LBL_ACTION_CHECKED_OUT_TIME="N/A" -COM_SUBUSERS_FORM_DESC_ACTION_CHECKED_OUT_TIME="" -COM_SUBUSERS_FORM_LBL_ACTION_ORDERING="Order" -COM_SUBUSERS_FORM_DESC_ACTION_ORDERING="" -COM_SUBUSERS_FORM_LBL_ACTION_STATE="State" -COM_SUBUSERS_FORM_DESC_ACTION_STATE="" -COM_SUBUSERS_TITLE_MAPPING="Role Action Mapping" -COM_SUBUSERS_LEGEND_MAPPING="Role Action Mapping" -COM_SUBUSERS_FORM_LBL_MAPPING_ID="ID" -COM_SUBUSERS_FORM_DESC_MAPPING_ID="" -COM_SUBUSERS_FORM_LBL_MAPPING_ROLE_ID="Role" -COM_SUBUSERS_FORM_DESC_MAPPING_ROLE_ID="Role" -COM_SUBUSERS_FORM_LBL_MAPPING_ACTION_ID="Action" -COM_SUBUSERS_FORM_DESC_MAPPING_ACTION_ID="Action" -COM_SUBUSERS_FORM_LBL_MAPPING_CLIENT="Client" -COM_SUBUSERS_FORM_DESC_MAPPING_CLIENT="Client" -COM_SUBUSERS_FORM_LBL_MAPPING_CREATED_BY="Created by" -COM_SUBUSERS_FORM_DESC_MAPPING_CREATED_BY="" -COM_SUBUSERS_FORM_LBL_MAPPING_CHECKED_OUT="N/A" -COM_SUBUSERS_FORM_DESC_MAPPING_CHECKED_OUT="" -COM_SUBUSERS_FORM_LBL_MAPPING_CHECKED_OUT_TIME="N/A" -COM_SUBUSERS_FORM_DESC_MAPPING_CHECKED_OUT_TIME="" -COM_SUBUSERS_FORM_LBL_MAPPING_ORDERING="Order" -COM_SUBUSERS_FORM_DESC_MAPPING_ORDERING="" -COM_SUBUSERS_FORM_LBL_MAPPING_STATE="State" -COM_SUBUSERS_FORM_DESC_MAPPING_STATE="" - -; Organization form -COM_SUBUSERS_ORGANISATIONS_STATUS="Status" -COM_SUBUSERS_ADD_ORGANISATION="Add Organisation" -COM_SUBUSERS_EDIT_ORGANISATION="Edit Organisation" -COM_SUBUSERS_ORGANISATIONS="Organisations" -COM_SUBUSERS_NO_ORGANISATION_FOUND="No Organisation Found" -COM_SUBUSERS_VIEW_USER_LIST="View User List" -COM_SUBUSERS_USER_MODERATION="User Moderations" -COM_SUBUSERS_VIEW_ALL_MEMBERS="View All Members" -COM_SUBUSERS_FORM_LBL_ORGANISATION_ABOUT_US="About Us" -COM_SUBUSERS_FORM_DESC_ORGANISATION_ABOUT_US="About the Organisation" -COM_SUBUSERS_USERS_STATUS="Status" -COM_SUBUSERS_USERS_USER_EMAIL="User Email" -COM_SUBUSERS_FORM_LBL_USER_EMAIL="Email" -COM_SUBUSERS_FORM_DESC_USER_EMAIL="Add User email" -COM_SUBUSERS_FORM_LBL_USER_PASSWORD="Password" -COM_SUBUSERS_FORM_DESC_USER_PASSWORD="Add user password" -COM_SUBUSERS_FORM_LBL_USER_REPEAT_PASSWORD="Repeat Password" -COM_SUBUSERS_FORM_DESC_USER_REPEAT_PASSWORD="Confirm password" -COM_SUBUSERS_FORM_LBL_USER_ROLE_ID="Role" -COM_SUBUSERS_FORM_LBL_USER_CREATED_BY="Created by" -COM_SUBUSERS_USERS="Users" -COM_SUBUSERS_ADD_USER="Add User" -COM_SUBUSERS_EDIT_USER="Edit User" -COM_SUBUSERS_PLEASE_SELECT_ROLE="Select Role" -COM_SUBUSERS_PLEASE_SELECT_ORGANISATION="Select Organisation" -COM_SUBUSERS_FORM_LBL_USER_NAME="Name" -COM_SUBUSERS_FORM_DESC_USER_NAME="Enter name" -COM_SUBUSERS_FORM_LBL_USER_USERNAME="Username" -COM_SUBUSERS_FORM_DESC_USER_USERNAME="Enter username" -COM_SUBUSERS_USERS_USER_NAME="User Name" -COM_SUBUSERS_ORGANISATIONS_ADMIN="Organisation Admin" -COM_SUBUSERS_FORM_LBL_USERID="Organisation Admin" -COM_SUBUSERS_FORM_DESC_USERID="Choose user" -COM_SUBUSERS_SELECT_USER="Select Admin User" -COM_SUBUSERS_USER_PASSWORD="Password" -COM_SUBUSERS_USER_REPEAT_PASSWORD="Repeat Password" -COM_SUBUSERS_NO_USER_FOUND="No user found" -COM_SUBUSERS_FORM_LBL_ORGANISATION_ID_DESC="Organisation Id" -COM_SUBUSERS_LOGIN_MSG="You are not authorized user!" -; JS validation -COM_SUBUSER_MSG_ERR="Error" -COM_SUBUSERS_ORGANIZATION_ID_ALREADY_EXISTS="Entered organization id already exists" -COM_SUBUSERS_ORGANIZATION_EMAIL_ALREADY_EXISTS="Entered organization email already exists" - -; Mail -COM_SUBUSERS_REGISTRATION_USER="Hello {firstname},\n\n You have been added as a member to {sitename} by an Administrator .\n This email contains your username and password to log in to {register_url} .\n\n Username: {username}\npassword:{password}" -COM_SUBUSERS_REGISTRATION_SUBJECT="Ekstep : User Registration" -COM_SUBUSERS_FORM_DESC_USER_NAME="Enter name" -COM_SUBUSERS_FORM_LBL_USER_USERNAME="Username" -COM_SUBUSERS_FORM_DESC_USER_USERNAME="Enter username" -COM_SUBUSERS_USERS_USER_NAME="User Name" -COM_SUBUSERS_ALL_USERS="All Users" - -; Partner details -COM_SUBUSERS_ORGANISATION_ABOUT_US="About Us" -COM_SUBUSERS_APPLY_FOR_MEMBERSHIP="Apply For Membership" -COM_SUBUSERS_LOGIN_FIRST="You need to login first to apply for membership OR view memberlist, if you are already a member." -COM_SUBUSERS_SAME_PARTNER_MEMBER="You are already associated with this partner." -COM_SUBUSERS_ALREADY_MEMBER="You are already associated with another partner. So you can't apply for this partner." -COM_SUBUSERS_ORGANISATION_MEMBERS="Members" -COM_SUBUSERS_ORGANISATION_ANNOUNCEMENTS="Announcements" -COM_SUBUSERS_SEND_FOR_APPROVAL="Your request has been sent for approval." -COM_SUBUSERS_APPLY_SUCCESSFULY="You have successfully applied for membership." -COM_SUBUSERS_APPLY_FAILED="Something went wrong." -COM_SUBUSERS_ORGANISATION_APPLY="Membership" -COM_SUBUSERS_NO_MEMBERS="No Members Found" -COM_SUBUSERS_NOT_A_MEMBER="You are not associated with this partner. So you can not view the members." -COM_SUBUSERS_VIEW_ONCE_APPROVED="You will view members once your request gets approved." - -; Email validation and file changes -COM_SUBUSERS_REGISTRATION_USER_EXIST="Entered user name already exists" -COM_SUBUSERS_ORGANISATION_NAME="Organisation Name" -COM_SUBUSERS_EDIT_ORGANISATION="Edit Organisation"; -COM_SUBUSERS_EMAIL_ALREADY_EXISTS="Email already exists" -COM_SUBUSERS_USER_NAME_ALREADY_EXISTS="Entered user name already exists" -COM_SUBUSERS_PASSWORD_DOES_NOT_MATCH="Password and repeat password does not match" -COM_SUBUSERS_MEDIA_MAX_ALLOWED_SIZE="* Maximum allowed file size: %s MB" -COM_SUBUSERS_BTN_BROWSE="Browse" -COM_SUBUSERS_MAX_LOGO_TYPE_LBL="Allowed image types" -COM_SUBUSERS_MEDIA_LOGO_TYPES="* Allowed image types are: %s" - -; JS validation -COM_SUBUSERS_ERR_MSG_JS_FILE_TYPES="File type is not allowed!" -COM_SUBUSERS_ERR_MSG_JS_FILE_SIZE="File size is higher than the allowed size." -COM_SUBUSERS_FORM_LBL_ANNOUNCEMENT_TITLE="Title" -COM_SUBUSERS_FORM_DESC_ANNOUNCEMENT_TITLE="Enter Announcement Title" -COM_SUBUSERS_FORM_LBL_ANNOUNCEMENT_DESCRIPTION="Description" -COM_SUBUSERS_FORM_DESC_ANNOUNCEMENT_DESCRIPTION="Enter Announcement Description" -COM_SUBUSERS_ADD_ANNOUNCEMENT="Add" -COM_SUBUSERS_EDIT_ANNOUNCEMENT="Edit Announcement" -COM_SUBUSERS_ANNOUNCEMENTS="Announcements" -COM_SUBUSERS_NO_ANNOUNCEMENT_FOUND="No Data Found" -COM_SUBUSERS_ANNOUNCEMENT_TITLE="Announcement Title" -COM_SUBUSERS_ANNOUNCEMENT_DESCRIPTION="Announcement Description" -COM_SUBUSERS_ANNOUNCEMENT_ADMIN="Announcement Admin" -COM_SUBUSERS_ORGANISATION_ANNOUNCEMENTS="Announcements" -COM_SUBUSERS_ANNOUNCEMENTS_NOT_FOUND="No Data Found" -COM_SUBUSERS_ANNOUNCEMENTS_READ_MORE="Read More" -COM_SUBUSERS_PARTNER_ACTIONS="Partner Actions" -COM_SUBUSERS_PARTNER_CHILD_TELEMETRY="Child Telemetry" -COM_SUBUSERS_PARTNER_OPERATIONAL_DASHBOARD="Operational Dashboard" -COM_SUBUSERS_PARTNER_DISCUSSION_TITLE="Partner Discussions" - -;Page titles -COM_SUBUSERS_ORGANIZATION_FORM_PAGE_TITLE="Organizationform" -COM_SUBUSERS_USER_FORM_PAGE_TITLE="Userform" -COM_SUBUSERS_USERS_LIST_PAGE_TITLE="Users" -COM_SUBUSERS_ORGANIZATION_LIST_PAGE_TITLE="Organizations" diff --git a/src/media/css/form.css b/src/media/css/form.css deleted file mode 100644 index 20c8730..0000000 --- a/src/media/css/form.css +++ /dev/null @@ -1,44 +0,0 @@ -.front-end-edit ul { - padding: 0 !important; -} -.front-end-edit li { - list-style: none; - margin-bottom: 6px !important; -} -.front-end-edit label { - margin-right: 10px; - display: block; - float: left; - text-align: right; - width: 100px !important; -} -.front-end-edit .radio label { - float: none; -} -.front-end-edit .readonly { - border: none !important; - color: #666; -} -.front-end-edit #editor-xtd-buttons { - height: 50px; - width: 600px; - float: left; -} -.front-end-edit .toggle-editor { - height: 50px; - width: 120px; - float: right; -} - -#access-rules a:hover{ - background:#f5f5f5 url('../images/slider_minus.png') right top no-repeat; - color: #444; -} - -fieldset.radio label{ - width: 50px !important; -} - -form div.button-div{ - margin-left: 110px; -} \ No newline at end of file diff --git a/src/media/css/item.css b/src/media/css/item.css deleted file mode 100644 index f270884..0000000 --- a/src/media/css/item.css +++ /dev/null @@ -1,17 +0,0 @@ -.table{ - width: 100%; - margin-bottom: 18px; -} - -.table tr{ - border: none; -} - -.table td, .table th{ - padding: 8px; - line-height: 18px; - text-align: left; - vertical-align: top; - border: none; - border-top: 1px solid #ddd; -} \ No newline at end of file diff --git a/src/media/css/list.css b/src/media/css/list.css deleted file mode 100644 index 779c8bb..0000000 --- a/src/media/css/list.css +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @version CVS: 1.0.0 - * @package com_subusers - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - * @author Techjoomla - */ - -table.front-end-list{ - width: 100%; - border-spacing: 1px; - background-color: #f3f3f3; - color: #666; -} - -table.front-end-list thead th{ - text-align: center; - background: #f7f7f7; - color: #666; - border-bottom: 1px solid #ccc; - border-left: 1px solid #fff; -} - -table.front-end-list td, table.front-end-list th{ - padding: 4px; -} - -table.front-end-list thead th.align-left{ - text-align: left; -} - -table.front-end-list thead th.align-center, table.front-end-list tbody td.align-center { - text-align: center; -} - -table.front-end-list tbody tr td{ - background: #fff; - border: 1px solid #fff; -} - -table.front-end-list td{ - padding-left: 8px; -} - -div.list-footer{ - clear:both; - text-decoration: none; - text-align: center; -} - -div.list-footer ul{ - list-style: none; - display: inline-block; -} - -div.list-footer ul li{ - display: inline-block; -} - -div.list-footer div.limit{ - display: inline-block; -} - -div.list-footer div.counter{ - display: inline-block; -} - -div.filter-select.hide{ - display: none; -} - -div.filter-select.show{ - display: block; -} - -div.filter-search , div.filter-select { - float: left; - clear: both; -} - -div.filter-select .fltlft{ - float: left; - clear: both; -} - -div.field-filter{ - float: left; - margin: 10px; -} - -#filter-bar div.fltrt div.button2-left .blank a { - margin-top: 0 !important; -} - -button.open{ - font-weight: bold; -} - -div.field-filter:first-of-type{ - margin-left: 0; -} \ No newline at end of file diff --git a/src/media/js/form.js b/src/media/js/form.js deleted file mode 100644 index b530b0a..0000000 --- a/src/media/js/form.js +++ /dev/null @@ -1,19 +0,0 @@ -function getScript(url, success) { - var script = document.createElement('script'); - script.src = url; - var head = document.getElementsByTagName('head')[0], - done = false; - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function() { - if (!done && (!this.readyState - || this.readyState == 'loaded' - || this.readyState == 'complete')) { - done = true; - success(); - script.onload = script.onreadystatechange = null; - head.removeChild(script); - } - }; - head.appendChild(script); -} - diff --git a/src/site/controller.php b/src/site/controller.php deleted file mode 100755 index 3957c4a..0000000 --- a/src/site/controller.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -jimport('joomla.application.component.controller'); - -/** - * Class SubusersController - * - * @since 1.6 - */ -class SubusersController extends JControllerLegacy -{ - /** - * Method to display a view. - * - * @param boolean $cachable If true, the view output will be cached - * @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. - * - * @return JController This object to support chaining. - * - * @since 1.5 - */ - public function display($cachable = false, $urlparams = false) - { - require_once JPATH_COMPONENT . '/helpers/subusers.php'; - - $view = JFactory::getApplication()->input->getCmd('view', 'roles'); - JFactory::getApplication()->input->set('view', $view); - - parent::display($cachable, $urlparams); - - return $this; - } -} diff --git a/src/site/controllers/index.html b/src/site/controllers/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/controllers/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/controllers/role.php b/src/site/controllers/role.php deleted file mode 100755 index d7f9053..0000000 --- a/src/site/controllers/role.php +++ /dev/null @@ -1,176 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -require_once JPATH_COMPONENT . '/controller.php'; - -/** - * Role controller class. - * - * @since 1.6 - */ -class SubusersControllerRole extends SubusersController -{ - /** - * Method to check out an item for editing and redirect to the edit form. - * - * @return void - * - * @since 1.6 - */ - public function edit() - { - $app = JFactory::getApplication(); - - // Get the previous edit id (if any) and the current edit id. - $previousId = (int) $app->getUserState('com_subusers.edit.role.id'); - $editId = $app->input->getInt('id', 0); - - // Set the user id for the user to edit in the session. - $app->setUserState('com_subusers.edit.role.id', $editId); - - // Get the model. - $model = $this->getModel('Role', 'SubusersModel'); - - // Check out the item - if ($editId) - { - $model->checkout($editId); - } - - // Check in the previous user. - if ($previousId && $previousId !== $editId) - { - $model->checkin($previousId); - } - - // Redirect to the edit screen. - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=roleform&layout=edit', false)); - } - - /** - * Method to save a user's profile data. - * - * @return void - * - * @throws Exception - * @since 1.6 - */ - public function publish() - { - // Initialise variables. - $app = JFactory::getApplication(); - - // Checking if the user can remove object - $user = JFactory::getUser(); - - if ($user->authorise('core.edit', 'com_subusers') || $user->authorise('core.edit.state', 'com_subusers')) - { - $model = $this->getModel('Role', 'SubusersModel'); - - // Get the user data. - $id = $app->input->getInt('id'); - $state = $app->input->getInt('state'); - - // Attempt to save the data. - $return = $model->publish($id, $state); - - // Check for errors. - if ($return === false) - { - $this->setMessage(JText::sprintf('Save failed: %s', $model->getError()), 'warning'); - } - - // Clear the profile id from the session. - $app->setUserState('com_subusers.edit.role.id', null); - - // Flush the data from the session. - $app->setUserState('com_subusers.edit.role.data', null); - - // Redirect to the list screen. - $this->setMessage(JText::_('COM_SUBUSERS_ITEM_SAVED_SUCCESSFULLY')); - $menu = JFactory::getApplication()->getMenu(); - $item = $menu->getActive(); - - if (!$item) - { - // If there isn't any menu item active, redirect to list view - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=roles', false)); - } - else - { - $this->setRedirect(JRoute::_($item->link . $menuitemid, false)); - } - } - else - { - throw new Exception(500); - } - } - - /** - * Remove data - * - * @return void - * - * @throws Exception - */ - public function remove() - { - // Initialise variables. - $app = JFactory::getApplication(); - - // Checking if the user can remove object - $user = JFactory::getUser(); - - if ($user->authorise('core.delete', 'com_subusers')) - { - $model = $this->getModel('Role', 'SubusersModel'); - - // Get the user data. - $id = $app->input->getInt('id', 0); - - // Attempt to save the data. - $return = $model->delete($id); - - // Check for errors. - if ($return === false) - { - $this->setMessage(JText::sprintf('Delete failed', $model->getError()), 'warning'); - } - else - { - // Check in the profile. - if ($return) - { - $model->checkin($return); - } - - // Clear the profile id from the session. - $app->setUserState('com_subusers.edit.role.id', null); - - // Flush the data from the session. - $app->setUserState('com_subusers.edit.role.data', null); - - $this->setMessage(JText::_('COM_SUBUSERS_ITEM_DELETED_SUCCESSFULLY')); - } - - // Redirect to the list screen. - $menu = JFactory::getApplication()->getMenu(); - $item = $menu->getActive(); - $this->setRedirect(JRoute::_($item->link, false)); - } - else - { - throw new Exception(500); - } - } -} diff --git a/src/site/controllers/roleform.php b/src/site/controllers/roleform.php deleted file mode 100755 index 3402581..0000000 --- a/src/site/controllers/roleform.php +++ /dev/null @@ -1,262 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -require_once JPATH_COMPONENT . '/controller.php'; - -/** - * Role controller class. - * - * @since 1.6 - */ -class SubusersControllerRoleForm extends SubusersController -{ - /** - * Method to check out an item for editing and redirect to the edit form. - * - * @return void - * - * @since 1.6 - */ - public function edit() - { - $app = JFactory::getApplication(); - - // Get the previous edit id (if any) and the current edit id. - $previousId = (int) $app->getUserState('com_subusers.edit.role.id'); - $editId = $app->input->getInt('id', 0); - - // Set the user id for the user to edit in the session. - $app->setUserState('com_subusers.edit.role.id', $editId); - - // Get the model. - $model = $this->getModel('RoleForm', 'SubusersModel'); - - // Check out the item - if ($editId) - { - $model->checkout($editId); - } - - // Check in the previous user. - if ($previousId) - { - $model->checkin($previousId); - } - - // Redirect to the edit screen. - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=roleform&layout=edit', false)); - } - - /** - * Method to save a user's profile data. - * - * @return void - * - * @throws Exception - * @since 1.6 - */ - public function save() - { - // Check for request forgeries. - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - - // Initialise variables. - $app = JFactory::getApplication(); - $model = $this->getModel('RoleForm', 'SubusersModel'); - - // Get the user data. - $data = JFactory::getApplication()->input->get('jform', array(), 'array'); - - // Validate the posted data. - $form = $model->getForm(); - - if (!$form) - { - throw new Exception($model->getError(), 500); - } - - // Validate the posted data. - $data = $model->validate($form, $data); - - // Check for errors. - if ($data === false) - { - // Get the validation messages. - $errors = $model->getErrors(); - - // Push up to three validation messages out to the user. - for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) - { - if ($errors[$i] instanceof Exception) - { - $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); - } - else - { - $app->enqueueMessage($errors[$i], 'warning'); - } - } - - $input = $app->input; - $jform = $input->get('jform', array(), 'ARRAY'); - - // Save the data in the session. - $app->setUserState('com_subusers.edit.role.data', $jform); - - // Redirect back to the edit screen. - $id = (int) $app->getUserState('com_subusers.edit.role.id'); - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=roleform&layout=edit&id=' . $id, false)); - } - - // Attempt to save the data. - $return = $model->save($data); - - // Check for errors. - if ($return === false) - { - // Save the data in the session. - $app->setUserState('com_subusers.edit.role.data', $data); - - // Redirect back to the edit screen. - $id = (int) $app->getUserState('com_subusers.edit.role.id'); - $this->setMessage(JText::sprintf('Save failed', $model->getError()), 'warning'); - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=roleform&layout=edit&id=' . $id, false)); - } - - // Check in the profile. - if ($return) - { - $model->checkin($return); - } - - // Clear the profile id from the session. - $app->setUserState('com_subusers.edit.role.id', null); - - // Redirect to the list screen. - $this->setMessage(JText::_('COM_SUBUSERS_ITEM_SAVED_SUCCESSFULLY')); - $menu = JFactory::getApplication()->getMenu(); - $item = $menu->getActive(); - $url = (empty($item->link) ? 'index.php?option=com_subusers&view=roles' : $item->link); - $this->setRedirect(JRoute::_($url, false)); - - // Flush the data from the session. - $app->setUserState('com_subusers.edit.role.data', null); - } - - /** - * Method to abort current operation - * - * @return void - * - * @throws Exception - */ - public function cancel() - { - $app = JFactory::getApplication(); - - // Get the current edit id. - $editId = (int) $app->getUserState('com_subusers.edit.role.id'); - - // Get the model. - $model = $this->getModel('RoleForm', 'SubusersModel'); - - // Check in the item - if ($editId) - { - $model->checkin($editId); - } - - $menu = JFactory::getApplication()->getMenu(); - $item = $menu->getActive(); - $url = (empty($item->link) ? 'index.php?option=com_subusers&view=roles' : $item->link); - $this->setRedirect(JRoute::_($url, false)); - } - - /** - * Method to remove data - * - * @return void - * - * @throws Exception - */ - public function remove() - { - // Initialise variables. - $app = JFactory::getApplication(); - $model = $this->getModel('RoleForm', 'SubusersModel'); - - // Get the user data. - $data = array(); - $data['id'] = $app->input->getInt('id'); - - // Check for errors. - if (empty($data['id'])) - { - // Get the validation messages. - $errors = $model->getErrors(); - - // Push up to three validation messages out to the user. - for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) - { - if ($errors[$i] instanceof Exception) - { - $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); - } - else - { - $app->enqueueMessage($errors[$i], 'warning'); - } - } - - // Save the data in the session. - $app->setUserState('com_subusers.edit.role.data', $data); - - // Redirect back to the edit screen. - $id = (int) $app->getUserState('com_subusers.edit.role.id'); - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=role&layout=edit&id=' . $id, false)); - } - - // Attempt to save the data. - $return = $model->delete($data); - - // Check for errors. - if ($return === false) - { - // Save the data in the session. - $app->setUserState('com_subusers.edit.role.data', $data); - - // Redirect back to the edit screen. - $id = (int) $app->getUserState('com_subusers.edit.role.id'); - $this->setMessage(JText::sprintf('Delete failed', $model->getError()), 'warning'); - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=role&layout=edit&id=' . $id, false)); - } - - // Check in the profile. - if ($return) - { - $model->checkin($return); - } - - // Clear the profile id from the session. - $app->setUserState('com_subusers.edit.role.id', null); - - // Redirect to the list screen. - $this->setMessage(JText::_('COM_SUBUSERS_ITEM_DELETED_SUCCESSFULLY')); - $menu = JFactory::getApplication()->getMenu(); - $item = $menu->getActive(); - $url = (empty($item->link) ? 'index.php?option=com_subusers&view=roles' : $item->link); - $this->setRedirect(JRoute::_($url, false)); - - // Flush the data from the session. - $app->setUserState('com_subusers.edit.role.data', null); - } -} diff --git a/src/site/controllers/roles.php b/src/site/controllers/roles.php deleted file mode 100755 index 6d31773..0000000 --- a/src/site/controllers/roles.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -// No direct access. -defined('_JEXEC') or die; - -require_once JPATH_COMPONENT . '/controller.php'; - -/** - * Roles list controller class. - * - * @since 1.6 - */ -class SubusersControllerRoles extends SubusersController -{ - /** - * Proxy for getModel. - * - * @param string $name The model name. Optional. - * @param string $prefix The class prefix. Optional - * @param array $config Configuration array for model. Optional - * - * @return object The model - * - * @since 1.6 - */ - public function &getModel($name = 'Roles', $prefix = 'SubusersModel', $config = array()) - { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; - } -} diff --git a/src/site/controllers/user.php b/src/site/controllers/user.php deleted file mode 100755 index 6d335e6..0000000 --- a/src/site/controllers/user.php +++ /dev/null @@ -1,176 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -require_once JPATH_COMPONENT . '/controller.php'; - -/** - * User controller class. - * - * @since 1.6 - */ -class SubusersControllerUser extends SubusersController -{ - /** - * Method to check out an item for editing and redirect to the edit form. - * - * @return void - * - * @since 1.6 - */ - public function edit() - { - $app = JFactory::getApplication(); - - // Get the previous edit id (if any) and the current edit id. - $previousId = (int) $app->getUserState('com_subusers.edit.user.id'); - $editId = $app->input->getInt('id', 0); - - // Set the user id for the user to edit in the session. - $app->setUserState('com_subusers.edit.user.id', $editId); - - // Get the model. - $model = $this->getModel('User', 'SubusersModel'); - - // Check out the item - if ($editId) - { - $model->checkout($editId); - } - - // Check in the previous user. - if ($previousId && $previousId !== $editId) - { - $model->checkin($previousId); - } - - // Redirect to the edit screen. - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=userform&layout=edit', false)); - } - - /** - * Method to save a user's profile data. - * - * @return void - * - * @throws Exception - * @since 1.6 - */ - public function publish() - { - // Initialise variables. - $app = JFactory::getApplication(); - - // Checking if the user can remove object - $user = JFactory::getUser(); - - if ($user->authorise('core.edit', 'com_subusers') || $user->authorise('core.edit.state', 'com_subusers')) - { - $model = $this->getModel('User', 'SubusersModel'); - - // Get the user data. - $id = $app->input->getInt('id'); - $state = $app->input->getInt('state'); - - // Attempt to save the data. - $return = $model->publish($id, $state); - - // Check for errors. - if ($return === false) - { - $this->setMessage(JText::sprintf('Save failed: %s', $model->getError()), 'warning'); - } - - // Clear the profile id from the session. - $app->setUserState('com_subusers.edit.user.id', null); - - // Flush the data from the session. - $app->setUserState('com_subusers.edit.user.data', null); - - // Redirect to the list screen. - $this->setMessage(JText::_('COM_SUBUSERS_ITEM_SAVED_SUCCESSFULLY')); - $menu = JFactory::getApplication()->getMenu(); - $item = $menu->getActive(); - - if (!$item) - { - // If there isn't any menu item active, redirect to list view - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=users', false)); - } - else - { - $this->setRedirect(JRoute::_($item->link . $menuitemid, false)); - } - } - else - { - throw new Exception(500); - } - } - - /** - * Remove data - * - * @return void - * - * @throws Exception - */ - public function remove() - { - // Initialise variables. - $app = JFactory::getApplication(); - - // Checking if the user can remove object - $user = JFactory::getUser(); - - if ($user->authorise('core.delete', 'com_subusers')) - { - $model = $this->getModel('User', 'SubusersModel'); - - // Get the user data. - $id = $app->input->getInt('id', 0); - - // Attempt to save the data. - $return = $model->delete($id); - - // Check for errors. - if ($return === false) - { - $this->setMessage(JText::sprintf('Delete failed', $model->getError()), 'warning'); - } - else - { - // Check in the profile. - if ($return) - { - $model->checkin($return); - } - - // Clear the profile id from the session. - $app->setUserState('com_subusers.edit.user.id', null); - - // Flush the data from the session. - $app->setUserState('com_subusers.edit.user.data', null); - - $this->setMessage(JText::_('COM_SUBUSERS_ITEM_DELETED_SUCCESSFULLY')); - } - - // Redirect to the list screen. - $menu = JFactory::getApplication()->getMenu(); - $item = $menu->getActive(); - $this->setRedirect(JRoute::_($item->link, false)); - } - else - { - throw new Exception(500); - } - } -} diff --git a/src/site/controllers/userform.php b/src/site/controllers/userform.php deleted file mode 100755 index 0a8ce7d..0000000 --- a/src/site/controllers/userform.php +++ /dev/null @@ -1,326 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -require_once JPATH_COMPONENT . '/controller.php'; - -/** - * User controller class. - * - * @since 1.6 - */ -class SubusersControllerUserForm extends SubusersController -{ - /** - * Method to check out an item for editing and redirect to the edit form. - * - * @return void - * - * @since 1.6 - */ - public function edit() - { - $app = JFactory::getApplication(); - - // Get the previous edit id (if any) and the current edit id. - $previousId = (int) $app->getUserState('com_subusers.edit.user.id'); - $editId = $app->input->getInt('id', 0); - - // Set the user id for the user to edit in the session. - $app->setUserState('com_subusers.edit.user.id', $editId); - - // Get the model. - $model = $this->getModel('UserForm', 'SubusersModel'); - - // Check out the item - if ($editId) - { - $model->checkout($editId); - } - - // Check in the previous user. - if ($previousId) - { - $model->checkin($previousId); - } - - // Redirect to the edit screen. - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=userform&layout=edit', false)); - } - - /** - * Method to save a user's profile data. - * - * @return void - * - * @throws Exception - * @since 1.6 - */ - public function save() - { - // Check for request forgeries. - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - - // Initialise variables. - $app = JFactory::getApplication(); - $model = $this->getModel('UserForm', 'SubusersModel'); - - // Get the user data. - $data = JFactory::getApplication()->input->get('jform', array(), 'array'); - - // Validate the posted data. - $form = $model->getForm(); - - if (!$form) - { - throw new Exception($model->getError(), 500); - } - - // Validate the posted data. - $data = $model->validate($form, $data); - - // Check for errors. - if ($data === false) - { - // Get the validation messages. - $errors = $model->getErrors(); - - // Push up to three validation messages out to the user. - for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) - { - if ($errors[$i] instanceof Exception) - { - $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); - } - else - { - $app->enqueueMessage($errors[$i], 'warning'); - } - } - - $input = $app->input; - $jform = $input->get('jform', array(), 'ARRAY'); - - // Save the data in the session. - $app->setUserState('com_subusers.edit.user.data', $jform); - - // Redirect back to the edit screen. - $id = (int) $app->getUserState('com_subusers.edit.user.id'); - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=userform&layout=edit&id=' . $id, false)); - } - - // Attempt to save the data. - $return = $model->save($data); - - // Check for errors. - if ($return === false) - { - // Save the data in the session. - $app->setUserState('com_subusers.edit.user.data', $data); - - // Redirect back to the edit screen. - $id = (int) $app->getUserState('com_subusers.edit.user.id'); - $this->setMessage(JText::sprintf('Save failed', $model->getError()), 'warning'); - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=userform&layout=edit&id=' . $id, false)); - } - - // Check in the profile. - if ($return) - { - $model->checkin($return); - } - - // Clear the profile id from the session. - $app->setUserState('com_subusers.edit.user.id', null); - - // Redirect to the list screen. - $this->setMessage(JText::_('COM_SUBUSERS_ITEM_SAVED_SUCCESSFULLY')); - - // $menu = JFactory::getApplication()->getMenu(); - // $item = $menu->getActive(); - - // Redirect user to list view - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=users', false)); - - // Flush the data from the session. - $app->setUserState('com_subusers.edit.user.data', null); - } - - /** - * Method to abort current operation - * - * @return void - * - * @throws Exception - */ - public function cancel() - { - $app = JFactory::getApplication(); - - // Get the current edit id. - $editId = (int) $app->getUserState('com_subusers.edit.user.id'); - - // Get the model. - $model = $this->getModel('UserForm', 'SubusersModel'); - - // Check in the item - if ($editId) - { - $model->checkin($editId); - } - - $menu = JFactory::getApplication()->getMenu(); - $item = $menu->getActive(); - $url = (empty($item->link) ? 'index.php?option=com_subusers&view=users' : $item->link); - $this->setRedirect(JRoute::_($url, false)); - } - - /** - * Method to remove data - * - * @return void - * - * @throws Exception - */ - public function remove() - { - // Initialise variables. - $app = JFactory::getApplication(); - $model = $this->getModel('UserForm', 'SubusersModel'); - - // Get the user data. - $data = array(); - $data['id'] = $app->input->getInt('id'); - - // Check for errors. - if (empty($data['id'])) - { - // Get the validation messages. - $errors = $model->getErrors(); - - // Push up to three validation messages out to the user. - for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) - { - if ($errors[$i] instanceof Exception) - { - $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); - } - else - { - $app->enqueueMessage($errors[$i], 'warning'); - } - } - - // Save the data in the session. - $app->setUserState('com_subusers.edit.user.data', $data); - - // Redirect back to the edit screen. - $id = (int) $app->getUserState('com_subusers.edit.user.id'); - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=user&layout=edit&id=' . $id, false)); - } - - // Attempt to save the data. - $return = $model->delete($data); - - // Check for errors. - if ($return === false) - { - // Save the data in the session. - $app->setUserState('com_subusers.edit.user.data', $data); - - // Redirect back to the edit screen. - $id = (int) $app->getUserState('com_subusers.edit.user.id'); - $this->setMessage(JText::sprintf('Delete failed', $model->getError()), 'warning'); - $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=user&layout=edit&id=' . $id, false)); - } - - // Check in the profile. - if ($return) - { - $model->checkin($return); - } - - // Clear the profile id from the session. - $app->setUserState('com_subusers.edit.user.id', null); - - // Redirect to the list screen. - $this->setMessage(JText::_('COM_SUBUSERS_ITEM_DELETED_SUCCESSFULLY')); - $menu = JFactory::getApplication()->getMenu(); - $item = $menu->getActive(); - $url = (empty($item->link) ? 'index.php?option=com_subusers&view=users' : $item->link); - $this->setRedirect(JRoute::_($url, false)); - - // Flush the data from the session. - $app->setUserState('com_subusers.edit.user.data', null); - } - - /** - * Method to check out an email is already exist or not. - * - * @return void - * - * @since 1.6 - */ - public function validateEmail() - { - $app = JFactory::getApplication(); - $emailId = $app->input->get('email', '', 'STRING'); - - // Get the model. - $model = $this->getModel('UserForm', 'SubusersModel'); - - if ( $model->validateEmail($emailId)) - { - // If already present - echo "failure"; - exit(); - } - else - { - // New email id found - echo "success"; - exit(); - } - - exit; - } - - /** - * Method to check out an username is already exist or not. - * - * @return void - * - * @since 1.6 - */ - public function validateUserName() - { - $app = JFactory::getApplication(); - $userName = $app->input->get('username', '', 'STRING'); - - // Get the model. - $model = $this->getModel('UserForm', 'SubusersModel'); - - if ( $model->validateUserName($userName)) - { - // If already present - echo "failure"; - exit(); - } - else - { - // New user name found - echo "success"; - exit(); - } - - exit; - } -} diff --git a/src/site/controllers/users.php b/src/site/controllers/users.php deleted file mode 100755 index 552ecd3..0000000 --- a/src/site/controllers/users.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -// No direct access. -defined('_JEXEC') or die; - -require_once JPATH_COMPONENT . '/controller.php'; - -/** - * Users list controller class. - * - * @since 1.6 - */ -class SubusersControllerUsers extends SubusersController -{ - /** - * Proxy for getModel. - * - * @param string $name The model name. Optional. - * @param string $prefix The class prefix. Optional - * @param array $config Configuration array for model. Optional - * - * @return object The model - * - * @since 1.6 - */ - public function &getModel($name = 'Users', $prefix = 'SubusersModel', $config = array()) - { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; - } -} diff --git a/src/site/helpers/acl.php b/src/site/helpers/acl.php deleted file mode 100755 index efcefd1..0000000 --- a/src/site/helpers/acl.php +++ /dev/null @@ -1,226 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -defined('_JEXEC') or die; - -/** - * Class SubusersFrontendHelper - * - * @since 1.6 - */ -class SubusersAclHelper -{ - /** - * Check if logged in user is Organsiation admin - * - * @param string $uid user id - * - * @return role - */ - - public static function isOrganisationAdmin($uid) - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - - $query->select($db->quoteName('client_id')); - $query->select($db->quoteName('role_id')); - $query->from($db->quoteName('#__tjsu_users')); - $query->where($db->quoteName('role_id') . " = " . $db->quote('1')); - $query->where($db->quoteName('user_id') . " = " . $db->quote($uid)); - - $db->setQuery($query); - - $client = $db->loadObject(); - - // Get organisation name if logged user is admin - if ($client) - { - $query->select($db->quoteName('org.name')); - $query->from($db->quoteName('#__tjsu_organizations', 'org')); - $query->where($db->quoteName('org.id') . " = " . $db->quote($client->client_id)); - - $db->setQuery($query); - - $clientname = $db->loadObject(); - - if ($clientname) - { - return $clientname; - } - } - else - { - return false; - } - } - - /** - * Check if logged in user is Super admin - * - * @return user - */ - - public static function isSuperAdmin() - { - $user = JFactory::getUser(); - $groups = $user->groups; - - if (in_array(8, $groups) || in_array(21, $groups)) - { - return true; - } - } - - /** - * Check if logged in user is org member - * - * @param string $uid user id - * - * @return userid - */ - - public static function isOrgMember($uid) - { - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName('client_id')); - $query->from($db->quoteName('#__tjsu_users')); - $query->where($db->quoteName('user_id') . " = " . $uid); - $db->setQuery($query); - $user_id = $db->loadResult(); - - return $user_id; - } - - /** - * Get list of all organisation - * - * @return users - */ - public static function getAllOrganizations() - { - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - $query->select('id as value,name as text'); - $query->from('#__tjsu_organizations'); - $query->order('name ASC'); - $db->setQuery($query); - $orglist = $db->loadAssocList(); - $options = array(); - - $options[''] = JText::_('COM_SUBUSERS_ALL_USERS'); - - foreach ($orglist as $k => $val) - { - $options[$val['value']] = $val['text']; - } - - return $options; - } - - /** - * Get Easy social Group id and title - * - * @param string $orgId org id - * - * @return esIdAndName - */ - public static function getEasySocialGroup($orgId) - { - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - $query->select('a.id,a.title'); - $query->from('`#__social_clusters` AS a'); - $query->join('', $db->quoteName('#__es_group_xref', 'b') . 'ON' . $db->quoteName('b.grp_id') . '=' . $db->quoteName('a.id')); - $query->where($db->quoteName('client_id') . " = " . $orgId); - - $db->setQuery($query); - $esIdAndName = $db->loadObject(); - - return $esIdAndName; - } - - /** - * Get partner admin user id - * - * @param string $uid uid - * - * @param string $orgId orgid - * - * @return userId - */ - public static function isThisPartnerAdmin($uid, $orgId) - { - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName('user_id')); - $query->from($db->quoteName('#__tjsu_users')); - $query->where($db->quoteName('user_id') . " = " . $uid); - $query->where($db->quoteName('client_id') . " = " . $orgId); - $query->where($db->quoteName('role_id') . " = " . $db->quote('1')); - $db->setQuery($query); - $userId = $db->loadResult(); - - return $userId; - } - - /** - * Get partner admin name - * - * @param string $orgId orgId - * - * @return userId - */ - public static function partnerAdminName($orgId) - { - // Check org id is not null or not empty - if ($orgId !== null || $orgId !== "") - { - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - $subQuery = $db->getQuery(true); - - if ($subQuery) - { - $subQuery->select($db->quoteName('userid')) - ->from($db->quoteName('#__tjsu_organizations')) - ->where($db->quoteName('id') . " = " . $db->quote($orgId)); - $db->setQuery($subQuery); - $userId = $db->loadResult(); - } - - $query->select('id,name'); - $query->from($db->quoteName('#__users')); - $query->where($db->quoteName('id') . " = " . $db->quote($userId)); - $db->setQuery($query); - $userName = $db->loadObject(); - - return $userName; - } - else - { - return false; - } - } -} diff --git a/src/site/helpers/index.html b/src/site/helpers/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/helpers/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/helpers/subusers.php b/src/site/helpers/subusers.php deleted file mode 100755 index 7b82b53..0000000 --- a/src/site/helpers/subusers.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -defined('_JEXEC') or die; - -/** - * Class SubusersFrontendHelper - * - * @since 1.6 - */ -class SubusersFrontendHelper -{ - /** - * Get an instance of the named model - * - * @param string $name Model name - * - * @return null|object - */ - public static function getModel($name) - { - $model = null; - - // If the file exists, let's - if (file_exists(JPATH_SITE . '/components/com_subusers/models/' . strtolower($name) . '.php')) - { - require_once JPATH_SITE . '/components/com_subusers/models/' . strtolower($name) . '.php'; - $model = JModelLegacy::getInstance($name, 'SubusersModel'); - } - - return $model; - } - - /** - * Add menu - * - * @param string $vName Model name - * - * @return null|object - */ - - public static function addSubmenu($vName) - { - JHtmlSidebar::addEntry( - 'test', - 'index.php?option=com_subusers&view=users', - $vName == 'users' - ); - } - - /** - * Get language constant - * - * @return String - */ - - public static function getLanguageConstant() - { - // JS file upload - JText::script('COM_SUBUSERS_EMAIL_ALREADY_EXISTS'); - JText::script('COM_SUBUSERS_PASSWORD_DOES_NOT_MATCH'); - JText::script('COM_SUBUSERS_ERR_MSG_JS_FILE_TYPES'); - JText::script('COM_SUBUSERS_ERR_MSG_JS_FILE_SIZE'); - JText::script('COM_SUBUSERS_USER_NAME_ALREADY_EXISTS'); - - // Organization form - JText::script('COM_SUBUSERS_ORGANIZATION_ID_ALREADY_EXISTS'); - JText::script('COM_SUBUSERS_ORGANIZATION_EMAIL_ALREADY_EXISTS'); - JText::script('COM_SUBUSER_MSG_ERR'); - } -} diff --git a/src/site/helpers/users.php b/src/site/helpers/users.php deleted file mode 100755 index 12aee90..0000000 --- a/src/site/helpers/users.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -defined('_JEXEC') or die; - -/** - * Class SubusersFrontendHelper - * - * @since 1.6 - */ -class SubusersHelper -{ - /** - * Check if logged in user is Organsiation admin - * - * @param string $clientId client id - * - * @return role - */ - - public static function getGroupId($clientId) - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - - $query->select($db->quoteName('grp_id')); - $query->from($db->quoteName('#__es_group_xref')); - $query->where($db->quoteName('client_id') . " = " . $db->quote($clientId)); - - $db->setQuery($query); - - $groupId = $db->loadObject(); - - // Get groupId - if ($groupId) - { - return $groupId; - } - else - { - return false; - } - } -} diff --git a/src/site/index.html b/src/site/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/models/fields/createdby.php b/src/site/models/fields/createdby.php deleted file mode 100755 index f7c9956..0000000 --- a/src/site/models/fields/createdby.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('JPATH_BASE') or die; - -jimport('joomla.form.formfield'); - -/** - * Supports an HTML select list of categories - * - * @since 1.6 - */ -class JFormFieldCreatedby extends JFormField -{ - /** - * The form field type. - * - * @var string - * @since 1.6 - */ - protected $type = 'createdby'; - - /** - * Method to get the field input markup. - * - * @return string The field input markup. - * - * @since 1.6 - */ - protected function getInput() - { - // Initialize variables. - $html = array(); - - // Load user - $user_id = $this->value; - - if ($user_id) - { - $user = JFactory::getUser($user_id); - } - else - { - $user = JFactory::getUser(); - $html[] = ''; - } - - $html[] = "
" . $user->name . " (" . $user->username . ")
"; - - return implode($html); - } -} diff --git a/src/site/models/fields/filemultiple.php b/src/site/models/fields/filemultiple.php deleted file mode 100755 index cb2cc3a..0000000 --- a/src/site/models/fields/filemultiple.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('JPATH_BASE') or die; - -jimport('joomla.form.formfield'); - -/** - * Supports an HTML select list of categories - * - * @since 1.6 - */ -class JFormFieldFileMultiple extends JFormField -{ - /** - * The form field type. - * - * @var string - * @since 1.6 - */ - protected $type = 'file'; - - /** - * Method to get the field input markup. - * - * @return string The field input markup. - * - * @since 1.6 - */ - protected function getInput() - { - // Initialize variables. - $html = ''; - - return $html; - } -} diff --git a/src/site/models/fields/foreignkey.php b/src/site/models/fields/foreignkey.php deleted file mode 100755 index 3da0c90..0000000 --- a/src/site/models/fields/foreignkey.php +++ /dev/null @@ -1,142 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -defined('JPATH_BASE') or die; - -jimport('joomla.form.formfield'); - -/** - * Supports a value from an external table - * - * @since 1.6 - */ -class JFormFieldForeignKey extends JFormField -{ - /** - * The form field type. - * - * @var string - * @since 1.6 - */ - protected $type = 'foreignkey'; - - private $input_type; - - private $table; - - private $key_field; - - private $value_field; - - /** - * Method to get the field input markup. - * - * @return string The field input markup. - * - * @since 1.6 - */ - protected function getInput() - { - // Assign field properties. - // Type of input the field shows - $this->input_type = $this->getAttribute('input_type'); - - // Database Table - $this->table = $this->getAttribute('table'); - - // The field that the field will save on the database - $this->key_field = (string) $this->getAttribute('key_field'); - - // The column that the field shows in the input - $this->value_field = (string) $this->getAttribute('value_field'); - - // Initialize variables. - $html = ''; - - // Load all the field options - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - - $query - ->select( - array( - $db->quoteName($this->key_field), - $db->quoteName($this->value_field) - ) - ) - ->from($this->table); - - $db->setQuery($query); - $results = $db->loadObjectList(); - - $input_options = 'class="' . $this->getAttribute('class') . '"'; - - // Depends of the type of input, the field will show a type or another - switch ($this->input_type) - { - case 'list': - default: - $options = array(); - - // Iterate through all the results - foreach ($results as $result) - { - $options[] = JHtml::_('select.option', $result->{$this->key_field}, $result->{$this->value_field}); - } - - $value = $this->value; - - // If the value is a string -> Only one result - if (is_string($value)) - { - $value = array($value); - } - elseif (is_object($value)) - { - // If the value is an object, let's get its properties. - $value = get_object_vars($value); - } - - // If the select is multiple - if ($this->multiple) - { - $input_options .= 'multiple="multiple"'; - } - else - { - array_unshift($options, JHtml::_('select.option', '', '')); - } - - $html = JHtml::_('select.genericlist', $options, $this->name, $input_options, 'value', 'text', $value, $this->id); - break; - } - - return $html; - } - - /** - * Wrapper method for getting attributes from the form element - * - * @param string $attr_name Attribute name - * @param mixed $default Optional value to return if attribute not found - * - * @return mixed The value of the attribute if it exists, null otherwise - */ - public function getAttribute($attr_name, $default = null) - { - if (!empty($this->element[$attr_name])) - { - return $this->element[$attr_name]; - } - else - { - return $default; - } - } -} diff --git a/src/site/models/fields/index.html b/src/site/models/fields/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/models/fields/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/models/fields/modifiedby.php b/src/site/models/fields/modifiedby.php deleted file mode 100755 index 7dfb264..0000000 --- a/src/site/models/fields/modifiedby.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('JPATH_BASE') or die; - -jimport('joomla.form.formfield'); - -/** - * Supports an HTML select list of categories - * - * @since 1.6 - */ -class JFormFieldModifiedby extends JFormField -{ - /** - * The form field type. - * - * @var string - * @since 1.6 - */ - protected $type = 'modifiedby'; - - /** - * Method to get the field input markup. - * - * @return string The field input markup. - * - * @since 1.6 - */ - protected function getInput() - { - // Initialize variables. - $html = array(); - $user = JFactory::getUser(); - $html[] = ''; - $html[] = "
" . $user->name . " (" . $user->username . ")
"; - - return implode($html); - } -} diff --git a/src/site/models/fields/submit.php b/src/site/models/fields/submit.php deleted file mode 100755 index e030b49..0000000 --- a/src/site/models/fields/submit.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -// Check to ensure this file is included in Joomla! -defined('_JEXEC') or die('Restricted access'); - -jimport('joomla.form.formfield'); - -/** - * Class JFormFieldSubmit - * - * @since 1.6 - */ -class JFormFieldSubmit extends JFormField -{ - protected $type = 'submit'; - - protected $value; - - protected $for; - - /** - * Get a form field markup for the input - * - * @return string - */ - public function getInput() - { - $this->value = $this->getAttribute('value'); - - return ''; - } -} diff --git a/src/site/models/fields/timecreated.php b/src/site/models/fields/timecreated.php deleted file mode 100755 index 50186f7..0000000 --- a/src/site/models/fields/timecreated.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('JPATH_BASE') or die; - -jimport('joomla.form.formfield'); - -/** - * Supports an HTML select list of categories - * - * @since 1.6 - */ -class JFormFieldTimecreated extends JFormField -{ - /** - * The form field type. - * - * @var string - * @since 1.6 - */ - protected $type = 'timecreated'; - - /** - * Method to get the field input markup. - * - * @return string The field input markup. - * - * @since 1.6 - */ - protected function getInput() - { - // Initialize variables. - $html = array(); - - $time_created = $this->value; - - if (!strtotime($time_created)) - { - $time_created = JFactory::getDate()->toSql(); - $html[] = ''; - } - - $hidden = (boolean) $this->element['hidden']; - - if ($hidden == null || !$hidden) - { - $jdate = new JDate($time_created); - $pretty_date = $jdate->format(JText::_('DATE_FORMAT_LC2')); - $html[] = "
" . $pretty_date . "
"; - } - - return implode($html); - } -} diff --git a/src/site/models/fields/timeupdated.php b/src/site/models/fields/timeupdated.php deleted file mode 100755 index 31d244f..0000000 --- a/src/site/models/fields/timeupdated.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('JPATH_BASE') or die; - -jimport('joomla.form.formfield'); - -/** - * Supports an HTML select list of categories - * - * @since 1.6 - */ -class JFormFieldTimeupdated extends JFormField -{ - /** - * The form field type. - * - * @var string - * @since 1.6 - */ - protected $type = 'timeupdated'; - - /** - * Method to get the field input markup. - * - * @return string The field input markup. - * - * @since 1.6 - */ - protected function getInput() - { - // Initialize variables. - $html = array(); - - $old_time_updated = $this->value; - $hidden = (boolean) $this->element['hidden']; - - if ($hidden == null || !$hidden) - { - if (!strtotime($old_time_updated)) - { - $html[] = '-'; - } - else - { - $jdate = new JDate($old_time_updated); - $pretty_date = $jdate->format(JText::_('DATE_FORMAT_LC2')); - $html[] = "
" . $pretty_date . "
"; - } - } - - $time_updated = JFactory::getDate()->toSql(); - $html[] = ''; - - return implode($html); - } -} diff --git a/src/site/models/forms/filter_roles.xml b/src/site/models/forms/filter_roles.xml deleted file mode 100755 index 995dfa5..0000000 --- a/src/site/models/forms/filter_roles.xml +++ /dev/null @@ -1,11 +0,0 @@ - -
- - - - - - -
\ No newline at end of file diff --git a/src/site/models/forms/filter_users.xml b/src/site/models/forms/filter_users.xml deleted file mode 100755 index 995dfa5..0000000 --- a/src/site/models/forms/filter_users.xml +++ /dev/null @@ -1,11 +0,0 @@ - -
- - - - - - -
\ No newline at end of file diff --git a/src/site/models/forms/index.html b/src/site/models/forms/index.html deleted file mode 100755 index 2efb97f..0000000 --- a/src/site/models/forms/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/site/models/forms/roleform.xml b/src/site/models/forms/roleform.xml deleted file mode 100755 index eb04488..0000000 --- a/src/site/models/forms/roleform.xml +++ /dev/null @@ -1,50 +0,0 @@ - -
-
- - - - - - - - - - - - - - - - - - - -
- -
diff --git a/src/site/models/forms/userform.xml b/src/site/models/forms/userform.xml deleted file mode 100755 index bdd422a..0000000 --- a/src/site/models/forms/userform.xml +++ /dev/null @@ -1,86 +0,0 @@ - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
diff --git a/src/site/models/index.html b/src/site/models/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/models/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/models/role.php b/src/site/models/role.php deleted file mode 100755 index 02ef39c..0000000 --- a/src/site/models/role.php +++ /dev/null @@ -1,261 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access. -defined('_JEXEC') or die; - -jimport('joomla.application.component.modelitem'); -jimport('joomla.event.dispatcher'); - -use Joomla\Utilities\ArrayHelper; -/** - * Subusers model. - * - * @since 1.6 - */ -class SubusersModelRole extends JModelItem -{ - /** - * Method to auto-populate the model state. - * - * Note. Calling getState in this method will result in recursion. - * - * @return void - * - * @since 1.6 - * - */ - protected function populateState() - { - $app = JFactory::getApplication('com_subusers'); - - // Load state from the request userState on edit or from the passed variable on default - if (JFactory::getApplication()->input->get('layout') == 'edit') - { - $id = JFactory::getApplication()->getUserState('com_subusers.edit.role.id'); - } - else - { - $id = JFactory::getApplication()->input->get('id'); - JFactory::getApplication()->setUserState('com_subusers.edit.role.id', $id); - } - - $this->setState('role.id', $id); - - // Load the parameters. - $params = $app->getParams(); - $params_array = $params->toArray(); - - if (isset($params_array['item_id'])) - { - $this->setState('role.id', $params_array['item_id']); - } - - $this->setState('params', $params); - } - - /** - * Method to get an object. - * - * @param integer $id The id of the object to get. - * - * @return mixed Object on success, false on failure. - */ - public function &getData($id = null) - { - if ($this->_item === null) - { - $this->_item = false; - - if (empty($id)) - { - $id = $this->getState('role.id'); - } - - // Get a level row instance. - $table = $this->getTable(); - - // Attempt to load the row. - if ($table->load($id)) - { - // Check published state. - if ($published = $this->getState('filter.published')) - { - if ($table->state != $published) - { - return $this->_item; - } - } - - // Convert the JTable to a clean JObject. - $properties = $table->getProperties(1); - $this->_item = ArrayHelper::toObject($properties, 'JObject'); - } - } - - if (isset($this->_item->created_by) ) - { - $this->_item->created_by_name = JFactory::getUser($this->_item->created_by)->name; - } - - return $this->_item; - } - - /** - * Get an instance of JTable class - * - * @param string $type Name of the JTable class to get an instance of. - * @param string $prefix Prefix for the table class name. Optional. - * @param array $config Array of configuration values for the JTable object. Optional. - * - * @return JTable|bool JTable if success, false on failure. - */ - public function getTable($type = 'Role', $prefix = 'SubusersTable', $config = array()) - { - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_subusers/tables'); - - return JTable::getInstance($type, $prefix, $config); - } - - /** - * Get the id of an item by alias - * - * @param string $alias Item alias - * - * @return mixed - */ - public function getItemIdByAlias($alias) - { - $table = $this->getTable(); - - $table->load(array('alias' => $alias)); - - return $table->id; - } - - /** - * Method to check in an item. - * - * @param integer $id The id of the row to check out. - * - * @return boolean True on success, false on failure. - * - * @since 1.6 - */ - public function checkin($id = null) - { - // Get the id. - $id = (!empty($id)) ? $id : (int) $this->getState('role.id'); - - if ($id) - { - // Initialise the table - $table = $this->getTable(); - - // Attempt to check the row in. - if (method_exists($table, 'checkin')) - { - if (!$table->checkin($id)) - { - return false; - } - } - } - - return true; - } - - /** - * Method to check out an item for editing. - * - * @param integer $id The id of the row to check out. - * - * @return boolean True on success, false on failure. - * - * @since 1.6 - */ - public function checkout($id = null) - { - // Get the user id. - $id = (!empty($id)) ? $id : (int) $this->getState('role.id'); - - if ($id) - { - // Initialise the table - $table = $this->getTable(); - - // Get the current user object. - $user = JFactory::getUser(); - - // Attempt to check the row out. - if (method_exists($table, 'checkout')) - { - if (!$table->checkout($user->get('id'), $id)) - { - return false; - } - } - } - - return true; - } - - /** - * Get the name of a category by id - * - * @param int $id Category id - * - * @return Object|null Object if success, null in case of failure - */ - public function getCategoryName($id) - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - $query - ->select('title') - ->from('#__categories') - ->where('id = ' . $id); - $db->setQuery($query); - - return $db->loadObject(); - } - - /** - * Publish the element - * - * @param int $id Item id - * @param int $state Publish state - * - * @return boolean - */ - public function publish($id, $state) - { - $table = $this->getTable(); - $table->load($id); - $table->state = $state; - - return $table->store(); - } - - /** - * Method to delete an item - * - * @param int $id Element id - * - * @return bool - */ - public function delete($id) - { - $table = $this->getTable(); - - return $table->delete($id); - } - - -} diff --git a/src/site/models/roleform.php b/src/site/models/roleform.php deleted file mode 100755 index a536871..0000000 --- a/src/site/models/roleform.php +++ /dev/null @@ -1,366 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -// No direct access. -defined('_JEXEC') or die; - -jimport('joomla.application.component.modelform'); -jimport('joomla.event.dispatcher'); - -use Joomla\Utilities\ArrayHelper; -/** - * Subusers model. - * - * @since 1.6 - */ -class SubusersModelRoleForm extends JModelForm -{ - private $item = null; - - /** - * Method to auto-populate the model state. - * - * Note. Calling getState in this method will result in recursion. - * - * @return void - * - * @since 1.6 - */ - protected function populateState() - { - $app = JFactory::getApplication('com_subusers'); - - // Load state from the request userState on edit or from the passed variable on default - if (JFactory::getApplication()->input->get('layout') == 'edit') - { - $id = JFactory::getApplication()->getUserState('com_subusers.edit.role.id'); - } - else - { - $id = JFactory::getApplication()->input->get('id'); - JFactory::getApplication()->setUserState('com_subusers.edit.role.id', $id); - } - - $this->setState('role.id', $id); - - // Load the parameters. - $params = $app->getParams(); - $params_array = $params->toArray(); - - if (isset($params_array['item_id'])) - { - $this->setState('role.id', $params_array['item_id']); - } - - $this->setState('params', $params); - } - - /** - * Method to get an ojbect. - * - * @param integer $id The id of the object to get. - * - * @return Object|boolean Object on success, false on failure. - * - * @throws Exception - */ - public function &getData($id = null) - { - if ($this->item === null) - { - $this->item = false; - - if (empty($id)) - { - $id = $this->getState('role.id'); - } - - // Get a level row instance. - $table = $this->getTable(); - - // Attempt to load the row. - if ($table !== false && $table->load($id)) - { - $user = JFactory::getUser(); - $id = $table->id; - $canEdit = $user->authorise('core.edit', 'com_subusers') || $user->authorise('core.create', 'com_subusers'); - - if (!$canEdit && $user->authorise('core.edit.own', 'com_subusers')) - { - $canEdit = $user->id == $table->created_by; - } - - if (!$canEdit) - { - throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 500); - } - - // Check published state. - if ($published = $this->getState('filter.published')) - { - if ($table->state != $published) - { - return $this->item; - } - } - - // Convert the JTable to a clean JObject. - $properties = $table->getProperties(1); - $this->item = ArrayHelper::toObject($properties, 'JObject'); - } - } - - return $this->item; - } - - /** - * Method to get the table - * - * @param string $type Name of the JTable class - * @param string $prefix Optional prefix for the table class name - * @param array $config Optional configuration array for JTable object - * - * @return JTable|boolean JTable if found, boolean false on failure - */ - public function getTable($type = 'Role', $prefix = 'SubusersTable', $config = array()) - { - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_subusers/tables'); - - return JTable::getInstance($type, $prefix, $config); - } - - /** - * Get an item by alias - * - * @param string $alias Alias string - * - * @return int Element id - */ - public function getItemIdByAlias($alias) - { - $table = $this->getTable(); - - $table->load(array('alias' => $alias)); - - return $table->id; - } - - /** - * Method to check in an item. - * - * @param integer $id The id of the row to check out. - * - * @return boolean True on success, false on failure. - * - * @since 1.6 - */ - public function checkin($id = null) - { - // Get the id. - $id = (!empty($id)) ? $id : (int) $this->getState('role.id'); - - if ($id) - { - // Initialise the table - $table = $this->getTable(); - - // Attempt to check the row in. - if (method_exists($table, 'checkin')) - { - if (!$table->checkin($id)) - { - return false; - } - } - } - - return true; - } - - /** - * Method to check out an item for editing. - * - * @param integer $id The id of the row to check out. - * - * @return boolean True on success, false on failure. - * - * @since 1.6 - */ - public function checkout($id = null) - { - // Get the user id. - $id = (!empty($id)) ? $id : (int) $this->getState('role.id'); - - if ($id) - { - // Initialise the table - $table = $this->getTable(); - - // Get the current user object. - $user = JFactory::getUser(); - - // Attempt to check the row out. - if (method_exists($table, 'checkout')) - { - if (!$table->checkout($user->get('id'), $id)) - { - return false; - } - } - } - - return true; - } - - /** - * Method to get the profile form. - * - * The base form is loaded from XML - * - * @param array $data An optional array of data for the form to interogate. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * - * @return JForm A JForm object on success, false on failure - * - * @since 1.6 - */ - public function getForm($data = array(), $loadData = true) - { - // Get the form. - $form = $this->loadForm('com_subusers.role', 'roleform', array( - 'control' => 'jform', - 'load_data' => $loadData - ) - ); - - if (empty($form)) - { - return false; - } - - return $form; - } - - /** - * Method to get the data that should be injected in the form. - * - * @return mixed The data for the form. - * - * @since 1.6 - */ - protected function loadFormData() - { - $data = JFactory::getApplication()->getUserState('com_subusers.edit.role.data', array()); - - if (empty($data)) - { - $data = $this->getData(); - } - - return $data; - } - - /** - * Method to save the form data. - * - * @param array $data The form data - * - * @return bool - * - * @throws Exception - * @since 1.6 - */ - public function save($data) - { - $id = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('role.id'); - $state = (!empty($data['state'])) ? 1 : 0; - $user = JFactory::getUser(); - - if ($id) - { - // Check the user can edit this item - $authorised = $user->authorise('core.edit', 'com_subusers') || $authorised = $user->authorise('core.edit.own', 'com_subusers'); - - if ($user->authorise('core.edit.state', 'com_subusers') !== true && $state == 1) - { - // The user cannot edit the state of the item. - $data['state'] = 0; - } - } - else - { - // Check the user can create new items in this section - $authorised = $user->authorise('core.create', 'com_subusers'); - - if ($user->authorise('core.edit.state', 'com_subusers') !== true && $state == 1) - { - // The user cannot edit the state of the item. - $data['state'] = 0; - } - } - - if ($authorised !== true) - { - throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403); - } - - $table = $this->getTable(); - - if ($table->save($data) === true) - { - return $table->id; - } - else - { - return false; - } - } - - /** - * Method to delete data - * - * @param array $data Data to be deleted - * - * @return bool|int If success returns the id of the deleted item, if not false - * - * @throws Exception - */ - public function delete($data) - { - $id = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('role.id'); - - if (JFactory::getUser()->authorise('core.delete', 'com_subusers') !== true) - { - throw new Exception(403, JText::_('JERROR_ALERTNOAUTHOR')); - } - - $table = $this->getTable(); - - if ($table->delete($data['id']) === true) - { - return $id; - } - else - { - return false; - } - } - - /** - * Check if data can be saved - * - * @return bool - */ - public function getCanSave() - { - $table = $this->getTable(); - - return $table !== false; - } -} diff --git a/src/site/models/roles.php b/src/site/models/roles.php deleted file mode 100755 index 0de3fb6..0000000 --- a/src/site/models/roles.php +++ /dev/null @@ -1,305 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -defined('_JEXEC') or die; - -jimport('joomla.application.component.modellist'); - -/** - * Methods supporting a list of Subusers records. - * - * @since 1.6 - */ -class SubusersModelRoles extends JModelList -{ - /** - * Constructor. - * - * @param array $config An optional associative array of configuration settings. - * - * @see JController - * @since 1.6 - */ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( - 'id', 'a.id', - 'name', 'a.name', - 'client', 'a.client', - 'created_by', 'a.created_by', - 'ordering', 'a.ordering', - 'state', 'a.state', - ); - } - - parent::__construct($config); - } - - /** - * Method to auto-populate the model state. - * - * Note. Calling getState in this method will result in recursion. - * - * @param string $ordering Elements order - * @param string $direction Order direction - * - * @return void - * - * @throws Exception - * - * @since 1.6 - */ - protected function populateState($ordering = null, $direction = null) - { - // Initialise variables. - $app = JFactory::getApplication(); - - // List state information - $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit')); - $this->setState('list.limit', $limit); - - $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0); - $this->setState('list.start', $limitstart); - - if ($list = $app->getUserStateFromRequest($this->context . '.list', 'list', array(), 'array')) - { - foreach ($list as $name => $value) - { - // Extra validations - switch ($name) - { - case 'fullordering': - $orderingParts = explode(' ', $value); - - if (count($orderingParts) >= 2) - { - // Latest part will be considered the direction - $fullDirection = end($orderingParts); - - if (in_array(strtoupper($fullDirection), array('ASC', 'DESC', ''))) - { - $this->setState('list.direction', $fullDirection); - } - - unset($orderingParts[count($orderingParts) - 1]); - - // The rest will be the ordering - $fullOrdering = implode(' ', $orderingParts); - - if (in_array($fullOrdering, $this->filter_fields)) - { - $this->setState('list.ordering', $fullOrdering); - } - } - else - { - $this->setState('list.ordering', $ordering); - $this->setState('list.direction', $direction); - } - break; - - case 'ordering': - if (!in_array($value, $this->filter_fields)) - { - $value = $ordering; - } - break; - - case 'direction': - if (!in_array(strtoupper($value), array('ASC', 'DESC', ''))) - { - $value = $direction; - } - break; - - case 'limit': - $limit = $value; - break; - - // Just to keep the default case - default: - $value = $value; - break; - } - - $this->setState('list.' . $name, $value); - } - } - - // Receive & set filters - if ($filters = $app->getUserStateFromRequest($this->context . '.filter', 'filter', array(), 'array')) - { - foreach ($filters as $name => $value) - { - $this->setState('filter.' . $name, $value); - } - } - - $ordering = $app->input->get('filter_order'); - - if (!empty($ordering)) - { - $list = $app->getUserState($this->context . '.list'); - $list['ordering'] = $app->input->get('filter_order'); - $app->setUserState($this->context . '.list', $list); - } - - $orderingDirection = $app->input->get('filter_order_Dir'); - - if (!empty($orderingDirection)) - { - $list = $app->getUserState($this->context . '.list'); - $list['direction'] = $app->input->get('filter_order_Dir'); - $app->setUserState($this->context . '.list', $list); - } - - $list = $app->getUserState($this->context . '.list'); - - if (empty($list['ordering'])) - { - $list['ordering'] = 'ordering'; - } - - if (empty($list['direction'])) - { - $list['direction'] = 'asc'; - } - - if (isset($list['ordering'])) - { - $this->setState('list.ordering', $list['ordering']); - } - - if (isset($list['direction'])) - { - $this->setState('list.direction', $list['direction']); - } - } - - /** - * Build an SQL query to load the list data. - * - * @return JDatabaseQuery - * - * @since 1.6 - */ - protected function getListQuery() - { - // Create a new query object. - $db = $this->getDbo(); - $query = $db->getQuery(true); - - // Select the required fields from the table. - $query - ->select( - $this->getState( - 'list.select', 'DISTINCT a.*' - ) - ); - - $query->from('`#__tjsu_roles` AS a'); - - // Join over the users for the checked out user. - $query->select('uc.name AS editor'); - $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); - - // Join over the created by field 'created_by' - $query->join('LEFT', '#__users AS created_by ON created_by.id = a.created_by'); - - if (!JFactory::getUser()->authorise('core.edit.state', 'com_subusers')) - { - $query->where('a.state = 1'); - } - - // Filter by search in title - $search = $this->getState('filter.search'); - - if (!empty($search)) - { - if (stripos($search, 'id:') === 0) - { - $query->where('a.id = ' . (int) substr($search, 3)); - } - else - { - $search = $db->Quote('%' . $db->escape($search, true) . '%'); - $query->where('( a. name LIKE ' . $search . ' )'); - } - } - - // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering'); - $orderDirn = $this->state->get('list.direction'); - - if ($orderCol && $orderDirn) - { - $query->order($db->escape($orderCol . ' ' . $orderDirn)); - } - - return $query; - } - - /** - * Method to get an array of data items - * - * @return mixed An array of data on success, false on failure. - */ - public function getItems() - { - $items = parent::getItems(); - - return $items; - } - - /** - * Overrides the default function to check Date fields format, identified by - * "_dateformat" suffix, and erases the field if it's not correct. - * - * @return void - */ - protected function loadFormData() - { - $app = JFactory::getApplication(); - $filters = $app->getUserState($this->context . '.filter', array()); - $error_dateformat = false; - - foreach ($filters as $key => $value) - { - if (strpos($key, '_dateformat') && !empty($value) && $this->isValidDate($value) == null) - { - $filters[$key] = ''; - $error_dateformat = true; - } - } - - if ($error_dateformat) - { - $app->enqueueMessage(JText::_("COM_SUBUSERS_SEARCH_FILTER_DATE_FORMAT"), "warning"); - $app->setUserState($this->context . '.filter', $filters); - } - - return parent::loadFormData(); - } - - /** - * Checks if a given date is valid and in a specified format (YYYY-MM-DD) - * - * @param string $date Date to be checked - * - * @return bool - */ - private function isValidDate($date) - { - $date = str_replace('/', '-', $date); - - return (date_create($date)) ? JFactory::getDate($date)->format("Y-m-d") : null; - } -} diff --git a/src/site/models/user.php b/src/site/models/user.php deleted file mode 100755 index 4cc310f..0000000 --- a/src/site/models/user.php +++ /dev/null @@ -1,314 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access. -defined('_JEXEC') or die; - -jimport('joomla.application.component.modelitem'); -jimport('joomla.event.dispatcher'); - -use Joomla\Utilities\ArrayHelper; -/** - * Subusers model. - * - * @since 1.6 - */ -class SubusersModelUser extends JModelItem -{ - /** - * Method to auto-populate the model state. - * - * Note. Calling getState in this method will result in recursion. - * - * @return void - * - * @since 1.6 - * - */ - protected function populateState() - { - $app = JFactory::getApplication('com_subusers'); - - // Load state from the request userState on edit or from the passed variable on default - if (JFactory::getApplication()->input->get('layout') == 'edit') - { - $id = JFactory::getApplication()->getUserState('com_subusers.edit.user.id'); - } - else - { - $id = JFactory::getApplication()->input->get('id'); - JFactory::getApplication()->setUserState('com_subusers.edit.user.id', $id); - } - - $this->setState('user.id', $id); - - // Load the parameters. - $params = $app->getParams(); - $params_array = $params->toArray(); - - if (isset($params_array['item_id'])) - { - $this->setState('user.id', $params_array['item_id']); - } - - $this->setState('params', $params); - } - - /** - * Method to get an object. - * - * @param integer $id The id of the object to get. - * - * @return mixed Object on success, false on failure. - */ - public function &getData($id = null) - { - if ($this->_item === null) - { - $this->_item = false; - - if (empty($id)) - { - $id = $this->getState('user.id'); - } - - // Get a level row instance. - $table = $this->getTable(); - - // Attempt to load the row. - if ($table->load($id)) - { - // Check published state. - if ($published = $this->getState('filter.published')) - { - if ($table->state != $published) - { - return $this->_item; - } - } - - // Convert the JTable to a clean JObject. - $properties = $table->getProperties(1); - $this->_item = ArrayHelper::toObject($properties, 'JObject'); - } - } - - if (isset($this->_item->created_by) ) - { - $this->_item->created_by_name = JFactory::getUser($this->_item->created_by)->name; - } - - return $this->_item; - } - - /** - * Get an instance of JTable class - * - * @param string $type Name of the JTable class to get an instance of. - * @param string $prefix Prefix for the table class name. Optional. - * @param array $config Array of configuration values for the JTable object. Optional. - * - * @return JTable|bool JTable if success, false on failure. - */ - public function getTable($type = 'User', $prefix = 'SubusersTable', $config = array()) - { - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_subusers/tables'); - - return JTable::getInstance($type, $prefix, $config); - } - - /** - * Get the id of an item by alias - * - * @param string $alias Item alias - * - * @return mixed - */ - public function getItemIdByAlias($alias) - { - $table = $this->getTable(); - - $table->load(array('alias' => $alias)); - - return $table->id; - } - - /** - * Method to check in an item. - * - * @param integer $id The id of the row to check out. - * - * @return boolean True on success, false on failure. - * - * @since 1.6 - */ - public function checkin($id = null) - { - // Get the id. - $id = (!empty($id)) ? $id : (int) $this->getState('user.id'); - - if ($id) - { - // Initialise the table - $table = $this->getTable(); - - // Attempt to check the row in. - if (method_exists($table, 'checkin')) - { - if (!$table->checkin($id)) - { - return false; - } - } - } - - return true; - } - - /** - * Method to check out an item for editing. - * - * @param integer $id The id of the row to check out. - * - * @return boolean True on success, false on failure. - * - * @since 1.6 - */ - public function checkout($id = null) - { - // Get the user id. - $id = (!empty($id)) ? $id : (int) $this->getState('user.id'); - - if ($id) - { - // Initialise the table - $table = $this->getTable(); - - // Get the current user object. - $user = JFactory::getUser(); - - // Attempt to check the row out. - if (method_exists($table, 'checkout')) - { - if (!$table->checkout($user->get('id'), $id)) - { - return false; - } - } - } - - return true; - } - - /** - * Get the name of a category by id - * - * @param int $id Category id - * - * @return Object|null Object if success, null in case of failure - */ - public function getCategoryName($id) - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - $query - ->select('title') - ->from('#__categories') - ->where('id = ' . $id); - $db->setQuery($query); - - return $db->loadObject(); - } - - /** - * Publish the element - * - * @param int $id Item id - * @param int $state Publish state - * - * @return boolean - */ - public function publish($id, $state) - { - $table = $this->getTable(); - $table->load($id); - $table->state = $state; - - if ($id) - { - $tjsuAutoIncId = $id; - - // Get a db connection. - $db = JFactory::getDbo(); - - // Create object to update record - $query = $db->getQuery(true); - - // Create object to fetch user info - $subQuery = $db->getQuery(true); - $subsubquery = $db->getQuery(true); - - if ($subQuery) - { - // Sub query to select user id and client id from tjsu_user table - $subQuery->select('user_id,client_id') - ->from($db->quoteName('#__tjsu_users')) - ->where($db->quoteName('id') . " = " . $db->quote($tjsuAutoIncId)); - $db->setQuery($subQuery); - $userId = $db->loadObjectList(); - } - - foreach ($userId as $user) - { - $uId = $user->user_id; - $cId = $user->client_id; - } - - if ($subsubquery) - { - // Subsubquery to select grp id and client id from es_group_xref table - $subsubquery->select('grp_id') - ->from($db->quoteName('#__es_group_xref')) - ->where($db->quoteName('client_id') . " = " . $db->quote($cId)); - $db->setQuery($subsubquery); - $clusterId = $db->loadResult(); - } - - $fields = array($db->quoteName('state') . ' = ' . $db->quote($state)); - - // Uid = user_id is common in both tale - $conditions = array($db->quoteName('uid') . ' = ' . $db->quote($uId), - $db->quoteName('cluster_id') . ' = ' . $db->quote($clusterId) - ); - - // Main query to update record into social_clusters_nodes - $query->update($db->quoteName('#__social_clusters_nodes'))->set($fields)->where($conditions); - - $db->setQuery($query); - - $result = $db->execute(); - } - - return $table->store(); - } - - /** - * Method to delete an item - * - * @param int $id Element id - * - * @return bool - */ - public function delete($id) - { - $table = $this->getTable(); - - return $table->delete($id); - } -} diff --git a/src/site/models/userform.php b/src/site/models/userform.php deleted file mode 100755 index 06aa8ca..0000000 --- a/src/site/models/userform.php +++ /dev/null @@ -1,701 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -// No direct access. -defined('_JEXEC') or die; - -jimport('joomla.application.component.modelform'); -jimport('joomla.event.dispatcher'); - -use Joomla\Utilities\ArrayHelper; -/** - * Subusers model. - * - * @since 1.6 - */ - -class SubusersModelUserForm extends JModelForm -{ - private $item = null; - - /** - * Method to auto-populate the model state. - * - * Note. Calling getState in this method will result in recursion. - * - * @return void - * - * @since 1.6 - */ - protected function populateState() - { - $app = JFactory::getApplication('com_subusers'); - - // Load state from the request userState on edit or from the passed variable on default - if (JFactory::getApplication()->input->get('layout') == 'edit') - { - $id = JFactory::getApplication()->getUserState('com_subusers.edit.user.id'); - } - else - { - $id = JFactory::getApplication()->input->get('id'); - JFactory::getApplication()->setUserState('com_subusers.edit.user.id', $id); - } - - $this->setState('user.id', $id); - - // Load the parameters. - $params = $app->getParams(); - $params_array = $params->toArray(); - - if (isset($params_array['item_id'])) - { - $this->setState('user.id', $params_array['item_id']); - } - - $this->setState('params', $params); - } - - /** - * Method to get an ojbect. - * - * @param integer $id The id of the object to get. - * - * @return Object|boolean Object on success, false on failure. - * - * @throws Exception - */ - public function &getData($id = null) - { - if ($this->item === null) - { - $this->item = false; - - if (empty($id)) - { - $id = $this->getState('user.id'); - } - - // Get a level row instance. - $table = $this->getTable(); - - // Attempt to load the row. - if ($table !== false && $table->load($id)) - { - $user = JFactory::getUser(); - $id = $table->id; - $canEdit = $user->authorise('core.edit', 'com_subusers') || $user->authorise('core.create', 'com_subusers'); - - if (!$canEdit && $user->authorise('core.edit.own', 'com_subusers')) - { - $canEdit = $user->id == $table->created_by; - } - - if (!$canEdit) - { - throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 500); - } - - // Check published state. - if ($published = $this->getState('filter.published')) - { - if ($table->state != $published) - { - return $this->item; - } - } - - // Convert the JTable to a clean JObject. - $properties = $table->getProperties(1); - $this->item = ArrayHelper::toObject($properties, 'JObject'); - } - } - - return $this->item; - } - - /** - * Method to get the table - * - * @param string $type Name of the JTable class - * @param string $prefix Optional prefix for the table class name - * @param array $config Optional configuration array for JTable object - * - * @return JTable|boolean JTable if found, boolean false on failure - */ - public function getTable($type = 'User', $prefix = 'SubusersTable', $config = array()) - { - $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_subusers/tables'); - - return JTable::getInstance($type, $prefix, $config); - } - - /** - * Get an item by alias - * - * @param string $alias Alias string - * - * @return int Element id - */ - public function getItemIdByAlias($alias) - { - $table = $this->getTable(); - - $table->load(array('alias' => $alias)); - - return $table->id; - } - - /** - * Method to check in an item. - * - * @param integer $id The id of the row to check out. - * - * @return boolean True on success, false on failure. - * - * @since 1.6 - */ - public function checkin($id = null) - { - // Get the id. - $id = (!empty($id)) ? $id : (int) $this->getState('user.id'); - - if ($id) - { - // Initialise the table - $table = $this->getTable(); - - // Attempt to check the row in. - if (method_exists($table, 'checkin')) - { - if (!$table->checkin($id)) - { - return false; - } - } - } - - return true; - } - - /** - * Method to check out an item for editing. - * - * @param integer $id The id of the row to check out. - * - * @return boolean True on success, false on failure. - * - * @since 1.6 - */ - public function checkout($id = null) - { - // Get the user id. - $id = (!empty($id)) ? $id : (int) $this->getState('user.id'); - - if ($id) - { - // Initialise the table - $table = $this->getTable(); - - // Get the current user object. - $user = JFactory::getUser(); - - // Attempt to check the row out. - if (method_exists($table, 'checkout')) - { - if (!$table->checkout($user->get('id'), $id)) - { - return false; - } - } - } - - return true; - } - - /** - * Method to get the profile form. - * - * The base form is loaded from XML - * - * @param array $data An optional array of data for the form to interogate. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * - * @return JForm A JForm object on success, false on failure - * - * @since 1.6 - */ - public function getForm($data = array(), $loadData = true) - { - // Get the form. - $form = $this->loadForm('com_subusers.user', 'userform', array( - 'control' => 'jform', - 'load_data' => $loadData - ) - ); - - if (empty($form)) - { - return false; - } - - return $form; - } - - /** - * Method to get the data that should be injected in the form. - * - * @return mixed The data for the form. - * - * @since 1.6 - */ - protected function loadFormData() - { - $data = JFactory::getApplication()->getUserState('com_subusers.edit.user.data', array()); - - if (empty($data)) - { - $data = $this->getData(); - } - - return $data; - } - - /** - * Method to save the form data. - * - * @param array $data The form data - * - * @return bool - * - * @throws Exception - * @since 1.6 - */ - public function save($data) - { - $id = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('user.id'); - $state = (!empty($data['state'])) ? 1 : 0; - $user = JFactory::getUser(); - - // Added to fetch data of organsiation form - $input = JFactory::getApplication()->input; - $formData = new JRegistry($input->get('jform', '', 'array')); - - if ($id) - { - // Check the user can edit this item - $authorised = $user->authorise('core.edit', 'com_subusers') || $authorised = $user->authorise('core.edit.own', 'com_subusers'); - - if ($user->authorise('core.edit.state', 'com_subusers') !== true && $state == 1) - { - // The user cannot edit the state of the item. - $data['state'] = 0; - } - } - else - { - // Check the user can create new items in this section - $authorised = $user->authorise('core.create', 'com_subusers'); - - if ($user->authorise('core.edit.state', 'com_subusers') !== true && $state == 1) - { - // The user cannot edit the state of the item. - $data['state'] = 0; - } - } - - if ($authorised !== true) - { - throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403); - } - - // Joomla user entry - - $db = JFactory::getDBO(); - $query = "SELECT id FROM #__users WHERE email = '" . $formData->get('email', '', 'STRING') . "' - or username = '" . $formData->get('username', '', 'STRING') . "'"; - $this->_db->setQuery($query); - $userexist = $this->_db->loadResult(); - $userid = ""; - $randomPassword = ""; - - if (!$userexist) - { - // $pass = $formData->get('pass', null, null); - $password = $formData->get('password', null, null); - - // Generate the random password & create a new user - if (!$password) - { - $randomPassword = $this->rand_str(6); - $userid = $this->createnewuser($data, $randomPassword); - } - else - { - $randomPassword = $password; - $userid = $this->createnewuser($data, $randomPassword); - } - } - else - { - $application = JFactory::getApplication(); - $application->enqueueMessage(JText::_('COM_SUBUSERS_REGISTRATION_USER_EXIST'), 'error'); - - $mainframe = JFactory::getApplication(); - $mainframe->redirect('index.php?option=com_subusers&view=userform&layout=edit&Itemid=207'); - - return false; - } - - // Enter data into the tjsu_user table - $table = $this->getTable(); - - if ($userid) - { - $userdata = new stdClass; - $userdata->user_id = $userid; - $userdata->client = 'com_subusers.organisation'; - $userdata->client_id = $formData->get('client_id', '', 'INT'); - $userdata->role_id = $formData->get('role_id', '', 'INT'); - $userdata->created_by = $user->id; - $userdata->ordering = '2'; - $userdata->state = '1'; - - // Insert the object into the user profile table. - $result = JFactory::getDBO()->insertObject('#__tjsu_users', $userdata); - - if ($result) - { - // Add user easysocial organisation group - jimport('techjoomla.jsocial.jsocial'); - jimport('techjoomla.jsocial.easysocial'); - - $clientId = $formData->get('client_id', 'string'); - - // Users helper call - To get group id of organisation - $usershelperPath = JPATH_SITE . '/components/com_subusers/helpers/users.php'; - - if (!class_exists('SubusersHelper')) - { - // Require_once $path; - JLoader::register('SubusersHelper', $usershelperPath); - JLoader::load('SubusersHelper'); - } - - $usershelper = new SubusersHelper; - $grpId = $usershelper->getGroupId($clientId); - - $groupId = $grpId->grp_id; - $memberID = JFactory::getUser($userid); - - // Create object - $jsSocialEasysocialObj = new JSocialEasysocial; - $addmember = $jsSocialEasysocialObj->addMemberToGroup($groupId, $memberID); - - if ($addmember) - { - $this->SendMailNewUser($data, $randomPassword); - /** - * One partner have multiple admin's but one user cannot be admin of multiple partners - * if existing partner admin add new user as admin in his partner group, then newly added - * user should be admin of easy social group. - */ - - if ($userdata->role_id == '1') - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create object to update record - $query = $db->getQuery(true); - $admin = $userdata->role_id; - $newUser = $userdata->user_id; - $fields = ($db->quoteName('admin') . ' = ' . $db->quote($admin)); - $conditions = array($db->quoteName('uid') . ' = ' . $db->quote($newUser), - $db->quoteName('cluster_id') . ' = ' . $db->quote($groupId) - ); - $query->update($db->quoteName('#__social_clusters_nodes'))->set($fields)->where($conditions); - $db->setQuery($query); - $result = $db->execute(); - } - else - { - return false; - } - - return $result; - } - else - { - return false; - } - } - else - { - return false; - } - } - else - { - return false; - } - } - - /** - * Method to delete data - * - * @param array $data Data to be deleted - * - * @return bool|int If success returns the id of the deleted item, if not false - * - * @throws Exception - */ - public function delete($data) - { - $id = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('user.id'); - - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - - $query->select($db->quoteName('user_id')); - $query->from('#__tjsu_users'); - $query->where($db->quoteName('id') . " = " . $id); - $db->setQuery($query); - $user_id = $db->loadResult(); - - if ($user_id) - { - $query = $db->getQuery(true); - $query->delete($db->quoteName('#__social_clusters_nodes')); - $query->where($db->quoteName('uid') . " = " . $user_id); - $db->setQuery($query); - $cluster = $db->execute(); - } - - if (JFactory::getUser()->authorise('core.delete', 'com_subusers') !== true) - { - throw new Exception(403, JText::_('JERROR_ALERTNOAUTHOR')); - } - - $table = $this->getTable(); - - if ($table->delete($data['id']) === true) - { - return $id; - } - else - { - return false; - } - } - - /** - * Check if data can be saved - * - * @return bool - */ - public function getCanSave() - { - $table = $this->getTable(); - - return $table !== false; - } - - /** - * Method to create the new user. - * - * @param array $data The form data - * - * @param vachar $randomPassword randam password - * - * @return userid - * - * @throws Exception - * @since 1.6 - */ - public function createnewuser($data, $randomPassword) - { - jimport('joomla.user.helper'); - jimport('joomla.application.component.helper'); - - $authorize = JFactory::getACL(); - $user = clone JFactory::getUser(); - - // Added to fetch data of organsiation form - $input = JFactory::getApplication()->input; - $formData = new JRegistry($input->get('jform', '', 'array')); - - $user->set('id', ''); - $user->set('usertype', 'Registered'); - $params = JComponentHelper::getParams('com_subusers'); - - // Set user group - $default_usergroup = $params->get('guest_usergroup', 2); - $user->set('groups', array($default_usergroup)); - $user->set('username', $formData->get('username', '', 'STRING')); - $password = $formData->get('password', '', 'STRING'); - - // Check if password is entered - if ($password) - { - $user->set('password', md5($password)); - } - else - { - $user->set('password', md5($randomPassword)); - } - - $user->set('name', $formData->get('name', '', 'STRING')); - $user->set('email', $formData->get('email', '', 'STRING')); - - $message = ''; - - $date = JFactory::getDate(); - $user->set('registerDate', $date->toSql()); - - // True on success, false otherwise - if (!$user->save()) - { - echo $message = JText::_('COM_SUBUSERS_REGISTRATION_USER_EXIST') . $user->getError(); - - return false; - } - else - { - $message = JText::sprintf('COM_SUBUSERS_REGISTRATION_MESSAGE1', $user->username); - } - - return $user->id; - } - - /** - * Function to send mail to registered user - * - * @param array $data The form data - * - * @param vachar $randomPassword randam password - * - * @return userid - * - * @throws Exception - * @since 1.6 - */ - public function SendMailNewUser($data, $randomPassword) - { - $app = JFactory::getApplication(); - - // Added to fetch data of organsiation form - $input = JFactory::getApplication()->input; - $formData = new JRegistry($input->get('jform', '', 'array')); - $mailfrom = $app->getCfg('mailfrom'); - $fromname = $app->getCfg('fromname'); - $sitename = $app->getCfg('sitename'); - $email = $formData->get('email', '', 'STRING'); - $subject = JText::_('COM_SUBUSERS_REGISTRATION_SUBJECT'); - $find1 = array('{sitename}'); - $replace1 = array($sitename); - $subject = str_replace($find1, $replace1, $subject); - $message = ''; - $message = JText::_('COM_SUBUSERS_REGISTRATION_USER'); - $find = array('{firstname}', '{sitename}', '{register_url}', '{username}', '{password}'); - $replace = array($formData->get('name', '', 'STRING'), $sitename, JUri::root(), $formData->get('username', '', 'STRING'), $randomPassword); - $message = str_replace($find, $replace, $message); - - JFactory::getMailer()->sendMail($mailfrom, $fromname, $email, $subject, $message); - - return true; - } - - /** - * Create a random character generator for password - * - * @param string $length Default length - * - * @param string $chars Default character string - * - * @return string - * - * @since 1.6 - */ - public function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890') - { - // Length of character list - $chars_length = (strlen($chars) - 1); - - // Start our string - $string = $chars{rand(0, $chars_length)}; - - // Generate random string - for ($i = 1; $i < $length; $i = strlen($string)) - { - // Grab a random character from our list - $r = $chars{rand(0, $chars_length)}; - - // Make sure the same two characters don't appear next to each other - if ($r != $string{$i - 1}) - { - $string .= $r; - } - } - // Return the string - return $string; - } - - /** - * To check if entered is valid email address - * - * @param string $emailId Eamilid - * - * @return boolean - * - * @since 1.6 - */ - public function validateEmail($emailId) - { - $query = "SELECT id FROM #__users WHERE email = '" . $emailId . "'"; - $this->_db->setQuery($query); - $userexist = $this->_db->loadResult(); - $userid = ""; - - if ($userexist) - { - return true; - } - else - { - return false; - } - } - - /** - * To check if entered is valid user name - * - * @param string $userName Eamilid - * - * @return boolean - * - * @since 1.6 - */ - public function validateUserName($userName) - { - $query = "SELECT id FROM #__users WHERE username = '" . $userName . "'"; - $this->_db->setQuery($query); - $userexists = $this->_db->loadResult(); - $userid = ""; - - if ($userexists) - { - return true; - } - else - { - return false; - } - } -} diff --git a/src/site/models/users.php b/src/site/models/users.php deleted file mode 100755 index baf8e47..0000000 --- a/src/site/models/users.php +++ /dev/null @@ -1,371 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -defined('_JEXEC') or die; - -jimport('joomla.application.component.modellist'); - -/** - * Methods supporting a list of Subusers records. - * - * @since 1.6 - */ -class SubusersModelUsers extends JModelList -{ - /** - * Constructor. - * - * @param array $config An optional associative array of configuration settings. - * - * @see JController - * @since 1.6 - */ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( - 'id', 'a.id', - 'user_id', 'a.user_id', - 'client', 'a.client', - 'client_id', 'a.client_id', - 'role_id', 'a.role_id', - 'created_by', 'a.created_by', - 'ordering', 'a.ordering', - 'state', 'a.state', - ); - } - - parent::__construct($config); - } - - /** - * Method to auto-populate the model state. - * - * Note. Calling getState in this method will result in recursion. - * - * @param string $ordering Elements order - * @param string $direction Order direction - * - * @return void - * - * @throws Exception - * - * @since 1.6 - */ - protected function populateState($ordering = null, $direction = null) - { - // Initialise variables. - $app = JFactory::getApplication(); - - // List state information - $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit')); - $this->setState('list.limit', $limit); - - $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0); - $this->setState('list.start', $limitstart); - - if ($list = $app->getUserStateFromRequest($this->context . '.list', 'list', array(), 'array')) - { - foreach ($list as $name => $value) - { - // Extra validations - switch ($name) - { - case 'fullordering': - $orderingParts = explode(' ', $value); - - if (count($orderingParts) >= 2) - { - // Latest part will be considered the direction - $fullDirection = end($orderingParts); - - if (in_array(strtoupper($fullDirection), array('ASC', 'DESC', ''))) - { - $this->setState('list.direction', $fullDirection); - } - - unset($orderingParts[count($orderingParts) - 1]); - - // The rest will be the ordering - $fullOrdering = implode(' ', $orderingParts); - - if (in_array($fullOrdering, $this->filter_fields)) - { - $this->setState('list.ordering', $fullOrdering); - } - } - else - { - $this->setState('list.ordering', $ordering); - $this->setState('list.direction', $direction); - } - break; - - case 'ordering': - if (!in_array($value, $this->filter_fields)) - { - $value = $ordering; - } - break; - - case 'direction': - if (!in_array(strtoupper($value), array('ASC', 'DESC', ''))) - { - $value = $direction; - } - break; - - case 'limit': - $limit = $value; - break; - - // Just to keep the default case - default: - $value = $value; - break; - } - - $this->setState('list.' . $name, $value); - } - } - - // Receive & set filters - if ($filters = $app->getUserStateFromRequest($this->context . '.filter', 'filter', array(), 'array')) - { - foreach ($filters as $name => $value) - { - $this->setState('filter.' . $name, $value); - } - } - - $ordering = $app->input->get('filter_order'); - - if (!empty($ordering)) - { - $list = $app->getUserState($this->context . '.list'); - $list['ordering'] = $app->input->get('filter_order'); - $app->setUserState($this->context . '.list', $list); - } - - $orderingDirection = $app->input->get('filter_order_Dir'); - - if (!empty($orderingDirection)) - { - $list = $app->getUserState($this->context . '.list'); - $list['direction'] = $app->input->get('filter_order_Dir'); - $app->setUserState($this->context . '.list', $list); - } - - $list = $app->getUserState($this->context . '.list'); - - if (empty($list['ordering'])) - { - $list['ordering'] = 'ordering'; - } - - if (empty($list['direction'])) - { - $list['direction'] = 'asc'; - } - - if (isset($list['ordering'])) - { - $this->setState('list.ordering', $list['ordering']); - } - - if (isset($list['direction'])) - { - $this->setState('list.direction', $list['direction']); - } - } - - /** - * Build an SQL query to load the list data. - * - * @return JDatabaseQuery - * - * @since 1.6 - */ - protected function getListQuery() - { - // If Super user is logged then show organization wise user - $jinput = JFactory::getApplication()->input; - $org_id = $jinput->get('orgid', '', 'INT'); - - require_once JPATH_COMPONENT . '/helpers/acl.php'; - - // If logged user is Super User or Admin - $user = JFactory::getUser(); - $uid = $user->id; - - $this->isAdmin = SubusersAclHelper::isOrganisationAdmin($uid); - $this->isOrgMember = SubusersAclHelper::isOrgMember($uid); - $this->isSuperAdmin = SubusersAclHelper::isSuperAdmin($uid); - - $db = $this->getDbo(); - $query = $db->getQuery(true); - - // Select the required fields from the table. - $query - ->select( - $this->getState( - 'list.select', 'DISTINCT a.*' - ) - ); - - $query->from('`#__tjsu_users` AS a'); - - // Join over the users for the checked out user. - $query->select('uc.name AS name,uc.email,role.name,org.name as orgname'); - - // Join over the created by field 'created_by' - $query->join('LEFT', '#__users AS uc ON uc.id = a.user_id'); - - // Join over the organization table to fetch organization table. - $query->join('LEFT', '#__tjsu_organizations AS org ON org.id = a.client_id'); - - // Join over the created by field 'role id' - $query->join('LEFT', '#__tjsu_roles AS role ON role.id = a.role_id'); - - if (!JFactory::getUser()->authorise('core.edit.state', 'com_subusers')) - { - $query->where('a.state = 1'); - } - - if ($org_id) - { - $query->where('a.client_id = ' . $org_id); - } - // If logged user is super user - elseif (isset($this->isSuperAdmin)) - { - // Filter for super user to view all user partner wise - $mainframe = JFactory::getApplication(); - $orgsearch = $mainframe->getUserStateFromRequest('.filter.search', 'filter_org_search'); - - // If filter set - if ($orgsearch) - { - // Fetch users from tjsu_users table by client_id (filter) wise - $query->where('a.client_id = ' . $orgsearch); - } - // Fetch all publish/unpublish users - $query->where('a.state IN (1,0) '); - } - // If logged in user is admin of any partner - elseif (isset($this->isAdmin->client_id) && empty($this->isSuperAdmin)) - { - // Find client_id of admin user - $client_id = $this->isAdmin->client_id; - - // Fetch only respected client_id/partner users - $query->where('a.client_id = ' . $client_id); - } - else - { - // If logged in user is member of any partner - if ($this->isOrgMember) - { - // Fetch their partner users only - $query->where('a.client_id = ' . $this->isOrgMember); - } - else - { - // If logged in user none of above then redirect to - $mainframe = JFactory::getApplication(); - $mainframe->redirect("index.php?option=com_easysocial&view=groups"); - } - } - - // Filter by search in organisation name - $mainframe = JFactory::getApplication(); - $search = $mainframe->getUserStateFromRequest('.filter.search', 'filter_user_search'); - - if (!empty($search)) - { - if (stripos($search, 'id:') === 0) - { - $query->where('a.id = ' . (int) substr($search, 3)); - } - else - { - $search = $db->Quote('%' . $db->escape($search, true) . '%'); - $query->where('( uc. name OR uc. email LIKE ' . $search . ' )'); - } - } - - // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering'); - $orderDirn = $this->state->get('list.direction'); - - if ($orderCol && $orderDirn) - { - $query->order($db->escape($orderCol . ' ' . $orderDirn)); - } - - return $query; - } - - /** - * Method to get an array of data items - * - * @return mixed An array of data on success, false on failure. - */ - public function getItems() - { - $items = parent::getItems(); - - return $items; - } - - /** - * Overrides the default function to check Date fields format, identified by - * "_dateformat" suffix, and erases the field if it's not correct. - * - * @return void - */ - protected function loadFormData() - { - $app = JFactory::getApplication(); - $filters = $app->getUserState($this->context . '.filter', array()); - $error_dateformat = false; - - foreach ($filters as $key => $value) - { - if (strpos($key, '_dateformat') && !empty($value) && $this->isValidDate($value) == null) - { - $filters[$key] = ''; - $error_dateformat = true; - } - } - - if ($error_dateformat) - { - $app->enqueueMessage(JText::_("COM_SUBUSERS_SEARCH_FILTER_DATE_FORMAT"), "warning"); - $app->setUserState($this->context . '.filter', $filters); - } - - return parent::loadFormData(); - } - - /** - * Checks if a given date is valid and in a specified format (YYYY-MM-DD) - * - * @param string $date Date to be checked - * - * @return bool - */ - private function isValidDate($date) - { - $date = str_replace('/', '-', $date); - - return (date_create($date)) ? JFactory::getDate($date)->format("Y-m-d") : null; - } -} diff --git a/src/site/router.php b/src/site/router.php deleted file mode 100755 index 3e66494..0000000 --- a/src/site/router.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -JLoader::register('SubusersFrontendHelper', JPATH_BASE . '/components/com_subusers/helpers/subusers.php'); - -/** - * Class SubusersRouter - * - * @since 3.3 - */ -class SubusersRouter extends JComponentRouterBase -{ - /** - * Build method for URLs - * This method is meant to transform the query parameters into a more human - * readable form. It is only executed when SEF mode is switched on. - * - * @param array &$query An array of URL arguments - * - * @return array The URL arguments to use to assemble the subsequent URL. - * - * @since 3.3 - */ - public function build(&$query) - { - $segments = array(); - $view = null; - - if (isset($query['task'])) - { - $taskParts = explode('.', $query['task']); - $segments[] = implode('/', $taskParts); - $view = $taskParts[0]; - unset($query['task']); - } - - if (isset($query['view'])) - { - $segments[] = $query['view']; - $view = $query['view']; - unset($query['view']); - } - - if (isset($query['id'])) - { - if ($view !== null) - { - $segments[] = $query['id']; - } - else - { - $segments[] = $query['id']; - } - - unset($query['id']); - } - - return $segments; - } - - /** - * Parse method for URLs - * This method is meant to transform the human readable URL back into - * query parameters. It is only executed when SEF mode is switched on. - * - * @param array &$segments The segments of the URL to parse. - * - * @return array The URL attributes to be used by the application. - * - * @since 3.3 - */ - public function parse(&$segments) - { - $vars = array(); - - // View is always the first element of the array - $vars['view'] = array_shift($segments); - $model = SubusersFrontendHelper::getModel($vars['view']); - - while (!empty($segments)) - { - $segment = array_pop($segments); - - // If it's the ID, let's put on the request - if (is_numeric($segment)) - { - $vars['id'] = $segment; - } - else - { - $vars['task'] = $vars['view'] . '.' . $segment; - } - } - - return $vars; - } -} diff --git a/src/site/subusers.php b/src/site/subusers.php deleted file mode 100755 index 8b5ca49..0000000 --- a/src/site/subusers.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -// Include dependancies -jimport('joomla.application.component.controller'); - -JLoader::register('SubusersFrontendHelper', JPATH_COMPONENT . '/helpers/subusers.php'); - -// Execute the task. -$controller = JControllerLegacy::getInstance('Subusers'); -$controller->execute(JFactory::getApplication()->input->get('task')); -$controller->redirect(); diff --git a/src/site/views/index.html b/src/site/views/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/role/index.html b/src/site/views/role/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/role/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/role/tmpl/default.php b/src/site/views/role/tmpl/default.php deleted file mode 100755 index b880488..0000000 --- a/src/site/views/role/tmpl/default.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -$canEdit = JFactory::getUser()->authorise('core.edit', 'com_subusers'); -if (!$canEdit && JFactory::getUser()->authorise('core.edit.own', 'com_subusers')) { - $canEdit = JFactory::getUser()->id == $this->item->created_by; -} -?> -item) : ?> - -
- - - - - - - - - - - - - - - - - - - - - - -
item->id; ?>
item->name; ?>
item->client; ?>
item->created_by_name; ?>
-
-
- item->checked_out == 0): ?> - - - authorise('core.delete','com_subusers')):?> - - - - - - - - - - -
- - -
-
-
diff --git a/src/site/views/role/tmpl/index.html b/src/site/views/role/tmpl/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/role/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/role/view.html.php b/src/site/views/role/view.html.php deleted file mode 100755 index e999cb4..0000000 --- a/src/site/views/role/view.html.php +++ /dev/null @@ -1,134 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -jimport('joomla.application.component.view'); - -/** - * View to edit - * - * @since 1.6 - */ -class SubusersViewRole extends JViewLegacy -{ - protected $state; - - protected $item; - - protected $form; - - protected $params; - - /** - * Display the view - * - * @param string $tpl Template name - * - * @return void - * - * @throws Exception - */ - public function display($tpl = null) - { - $app = JFactory::getApplication(); - $user = JFactory::getUser(); - - $this->state = $this->get('State'); - $this->item = $this->get('Data'); - $this->params = $app->getParams('com_subusers'); - - if (!empty($this->item)) - { - $this->form = $this->get('Form'); - } - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors)); - } - - - - if ($this->_layout == 'edit') - { - $authorised = $user->authorise('core.create', 'com_subusers'); - - if ($authorised !== true) - { - throw new Exception(JText::_('JERROR_ALERTNOAUTHOR')); - } - } - - $this->_prepareDocument(); - - parent::display($tpl); - } - - /** - * Prepares the document - * - * @return void - * - * @throws Exception - */ - protected function _prepareDocument() - { - $app = JFactory::getApplication(); - $menus = $app->getMenu(); - $title = null; - - // Because the application sets a default page title, - // We need to get it from the menu item itself - $menu = $menus->getActive(); - - if ($menu) - { - $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); - } - else - { - $this->params->def('page_heading', JText::_('COM_SUBUSERS_DEFAULT_PAGE_TITLE')); - } - - $title = $this->params->get('page_title', ''); - - if (empty($title)) - { - $title = $app->get('sitename'); - } - elseif ($app->get('sitename_pagetitles', 0) == 1) - { - $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); - } - elseif ($app->get('sitename_pagetitles', 0) == 2) - { - $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); - } - - $this->document->setTitle($title); - - if ($this->params->get('menu-meta_description')) - { - $this->document->setDescription($this->params->get('menu-meta_description')); - } - - if ($this->params->get('menu-meta_keywords')) - { - $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); - } - - if ($this->params->get('robots')) - { - $this->document->setMetadata('robots', $this->params->get('robots')); - } - } -} diff --git a/src/site/views/roleform/index.html b/src/site/views/roleform/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/roleform/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/roleform/tmpl/default.php b/src/site/views/roleform/tmpl/default.php deleted file mode 100755 index e600a20..0000000 --- a/src/site/views/roleform/tmpl/default.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -JHtml::_('behavior.keepalive'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); - -// Load admin language file -$lang = JFactory::getLanguage(); -$lang->load('com_subusers', JPATH_SITE); -$doc = JFactory::getDocument(); -$doc->addScript(JUri::base() . '/media/com_subusers/js/form.js'); - -/**/ -?> - - -
- item->id)): ?> -

item->id; ?>

- -

- - -
-
-
-
- -
form->getInput('name'); ?>
-
-
-
- - canSave): ?> - - - - - -
-
- - - - item->created_by)): ?> - - - - - - - - - - - - - - -
-
-
diff --git a/src/site/views/roleform/tmpl/default.xml b/src/site/views/roleform/tmpl/default.xml deleted file mode 100755 index 57ee7d4..0000000 --- a/src/site/views/roleform/tmpl/default.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - -
- - -
-
-
diff --git a/src/site/views/roleform/tmpl/index.html b/src/site/views/roleform/tmpl/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/roleform/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/roleform/view.html.php b/src/site/views/roleform/view.html.php deleted file mode 100755 index 5ec66ce..0000000 --- a/src/site/views/roleform/view.html.php +++ /dev/null @@ -1,123 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -jimport('joomla.application.component.view'); - -/** - * View to edit - * - * @since 1.6 - */ -class SubusersViewRoleform extends JViewLegacy -{ - protected $state; - - protected $item; - - protected $form; - - protected $params; - - protected $canSave; - - /** - * Display the view - * - * @param string $tpl Template name - * - * @return void - * - * @throws Exception - */ - public function display($tpl = null) - { - $app = JFactory::getApplication(); - $user = JFactory::getUser(); - - $this->state = $this->get('State'); - $this->item = $this->get('Data'); - $this->params = $app->getParams('com_subusers'); - $this->canSave = $this->get('CanSave'); - $this->form = $this->get('Form'); - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors)); - } - - - - $this->_prepareDocument(); - - parent::display($tpl); - } - - /** - * Prepares the document - * - * @return void - * - * @throws Exception - */ - protected function _prepareDocument() - { - $app = JFactory::getApplication(); - $menus = $app->getMenu(); - $title = null; - - // Because the application sets a default page title, - // we need to get it from the menu item itself - $menu = $menus->getActive(); - - if ($menu) - { - $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); - } - else - { - $this->params->def('page_heading', JText::_('COM_SUBUSERS_DEFAULT_PAGE_TITLE')); - } - - $title = $this->params->get('page_title', ''); - - if (empty($title)) - { - $title = $app->get('sitename'); - } - elseif ($app->get('sitename_pagetitles', 0) == 1) - { - $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); - } - elseif ($app->get('sitename_pagetitles', 0) == 2) - { - $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); - } - - $this->document->setTitle($title); - - if ($this->params->get('menu-meta_description')) - { - $this->document->setDescription($this->params->get('menu-meta_description')); - } - - if ($this->params->get('menu-meta_keywords')) - { - $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); - } - - if ($this->params->get('robots')) - { - $this->document->setMetadata('robots', $this->params->get('robots')); - } - } -} diff --git a/src/site/views/roles/index.html b/src/site/views/roles/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/roles/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/roles/tmpl/default.php b/src/site/views/roles/tmpl/default.php deleted file mode 100755 index 0ca0fcf..0000000 --- a/src/site/views/roles/tmpl/default.php +++ /dev/null @@ -1,151 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -JHtml::_('bootstrap.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('formbehavior.chosen', 'select'); - -$user = JFactory::getUser(); -$userId = $user->get('id'); -$listOrder = $this->state->get('list.ordering'); -$listDirn = $this->state->get('list.direction'); -$canCreate = $user->authorise('core.create', 'com_subusers'); -$canEdit = $user->authorise('core.edit', 'com_subusers'); -$canCheckin = $user->authorise('core.manage', 'com_subusers'); -$canChange = $user->authorise('core.edit.state', 'com_subusers'); -$canDelete = $user->authorise('core.delete', 'com_subusers'); -?> - -
- - $this), dirname(__FILE__)); ?> - - - - items[0]->state)): ?> - - - - - - - items[0]->id)): ?> - - - - - - - - - - - - - - - - items as $i => $item) : ?> - authorise('core.edit', 'com_subusers'); ?> - - authorise('core.edit.own', 'com_subusers')): ?> - id == $item->created_by; ?> - - - - - items[0]->state)) : ?> - - - - - - - - items[0]->id)): ?> - - - - - - - - - - -
- - - - - - - -
- pagination->getListFooter(); ?> -
- - state == 1): ?> - - - - - - - checked_out) && $item->checked_out) : ?> - editor, $item->checked_out_time, 'roles.', $canCheckin); ?> - - - escape($item->name); ?> - - id; ?> - - - - - - - -
- - - - - - - - - - - -
- - - - diff --git a/src/site/views/roles/tmpl/default.xml b/src/site/views/roles/tmpl/default.xml deleted file mode 100755 index 23a3ce2..0000000 --- a/src/site/views/roles/tmpl/default.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/site/views/roles/tmpl/default_filter.php b/src/site/views/roles/tmpl/default_filter.php deleted file mode 100755 index cb8b85f..0000000 --- a/src/site/views/roles/tmpl/default_filter.php +++ /dev/null @@ -1,113 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('JPATH_BASE') or die; - -$data = $displayData; - -// Receive overridable options -$data['options'] = !empty($data['options']) ? $data['options'] : array(); - -// Check if any filter field has been filled -$filters = false; - -if (isset($data['view']->filterForm)) -{ - $filters = $data['view']->filterForm->getGroup('filter'); -} - -// Check if there are filters set. -if ($filters !== false) -{ - $filterFields = array_keys($filters); - $filtered = false; - $filled = false; - - foreach ($filterFields as $filterField) - { - $filterField = substr($filterField, 7); - $filter = $data['view']->getState('filter.' . $filterField); - - if (!empty($filter)) - { - $filled = $filter; - } - - if (!empty($filled)) - { - $filtered = true; - break; - } - } -} - -$options = $data['options']; - -// Set some basic options -$customOptions = array( - 'filtersHidden' => isset($options['filtersHidden']) ? $options['filtersHidden'] : empty($data['view']->activeFilters) && !$filtered, - 'defaultLimit' => isset($options['defaultLimit']) ? $options['defaultLimit'] : JFactory::getApplication()->get('list_limit', 20), - 'searchFieldSelector' => '#filter_search', - 'orderFieldSelector' => '#list_fullordering' -); - -$data['options'] = array_unique(array_merge($customOptions, $data['options'])); - -$formSelector = !empty($data['options']['formSelector']) ? $data['options']['formSelector'] : '#adminForm'; - -// Load search tools -JHtml::_('searchtools.form', $formSelector, $data['options']); -?> - -
-
-
- - -
- input; ?> - -
- -
- -
- - -
- -
-
-
- -
- - - $field) : ?> - -
- input; ?> -
- - - -
-
\ No newline at end of file diff --git a/src/site/views/roles/tmpl/index.html b/src/site/views/roles/tmpl/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/roles/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/roles/view.html.php b/src/site/views/roles/view.html.php deleted file mode 100755 index 363405a..0000000 --- a/src/site/views/roles/view.html.php +++ /dev/null @@ -1,129 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -jimport('joomla.application.component.view'); - -/** - * View class for a list of Subusers. - * - * @since 1.6 - */ -class SubusersViewRoles extends JViewLegacy -{ - protected $items; - - protected $pagination; - - protected $state; - - protected $params; - - /** - * Display the view - * - * @param string $tpl Template name - * - * @return void - * - * @throws Exception - */ - public function display($tpl = null) - { - $app = JFactory::getApplication(); - - $this->state = $this->get('State'); - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - $this->params = $app->getParams('com_subusers'); - - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors)); - } - - $this->_prepareDocument(); - parent::display($tpl); - } - - /** - * Prepares the document - * - * @return void - * - * @throws Exception - */ - protected function _prepareDocument() - { - $app = JFactory::getApplication(); - $menus = $app->getMenu(); - $title = null; - - // Because the application sets a default page title, - // we need to get it from the menu item itself - $menu = $menus->getActive(); - - if ($menu) - { - $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); - } - else - { - $this->params->def('page_heading', JText::_('COM_SUBUSERS_DEFAULT_PAGE_TITLE')); - } - - $title = $this->params->get('page_title', ''); - - if (empty($title)) - { - $title = $app->get('sitename'); - } - elseif ($app->get('sitename_pagetitles', 0) == 1) - { - $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); - } - elseif ($app->get('sitename_pagetitles', 0) == 2) - { - $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); - } - - $this->document->setTitle($title); - - if ($this->params->get('menu-meta_description')) - { - $this->document->setDescription($this->params->get('menu-meta_description')); - } - - if ($this->params->get('menu-meta_keywords')) - { - $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); - } - - if ($this->params->get('robots')) - { - $this->document->setMetadata('robots', $this->params->get('robots')); - } - } - - /** - * Check if state is set - * - * @param mixed $state State - * - * @return bool - */ - public function getState($state) - { - return isset($this->state->{$state}) ? $this->state->{$state} : false; - } -} diff --git a/src/site/views/user/index.html b/src/site/views/user/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/user/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/user/tmpl/default.php b/src/site/views/user/tmpl/default.php deleted file mode 100755 index c1be4d2..0000000 --- a/src/site/views/user/tmpl/default.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -$canEdit = JFactory::getUser()->authorise('core.edit', 'com_subusers'); -if (!$canEdit && JFactory::getUser()->authorise('core.edit.own', 'com_subusers')) { - $canEdit = JFactory::getUser()->id == $this->item->created_by; -} -?> -item) : ?> - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
item->id; ?>
item->user_id; ?>
item->client; ?>
item->client_id; ?>
item->role_id; ?>
item->created_by_name; ?>
-
-
- item->checked_out == 0): ?> - - - authorise('core.delete','com_subusers')):?> - - - - - - - - - - -
- - -
-
-
diff --git a/src/site/views/user/tmpl/index.html b/src/site/views/user/tmpl/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/user/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/user/view.html.php b/src/site/views/user/view.html.php deleted file mode 100755 index beb71ca..0000000 --- a/src/site/views/user/view.html.php +++ /dev/null @@ -1,134 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -jimport('joomla.application.component.view'); - -/** - * View to edit - * - * @since 1.6 - */ -class SubusersViewUser extends JViewLegacy -{ - protected $state; - - protected $item; - - protected $form; - - protected $params; - - /** - * Display the view - * - * @param string $tpl Template name - * - * @return void - * - * @throws Exception - */ - public function display($tpl = null) - { - $app = JFactory::getApplication(); - $user = JFactory::getUser(); - - $this->state = $this->get('State'); - $this->item = $this->get('Data'); - $this->params = $app->getParams('com_subusers'); - - if (!empty($this->item)) - { - $this->form = $this->get('Form'); - } - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors)); - } - - - - if ($this->_layout == 'edit') - { - $authorised = $user->authorise('core.create', 'com_subusers'); - - if ($authorised !== true) - { - throw new Exception(JText::_('JERROR_ALERTNOAUTHOR')); - } - } - - $this->_prepareDocument(); - - parent::display($tpl); - } - - /** - * Prepares the document - * - * @return void - * - * @throws Exception - */ - protected function _prepareDocument() - { - $app = JFactory::getApplication(); - $menus = $app->getMenu(); - $title = null; - - // Because the application sets a default page title, - // We need to get it from the menu item itself - $menu = $menus->getActive(); - - if ($menu) - { - $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); - } - else - { - $this->params->def('page_heading', JText::_('COM_SUBUSERS_DEFAULT_PAGE_TITLE')); - } - - $title = $this->params->get('page_title', ''); - - if (empty($title)) - { - $title = $app->get('sitename'); - } - elseif ($app->get('sitename_pagetitles', 0) == 1) - { - $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); - } - elseif ($app->get('sitename_pagetitles', 0) == 2) - { - $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); - } - - $this->document->setTitle($title); - - if ($this->params->get('menu-meta_description')) - { - $this->document->setDescription($this->params->get('menu-meta_description')); - } - - if ($this->params->get('menu-meta_keywords')) - { - $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); - } - - if ($this->params->get('robots')) - { - $this->document->setMetadata('robots', $this->params->get('robots')); - } - } -} diff --git a/src/site/views/userform/index.html b/src/site/views/userform/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/userform/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/userform/tmpl/default.php b/src/site/views/userform/tmpl/default.php deleted file mode 100755 index 19e6f25..0000000 --- a/src/site/views/userform/tmpl/default.php +++ /dev/null @@ -1,165 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -JHtml::_('behavior.keepalive'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); - -// Call static method for laguage constatnt -SubusersFrontendHelper::getLanguageConstant(); - -// Load admin language file -$lang = JFactory::getLanguage(); -$lang->load('com_subusers', JPATH_SITE); - -$doc = JFactory::getDocument(); -$doc->addScript(JUri::base() . '/media/com_subusers/js/form.js'); -$doc->addScript(JUri::base() . '/media/com_subusers/js/sub.js'); - - -// Sweet alerts -$doc->addScript(JUri::root(true) . '/media/com_ekcontent/vendors/sweetalert/sweetalert.min.js'); -$doc->addStyleSheet(JUri::root(true) . '/media/com_ekcontent/vendors/sweetalert/sweetalert.css'); -$doc->addStylesheet(JUri::root(true) . '/media/com_subusers/vendors/bootstrap-checkbox-radio/neoelemento.css'); - -// Acl helper call -$achelperPath = JPATH_SITE.'/components/com_subusers/helpers/acl.php'; -$user = JFactory::getUser(); - -if (!class_exists('SubusersAclHelper')) -{ - //require_once $path; - JLoader::register('SubusersAclHelper', $achelperPath ); - JLoader::load('SubusersAclHelper'); -} -$achelperPath = new SubusersAclHelper; -$userdata = $achelperPath->isOrganisationAdmin($user->id); -?> - - - -
-
-
- item->id)): ?> -

- -

- -
-
- -
- -
-
- - -
- -
form->getInput('name'); ?>
-
- -
- -
form->getInput('username'); ?>
-
- - -
- -
name;?>
-
- - -
- -
form->getInput('client_id'); ?>
-
- - -
- -
form->getInput('role_id'); ?>
-
- - -
- -
form->getInput('email'); ?>
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
-
-
-
-
- - canSave): ?> - - - - - -
-
-
-
- - - - item->created_by)): ?> - - - - - - - - - - - - - - -
-
-
diff --git a/src/site/views/userform/tmpl/default.xml b/src/site/views/userform/tmpl/default.xml deleted file mode 100755 index eca00f2..0000000 --- a/src/site/views/userform/tmpl/default.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - -
- - -
-
-
diff --git a/src/site/views/userform/tmpl/index.html b/src/site/views/userform/tmpl/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/userform/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/userform/view.html.php b/src/site/views/userform/view.html.php deleted file mode 100755 index 2924983..0000000 --- a/src/site/views/userform/view.html.php +++ /dev/null @@ -1,131 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -jimport('joomla.application.component.view'); - -/** - * View to edit - * - * @since 1.6 - */ -class SubusersViewUserform extends JViewLegacy -{ - protected $state; - - protected $item; - - protected $form; - - protected $params; - - protected $canSave; - - /** - * Display the view - * - * @param string $tpl Template name - * - * @return void - * - * @throws Exception - */ - public function display($tpl = null) - { - $app = JFactory::getApplication(); - $user = JFactory::getUser(); - - $this->state = $this->get('State'); - $this->item = $this->get('Data'); - $this->params = $app->getParams('com_subusers'); - $this->canSave = $this->get('CanSave'); - $this->form = $this->get('Form'); - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors)); - } - - $this->_prepareDocument(); - - parent::display($tpl); - } - - /** - * Prepares the document - * - * @return void - * - * @throws Exception - */ - protected function _prepareDocument() - { - $app = JFactory::getApplication(); - $menus = $app->getMenu(); - $title = null; - - // Because the application sets a default page title, - // we need to get it from the menu item itself - $menu = $menus->getActive(); - - if ($menu) - { - $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); - } - else - { - $this->params->def('page_heading', JText::_('COM_SUBUSERS_DEFAULT_PAGE_TITLE')); - } - - if (empty($title)) - { - if (!empty($this->item->user_id)) - { - $title = JFactory::getUser($this->item->user_id)->name; - } - else - { - $title = JText::_('COM_SUBUSERS_USER_FORM_PAGE_TITLE'); - } - } - - if (empty($title)) - { - $title = $app->get('sitename'); - } - elseif ($app->get('sitename_pagetitles', 0) == 1) - { - $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); - } - elseif ($app->get('sitename_pagetitles', 0) == 2) - { - $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); - } - - $this->document->setTitle($title); - - if ($this->params->get('menu-meta_description')) - { - $this->document->setDescription($this->params->get('menu-meta_description')); - } - - if ($this->params->get('menu-meta_keywords')) - { - $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); - } - - if ($this->params->get('robots')) - { - $this->document->setMetadata('robots', $this->params->get('robots')); - } - } -} diff --git a/src/site/views/users/index.html b/src/site/views/users/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/users/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/users/tmpl/default.php b/src/site/views/users/tmpl/default.php deleted file mode 100755 index 863e22b..0000000 --- a/src/site/views/users/tmpl/default.php +++ /dev/null @@ -1,254 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -JHtml::_('bootstrap.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('formbehavior.chosen', 'select'); -jimport( 'joomla.html.html.select' ); - -// Load js -$doc = JFactory::getDocument(); -$doc->addScript(JUri::base() . '/media/com_subusers/js/sub.js'); - -// User srach by organisation -$mainframe = JFactory::getApplication(); -$search_organisationuser = $mainframe->getUserStateFromRequest('.filter_user_search', 'filter_user_search'); - -$user = JFactory::getUser(); -$userId = $user->get('id'); -$listOrder = $this->state->get('list.ordering'); -$listDirn = $this->state->get('list.direction'); -$canCreate = $user->authorise('core.create', 'com_subusers'); -$canEdit = $user->authorise('core.edit', 'com_subusers'); -$canCheckin = $user->authorise('core.manage', 'com_subusers'); -$canChange = $user->authorise('core.edit.state', 'com_subusers'); -$canDelete = $user->authorise('core.delete', 'com_subusers'); - -?> - - -
-
-
-

-
-
- -
- -
- - - isSuperAdmin) - {?> -
- orgListArray,'filter_org_search', 'class="inputbox" onChange="jQuery(\'#adminForm\').submit();"', 'value', 'text', $this->orgsearch, $disable = false);?> -
- - -
- - isSuperAdmin || $this->isAdmin) - { - if ($canCreate) : ?> - - - -
- - -
- - - items) - { ?> - - - - items[0]->id)): ?> - - - - items[0]->state)): ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - items as $i => $item) : ?> - authorise('core.edit', 'com_subusers'); ?> - authorise('core.edit.own', 'com_subusers')): ?> - id == $item->created_by; ?> - - - - items[0]->id)): ?> - - - - items[0]->state)) : ?> - - - - - - - - - - - - - - - - - - -
- - - isSuperAdmin || $this->isAdmin) - {?> - - - - - - - - - - - - isSuperAdmin || $this->isAdmin) - {?> - - -
- pagination->getListFooter(); ?> -
- id; ?> - - isSuperAdmin || $this->isAdmin) - {?> - - state == 1): ?> - - - - - - - - - user_id)->name; ?> - - - user_id)->email; ?> - - orgname; ?> - - name; ?> - - - - - - isSuperAdmin || $this->isAdmin) - {?> - name != "Organisation Admin") : ?> - - - -
- -
- - - - - - - -
-
- - - diff --git a/src/site/views/users/tmpl/default.xml b/src/site/views/users/tmpl/default.xml deleted file mode 100755 index 1442458..0000000 --- a/src/site/views/users/tmpl/default.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/site/views/users/tmpl/default_filter.php b/src/site/views/users/tmpl/default_filter.php deleted file mode 100755 index cb8b85f..0000000 --- a/src/site/views/users/tmpl/default_filter.php +++ /dev/null @@ -1,113 +0,0 @@ - - * @copyright Copyright (C) 2015. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('JPATH_BASE') or die; - -$data = $displayData; - -// Receive overridable options -$data['options'] = !empty($data['options']) ? $data['options'] : array(); - -// Check if any filter field has been filled -$filters = false; - -if (isset($data['view']->filterForm)) -{ - $filters = $data['view']->filterForm->getGroup('filter'); -} - -// Check if there are filters set. -if ($filters !== false) -{ - $filterFields = array_keys($filters); - $filtered = false; - $filled = false; - - foreach ($filterFields as $filterField) - { - $filterField = substr($filterField, 7); - $filter = $data['view']->getState('filter.' . $filterField); - - if (!empty($filter)) - { - $filled = $filter; - } - - if (!empty($filled)) - { - $filtered = true; - break; - } - } -} - -$options = $data['options']; - -// Set some basic options -$customOptions = array( - 'filtersHidden' => isset($options['filtersHidden']) ? $options['filtersHidden'] : empty($data['view']->activeFilters) && !$filtered, - 'defaultLimit' => isset($options['defaultLimit']) ? $options['defaultLimit'] : JFactory::getApplication()->get('list_limit', 20), - 'searchFieldSelector' => '#filter_search', - 'orderFieldSelector' => '#list_fullordering' -); - -$data['options'] = array_unique(array_merge($customOptions, $data['options'])); - -$formSelector = !empty($data['options']['formSelector']) ? $data['options']['formSelector'] : '#adminForm'; - -// Load search tools -JHtml::_('searchtools.form', $formSelector, $data['options']); -?> - -
-
-
- - -
- input; ?> - -
- -
- -
- - -
- -
-
-
- -
- - - $field) : ?> - -
- input; ?> -
- - - -
-
\ No newline at end of file diff --git a/src/site/views/users/tmpl/index.html b/src/site/views/users/tmpl/index.html deleted file mode 100755 index 42682b4..0000000 --- a/src/site/views/users/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/site/views/users/view.html.php b/src/site/views/users/view.html.php deleted file mode 100755 index 4024843..0000000 --- a/src/site/views/users/view.html.php +++ /dev/null @@ -1,144 +0,0 @@ - - * @copyright Copyright (C) 2015 Techjoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ -// No direct access -defined('_JEXEC') or die; - -jimport('joomla.application.component.view'); -JPATH_SITE . 'components/com_subusers/helpers/subusers.php'; -/** - * View class for a list of Subusers. - * - * @since 1.6 - */ -class SubusersViewUsers extends JViewLegacy -{ - protected $items; - - protected $pagination; - - protected $state; - - protected $params; - - /** - * Display the view - * - * @param string $tpl Template name - * - * @return void - * - * @throws Exception - */ - public function display($tpl = null) - { - $app = JFactory::getApplication(); - - $this->state = $this->get('State'); - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - $this->params = $app->getParams('com_subusers'); - $this->filterForm = $this->get('FilterForm'); - $this->activeFilters = $this->get('ActiveFilters'); - - // If logged user is Super User or Admin - $user = JFactory::getUser(); - $uid = $user->id; - require_once JPATH_COMPONENT . '/helpers/acl.php'; - $this->isAdmin = SubusersAclHelper::isOrganisationAdmin($uid); - $this->isSuperAdmin = SubusersAclHelper::isSuperAdmin($uid); - - $this->orgsearch = $app->getUserStateFromRequest('.filter.search', 'filter_org_search', '', 'string'); - - $this->orgListArray = SubusersAclHelper::getAllOrganizations(); - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors)); - } - - $this->_prepareDocument(); - parent::display($tpl); - } - - /** - * Prepares the document - * - * @return void - * - * @throws Exception - */ - protected function _prepareDocument() - { - $app = JFactory::getApplication(); - $menus = $app->getMenu(); - $title = null; - - // Because the application sets a default page title, - // we need to get it from the menu item itself - $menu = $menus->getActive(); - - if ($menu) - { - $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); - } - else - { - $this->params->def('page_heading', JText::_('COM_SUBUSERS_DEFAULT_USERS_TITLE')); - } - - if (empty($title)) - { - $title = JText::_('COM_SUBUSERS_USERS_LIST_PAGE_TITLE'); - } - - if (empty($title)) - { - $title = $app->get('sitename'); - } - elseif ($app->get('sitename_pagetitles', 0) == 1) - { - $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); - } - elseif ($app->get('sitename_pagetitles', 0) == 2) - { - $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); - } - - $this->document->setTitle($title); - - if ($this->params->get('menu-meta_description')) - { - $this->document->setDescription($this->params->get('menu-meta_description')); - } - - if ($this->params->get('menu-meta_keywords')) - { - $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); - } - - if ($this->params->get('robots')) - { - $this->document->setMetadata('robots', $this->params->get('robots')); - } - } - - /** - * Check if state is set - * - * @param mixed $state State - * - * @return bool - */ - public function getState($state) - { - return isset($this->state->{$state}) ? $this->state->{$state} : false; - } -} diff --git a/src/subusers.xml b/src/subusers.xml index 22ca9dd..d54eeac 100755 --- a/src/subusers.xml +++ b/src/subusers.xml @@ -1,72 +1,55 @@ - com_subusers - 2016-01-07 - Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. - GNU General Public License version 2 or later; see LICENSE.txt - Techjoomla - contact@techjoomla.com - https://techjoomla.com - 1.0.0 - This is to sudo-make role based user management easy. - - script.php - - - - sql/install.mysql.utf8.sql - - - - - sql/uninstall.mysql.utf8.sql - - + com_subusers + 2016-01-07 + Copyright (C) 2009 - 2018 Techjoomla. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + Techjoomla + contact@techjoomla.com + https://techjoomla.com + 1.0.0 + COM_SUBUSERS_XML_DESCRIPTION - - index.html - subusers.php - controller.php - router.php - views - models - controllers - helpers - - - js - css - - - en-GB/en-GB.com_subusers.ini - - - COM_SUBUSERS - + script.php + + + + sql/install.mysql.utf8.sql + + + + + sql/uninstall.mysql.utf8.sql + + + + + COM_SUBUSERS + COM_SUBUSERS_TITLE_USERS COM_SUBUSERS_TITLE_ROLES COM_SUBUSERS_TITLE_ACTIONS COM_SUBUSERS_TITLE_MAPPINGS - - - access.xml - config.xml - controller.php - index.html - subusers.php - controllers - includes - libraries - assets - helpers - models - sql - tables - views - - + + + access.xml + config.xml + controller.php + index.html + subusers.php + controllers + includes + libraries + assets + helpers + models + sql + tables + views + + en-GB/en-GB.com_subusers.ini en-GB/en-GB.com_subusers.sys.ini - - + +