-
-
-
-
-
-
-
-
-
-
-
- items[0]->ordering)): ?>
- |
- ', 'a.`ordering`', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
- |
-
-
-
- |
-
- items[0]->state)): ?>
-
-
- |
-
-
-
-
-
- |
-
-
- |
-
-
-
- |
-
- items[0]->id)): ?>
-
-
- |
-
-
-
-
-
-
- |
- pagination->getListFooter(); ?>
- |
-
-
-
-
- items as $i => $item) :
- $ordering = ($listOrder == 'a.ordering');
- $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');
- ?>
-
- items[0]->ordering)) : ?>
- |
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
- id); ?>
- |
- items[0]->state)): ?>
-
- state, $i, 'organizations.', $canChange, 'cb'); ?>
- |
-
-
-
- checked_out) && $item->checked_out && ($canEdit || $canChange)) : ?>
- editor, $item->checked_out_time, 'organizations.', $canCheckin); ?>
-
-
-
- escape($item->name); ?>
-
-
- escape($item->name); ?>
-
- |
-
-
- created_by; ?>
- |
-
-
- email; ?>
- |
-
- items[0]->id)): ?>
-
- id; ?>
- |
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/administrator/views/organizations/tmpl/index.html b/src/administrator/views/organizations/tmpl/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/administrator/views/organizations/tmpl/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/administrator/views/organizations/view.html.php b/src/administrator/views/organizations/view.html.php
deleted file mode 100755
index c85903c..0000000
--- a/src/administrator/views/organizations/view.html.php
+++ /dev/null
@@ -1,168 +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 SubusersViewOrganizations extends JViewLegacy
-{
- protected $items;
-
- protected $pagination;
-
- protected $state;
-
- /**
- * Display the view
- *
- * @param string $tpl Template name
- *
- * @return void
- *
- * @throws Exception
- */
- public function display($tpl = null)
- {
- $this->state = $this->get('State');
- $this->items = $this->get('Items');
- $this->pagination = $this->get('Pagination');
-
- // Check for errors.
- if (count($errors = $this->get('Errors')))
- {
- throw new Exception(implode("\n", $errors));
- }
-
- SubusersHelper::addSubmenu('organizations');
-
- $this->addToolbar();
-
- $this->sidebar = JHtmlSidebar::render();
- parent::display($tpl);
- }
-
- /**
- * Add the page title and toolbar.
- *
- * @return void
- *
- * @since 1.6
- */
- protected function addToolbar()
- {
- require_once JPATH_COMPONENT . '/helpers/subusers.php';
-
- $state = $this->get('State');
- $canDo = SubusersHelper::getActions($state->get('filter.category_id'));
-
- JToolBarHelper::title(JText::_('COM_SUBUSERS_TITLE_ORGANIZATIONS'), 'organizations.png');
-
- // Check if the form exists before showing the add/edit buttons
- $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/organization';
-
- if (file_exists($formPath))
- {
- if ($canDo->get('core.create'))
- {
- JToolBarHelper::addNew('organization.add', 'JTOOLBAR_NEW');
- JToolbarHelper::custom('organizations.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
- }
-
- if ($canDo->get('core.edit') && isset($this->items[0]))
- {
- JToolBarHelper::editList('organization.edit', 'JTOOLBAR_EDIT');
- }
- }
-
- if ($canDo->get('core.edit.state'))
- {
- if (isset($this->items[0]->state))
- {
- JToolBarHelper::divider();
- JToolBarHelper::custom('organizations.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
- JToolBarHelper::custom('organizations.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
- }
- elseif (isset($this->items[0]))
- {
- // If this component does not use state then show a direct delete button as we can not trash
- JToolBarHelper::deleteList('', 'organizations.delete', 'JTOOLBAR_DELETE');
- }
-
- if (isset($this->items[0]->state))
- {
- JToolBarHelper::divider();
- JToolBarHelper::archiveList('organizations.archive', 'JTOOLBAR_ARCHIVE');
- }
-
- if (isset($this->items[0]->checked_out))
- {
- JToolBarHelper::custom('organizations.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
- }
- }
-
- // Show trash and delete for components that uses the state field
- if (isset($this->items[0]->state))
- {
- if ($state->get('filter.state') == -2 && $canDo->get('core.delete'))
- {
- JToolBarHelper::deleteList('', 'organizations.delete', 'JTOOLBAR_EMPTY_TRASH');
- JToolBarHelper::divider();
- }
- elseif ($canDo->get('core.edit.state'))
- {
- JToolBarHelper::trash('organizations.trash', 'JTOOLBAR_TRASH');
- JToolBarHelper::divider();
- }
- }
-
- if ($canDo->get('core.admin'))
- {
- JToolbarHelper::custom('database.fix', 'refresh', 'refresh', 'COM_SUBUSERS_TOOLBAR_DATABASE_FIX', false);
- JToolBarHelper::preferences('com_subusers');
- }
-
- // Set sidebar action - New in 3.0
- JHtmlSidebar::setAction('index.php?option=com_subusers&view=organizations');
-
- $this->extra_sidebar = '';
- JHtmlSidebar::addFilter(
-
- JText::_('JOPTION_SELECT_PUBLISHED'),
-
- 'filter_published',
-
- JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)
-
- );
- }
-
- /**
- * Method to order fields
- *
- * @return void
- */
- protected function getSortFields()
- {
- return array(
- 'a.`id`' => JText::_('JGRID_HEADING_ID'),
- 'a.`name`' => JText::_('COM_SUBUSERS_ORGANIZATIONS_NAME'),
- 'a.`created_by`' => JText::_('COM_SUBUSERS_ORGANIZATIONS_CREATED_BY'),
- 'a.`ordering`' => JText::_('JGRID_HEADING_ORDERING'),
- 'a.`state`' => JText::_('JSTATUS'),
- 'a.`email`' => JText::_('COM_SUBUSERS_ORGANIZATIONS_EMAIL'),
- );
- }
-}
diff --git a/src/site/controller.php b/src/site/controller.php
index 809aa5b..3957c4a 100755
--- a/src/site/controller.php
+++ b/src/site/controller.php
@@ -33,7 +33,7 @@ public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/subusers.php';
- $view = JFactory::getApplication()->input->getCmd('view', 'organizations');
+ $view = JFactory::getApplication()->input->getCmd('view', 'roles');
JFactory::getApplication()->input->set('view', $view);
parent::display($cachable, $urlparams);
diff --git a/src/site/controllers/announcementform.php b/src/site/controllers/announcementform.php
deleted file mode 100755
index f98f19f..0000000
--- a/src/site/controllers/announcementform.php
+++ /dev/null
@@ -1,265 +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';
-
-/**
- * Organization controller class.
- *
- * @since 1.6
- */
-class SubusersControllerAnnouncementForm 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.organization.id');
- $editId = $app->input->getInt('id', 0);
- $org_id = $app->input->getInt('org_id', 0);
-
- // Set the user id for the user to edit in the session.
- $app->setUserState('com_subusers.edit.organization.id', $editId);
-
- // Get the model.
- $model = $this->getModel('OrganizationForm', '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=announcementform&layout=edit&org_id=' . $org_id, 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('AnnouncementForm', 'SubusersModel');
-
- // Get the user data.
- $data = JFactory::getApplication()->input->get('jform', array(), 'array');
-
- // 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.announcement.data', $jform);
-
- Redirect back to the edit screen.
- $id = (int) $app->getUserState('com_subusers.edit.announcement.id');
- $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=announcementform&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.announcement.data', $data);
-
- // Redirect back to the edit screen.
- $id = (int) $app->getUserState('com_subusers.edit.announcement.id');
- $this->setMessage(JText::sprintf('Save failed', $model->getError()), 'warning');
- $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=announcementform&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.announcement.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=organization' . '/' . $data['orgid'] : $item->link);
- $this->setRedirect(JRoute::_($url, false));
-
- // Flush the data from the session.
- $app->setUserState('com_subusers.edit.announcement.data', null);
- }
-
- /**
- * Method to abort current operation
- *
- * @return void
- *
- * @throws Exception
- */
- public function cancel()
- {
- $app = JFactory::getApplication();
- $id = $app->input->get('orgid');
-
- // Get the current edit id.
- $editId = (int) $app->getUserState('com_subusers.edit.organization.id');
-
- // Get the model.
- $model = $this->getModel('AnnouncementForm', 'SubusersModel');
-
- // Check in the item
- if ($editId)
- {
- $model->checkin($editId);
- }
-
- $url = 'index.php?option=com_subusers&view=organization' . '/' . $id;
- $this->setRedirect(JRoute::_($url, false));
- }
-
- /**
- * Method to remove data
- *
- * @return void
- *
- * @throws Exception
- */
- public function remove()
- {
- // Initialise variables.
- $app = JFactory::getApplication();
- $model = $this->getModel('AnnouncementForm', '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.organization.data', $data);
-
- // Redirect back to the edit screen.
- $id = (int) $app->getUserState('com_subusers.edit.organization.id');
- $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=announcement&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.organization.data', $data);
-
- // Redirect back to the edit screen.
- $id = (int) $app->getUserState('com_subusers.edit.organization.id');
- $this->setMessage(JText::sprintf('Delete failed', $model->getError()), 'warning');
- $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=announcement&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.organization.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=organizations&layout=pin' : $item->link);
- $this->setRedirect(JRoute::_($url, false));
-
- // Flush the data from the session.
- $app->setUserState('com_subusers.edit.organization.data', null);
- }
-}
diff --git a/src/site/controllers/announcements.php b/src/site/controllers/announcements.php
deleted file mode 100755
index 81249cb..0000000
--- a/src/site/controllers/announcements.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';
-
-/**
- * Organizations list controller class.
- *
- * @since 1.6
- */
-class SubusersControllerAnnouncements 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 = 'Announcements', $prefix = 'SubusersModel', $config = array())
- {
- $model = parent::getModel($name, $prefix, array('ignore_request' => true));
-
- return $model;
- }
-}
diff --git a/src/site/controllers/organization.php b/src/site/controllers/organization.php
deleted file mode 100755
index 59f9a77..0000000
--- a/src/site/controllers/organization.php
+++ /dev/null
@@ -1,207 +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';
-
-/**
- * Organization controller class.
- *
- * @since 1.6
- */
-class SubusersControllerOrganization 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.organization.id');
- $editId = $app->input->getInt('id', 0);
-
- // Set the user id for the user to edit in the session.
- $app->setUserState('com_subusers.edit.organization.id', $editId);
-
- // Get the model.
- $model = $this->getModel('Organization', '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=organizationform&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('Organization', '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.organization.id', null);
-
- // Flush the data from the session.
- $app->setUserState('com_subusers.edit.organization.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=organizations', 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('Organization', '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.organization.id', null);
-
- // Flush the data from the session.
- $app->setUserState('com_subusers.edit.organization.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);
- }
- }
-
- /**
- * Apply for membership
- *
- * @return void
- *
- * @throws Exception
- */
- public function applymembership()
- {
- $input = JFactory::getApplication()->input;
- $post = $input->post;
- $orgid = $post->get('orgid', '', 'INT');
-
- if ($orgid)
- {
- $oluser_id = JFactory::getUser()->id;
- $model = $this->getModel('organization');
- $check = $model->applymembership($orgid, $oluser_id);
-
- if ($check)
- {
- $msg = JText::_('COM_SUBUSERS_APPLY_SUCCESSFULY');
- }
- else
- {
- $msg = JText::_('COM_SUBUSERS_APPLY_FAILED');
- }
-
- $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=organization&layout=details&id=' . $orgid, false), $msg);
- }
- }
-}
diff --git a/src/site/controllers/organizationform.php b/src/site/controllers/organizationform.php
deleted file mode 100755
index 78422c6..0000000
--- a/src/site/controllers/organizationform.php
+++ /dev/null
@@ -1,324 +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';
-
-/**
- * Organization controller class.
- *
- * @since 1.6
- */
-class SubusersControllerOrganizationForm 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.organization.id');
- $editId = $app->input->getInt('id', 0);
-
- // Set the user id for the user to edit in the session.
- $app->setUserState('com_subusers.edit.organization.id', $editId);
-
- // Get the model.
- $model = $this->getModel('OrganizationForm', '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=organizationform&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('OrganizationForm', '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.organization.data', $jform);
-
- // Redirect back to the edit screen.
- $id = (int) $app->getUserState('com_subusers.edit.organization.id');
- $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=organizationform&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.organization.data', $data);
-
- // Redirect back to the edit screen.
- $id = (int) $app->getUserState('com_subusers.edit.organization.id');
- $this->setMessage(JText::sprintf('Save failed', $model->getError()), 'warning');
- $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=organizationform&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.organization.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=organizations' : $item->link);
- $this->setRedirect(JRoute::_($url, false));
-
- // Flush the data from the session.
- $app->setUserState('com_subusers.edit.organization.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.organization.id');
-
- // Get the model.
- $model = $this->getModel('OrganizationForm', '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=organizations' : $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('OrganizationForm', '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.organization.data', $data);
-
- // Redirect back to the edit screen.
- $id = (int) $app->getUserState('com_subusers.edit.organization.id');
- $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=organization&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.organization.data', $data);
-
- // Redirect back to the edit screen.
- $id = (int) $app->getUserState('com_subusers.edit.organization.id');
- $this->setMessage(JText::sprintf('Delete failed', $model->getError()), 'warning');
- $this->setRedirect(JRoute::_('index.php?option=com_subusers&view=organization&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.organization.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=organizations' : $item->link);
- $this->setRedirect(JRoute::_($url, false));
-
- // Flush the data from the session.
- $app->setUserState('com_subusers.edit.organization.data', null);
- }
-
- /**
- * Method to check out an org id is already exist or not.
- *
- * @return void
- *
- * @since 1.6
- */
- public function validateOrgId()
- {
- $app = JFactory::getApplication();
- $orgId = $app->input->get('id', '', 'STRING');
-
- // Get the model.
- $model = $this->getModel('OrganizationForm', 'SubusersModel');
-
- if ( $model->validateOrgId($orgId))
- {
- // If already present
- echo "failure";
- exit();
- }
- else
- {
- // New email found
- echo "success";
- exit();
- }
-
- exit;
- }
-
- /**
- * Method to check out an orgemail is already exist or not.
- *
- * @return void
- *
- * @since 1.6
- */
- public function validateOrgEmail()
- {
- $app = JFactory::getApplication();
- $orgEmail = $app->input->get('email', '', 'STRING');
-
- // Get the model.
- $model = $this->getModel('OrganizationForm', 'SubusersModel');
-
- if ( $model->validateOrgEmail($orgEmail))
- {
- // If already present
- echo "failure";
- exit();
- }
- else
- {
- // New email found
- echo "success";
- exit();
- }
-
- exit;
- }
-}
diff --git a/src/site/controllers/organizations.php b/src/site/controllers/organizations.php
deleted file mode 100755
index 71656d3..0000000
--- a/src/site/controllers/organizations.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';
-
-/**
- * Organizations list controller class.
- *
- * @since 1.6
- */
-class SubusersControllerOrganizations 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 = 'Organizations', $prefix = 'SubusersModel', $config = array())
- {
- $model = parent::getModel($name, $prefix, array('ignore_request' => true));
-
- return $model;
- }
-}
diff --git a/src/site/models/announcementform.php b/src/site/models/announcementform.php
deleted file mode 100755
index 81f91ff..0000000
--- a/src/site/models/announcementform.php
+++ /dev/null
@@ -1,423 +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 SubusersModelAnnouncementForm 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.organization.id');
- }
- else
- {
- $id = JFactory::getApplication()->input->get('id');
- JFactory::getApplication()->setUserState('com_subusers.edit.organization.id', $id);
- }
-
- $this->setState('organization.id', $id);
-
- // Load the parameters.
- $params = $app->getParams();
- $params_array = $params->toArray();
-
- if (isset($params_array['item_id']))
- {
- $this->setState('organization.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('organization.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 = 'Announcement', $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;
- }
-
- /**
- * Get an $org_id by alias
- *
- * @param string $org_id Alias string
- *
- * @return org id
- */
-
- public function getCatId($org_id)
- {
- // Get a db connection.
- $db = JFactory::getDbo();
- $query = $db->getQuery(true);
-
- // Create a new query object.
- $query
- ->select('a.category_id')
- ->from('`#__es_group_xref` AS a');
- $query->where('a.client_id=' . $org_id);
- $db->setQuery($query);
- $cat_id = $db->loadResult();
-
- return $cat_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('organization.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('organization.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.organization', 'announcementform', 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.organization.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)
- {
- $user = JFactory::getUser();
- $id = '';
-
- if ($data['id'])
- {
- $id = $data['id'];
- }
-
- $org_id = $data['orgid'];
- $data['catid'] = $this->getCatId($org_id);
- $data['access'] = 1;
- $data['state'] = 1;
- $data['language'] = '*';
-
- // 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);
- }
-
- // Insert data in content table
- $db = JFactory::getDBO();
- $table = JTable::getInstance('Content', 'JTable', array('dbo', $db));
- $table->load(array('id' => $id));
-
- if ($id)
- {
- if ($table->save($data) === true)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- $data['id'] = '';
-
- if ($table->save($data) === true)
- {
- }
- 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('organization.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/announcements.php b/src/site/models/announcements.php
deleted file mode 100755
index 8c299a0..0000000
--- a/src/site/models/announcements.php
+++ /dev/null
@@ -1,295 +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 SubusersModelAnnouncements 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',
- 'created_by', 'a.created_by',
- 'ordering', 'a.ordering',
- 'state', 'a.state',
- 'email', 'a.email',
- 'logo', 'a.logo',
- );
- }
-
- 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 for organisation
- *
- * @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('`#__content` AS a');
-
- // Join over the users for the checked out user.
- $query->join('INNER', '#__es_group_xref AS b ON (a.catid = b.category_id)');
- $query->where('a.state = 1');
-
- // Filter by search in announcement name
- $mainframe = JFactory::getApplication();
- $search = $mainframe->getUserStateFromRequest('.filter.search', 'filter_announcement_search');
-
- if (!empty($search))
- {
- if (stripos($search, 'id:') === 0)
- {
- $query->where('a.id = ' . (int) substr($search, 3));
- }
- else
- {
- $search = $db->Quote('%' . $db->escape($search, true) . '%');
- $query->where('( a.title LIKE ' . $search . ' OR a.created_by 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/forms/announcementform.xml b/src/site/models/forms/announcementform.xml
deleted file mode 100755
index 81f2213..0000000
--- a/src/site/models/forms/announcementform.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
diff --git a/src/site/models/forms/filter_organizations.xml b/src/site/models/forms/filter_organizations.xml
deleted file mode 100755
index 995dfa5..0000000
--- a/src/site/models/forms/filter_organizations.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/site/models/forms/organizationform.xml b/src/site/models/forms/organizationform.xml
deleted file mode 100755
index bfc3092..0000000
--- a/src/site/models/forms/organizationform.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
diff --git a/src/site/models/organization.php b/src/site/models/organization.php
deleted file mode 100755
index dde5d6b..0000000
--- a/src/site/models/organization.php
+++ /dev/null
@@ -1,396 +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_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
-jimport('joomla.application.component.modelitem');
-jimport('joomla.event.dispatcher');
-
-use Joomla\Utilities\ArrayHelper;
-/**
- * Subusers model.
- *
- * @since 1.6
- */
-class SubusersModelOrganization 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.organization.id');
- }
- else
- {
- $id = JFactory::getApplication()->input->get('id');
- JFactory::getApplication()->setUserState('com_subusers.edit.organization.id', $id);
- }
-
- $this->setState('organization.id', $id);
-
- // Load the parameters.
- $params = $app->getParams();
- $params_array = $params->toArray();
-
- if (isset($params_array['item_id']))
- {
- $this->setState('organization.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('organization.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');
- }
- }
-
- 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 = 'Organization', $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('organization.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('organization.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);
- }
-
- /**
- * Check member
- *
- * @param int $user_id Element id
- *
- * @return check
- */
- public function checkmember($user_id,$orgid)
- {
- $db = JFactory::getDbo();
- $query = $db->getQuery(true);
- $query->select('id')
- ->from('#__tjsu_users')
- ->where('user_id = ' . $user_id)
- ->where('client_id = ' . $orgid);
- $db->setQuery($query);
- $result = $db->loadResult();
-
- return $result;
- }
-
- /**
- * check state
- *
- * @param int $user_id Element id
- *
- * @return bool
- */
- public function checkmemberstate($user_id,$orgid)
- {
- $table = $this->getTable('user');
- $table->load(array('user_id' => $user_id,'client_id' => $orgid));
- $result = $table->state;
-
- return $result;
- }
-
- /**
- * check state
- *
- * @param int $orgid Element id
- *
- * @param int $oluser_id Element id
- *
- * @return bool
- */
- public function applymembership($orgid,$oluser_id)
- {
- $table = $this->getTable('user');
- $table->load(array('user_id' => $oluser_id));
- $tjsuid = $table->id;
- $tjsuid = 0;
-
- if (!$tjsuid)
- {
- /*$table->client_id = $orgid;
- return $table->store();
- Create the array of new fields.*/
-
- $from = array('id' => '',
- 'user_id' => $oluser_id,
- 'client' => 'com_subusers.organisation',
- 'client_id' => $orgid,
- 'role_id' => '2',
- 'state' => '0'
- );
-
- // Bind the array to the table object.
- $table->bind($from);
-
- $grpid = $this->getGrpId($orgid);
- $group = FD::group($grpid);
-
- // Get the user's access as we want to limit the number of groups they can join
- $user = FD::user($oluser_id);
- $access = $user->getAccess();
- $total = $user->getTotalGroups();
-
- if ($access->exceeded('groups.join', $total))
- {
- $obj->success = 0;
- $obj->message = 'group joining limit exceeded';
-
- return $obj;
- }
-
- if (!$group->isMember($oluser_id))
- {
- // Create a member record for the group
- $members = $group->createMember($oluser_id);
- }
-
- return $table->store();
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Get $orgid
- *
- * @param int $orgid Org id
- *
- * @return org id
- */
-
- public function getGrpId($orgid)
- {
- // Get a db connection.
- $db = JFactory::getDbo();
- $query = $db->getQuery(true);
-
- // Create a new query object.
- $query
- ->select('a.grp_id')
- ->from('`#__es_group_xref` AS a');
- $query->where('a.client_id=' . $orgid);
- $db->setQuery($query);
- $grp_id = $db->loadResult();
-
- return $grp_id;
- }
-
- /**
- * Get $orgid
- *
- * @param int $orgid Org id
- *
- * @param int $oluser_id oluser id
- *
- * @return org id
- */
-
- public function checkIfOrgAdmin($orgid,$oluser_id)
- {
- $table = $this->getTable('user');
- $table->load(array('user_id' => $oluser_id,'client_id' => $orgid));
-
- return $table->role_id;
- }
-}
diff --git a/src/site/models/organizationform.php b/src/site/models/organizationform.php
deleted file mode 100755
index 10d24ba..0000000
--- a/src/site/models/organizationform.php
+++ /dev/null
@@ -1,584 +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 SubusersModelOrganizationForm 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.organization.id');
- }
- else
- {
- $id = JFactory::getApplication()->input->get('id');
- JFactory::getApplication()->setUserState('com_subusers.edit.organization.id', $id);
- }
-
- $this->setState('organization.id', $id);
-
- // Load the parameters.
- $params = $app->getParams();
- $params_array = $params->toArray();
-
- if (isset($params_array['item_id']))
- {
- $this->setState('organization.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('organization.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 = 'Organization', $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('organization.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('organization.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.organization', 'organizationform', 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.organization.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('organization.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);
- }
-
- // Insert daat in organisation table
- $table = $this->getTable();
-
- if ($id)
- {
- if ($table->save($data) === true)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- if ($table->save($data) === true)
- {
- if ($table->id)
- {
- $userdata = new stdClass;
- $userdata->user_id = $formData->get('userid', 0);
- $userdata->client = 'com_subusers.organisation';
- $userdata->client_id = $table->id;
- $userdata->role_id = 1;
- $userdata->created_by = $user->id;
- $userdata->ordering = '2';
- $userdata->state = '1';
-
- $result = JFactory::getDBO()->insertObject('#__tjsu_users', $userdata);
-
- $params = JComponentHelper::getParams('com_subusers');
- $maincatid = $params->get('announementcategory', '');
-
- // Set the extension. For content categories, use 'com_content'
- $extension = 'com_content';
-
- // Set the title for the category
- $title = $formData->get('name');
-
- // Type the description, this is also the 'body'. HTML allowed here.
- $desc = '';
-
- // Set the parent category. 1 is the root item.
- $parent_id = $maincatid;
-
- // JTableCategory is autoloaded in J! 3.0, so...
- if (version_compare(JVERSION, '3.0', 'lt'))
- {
- JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table');
- }
-
- // Initialize a new category
- $category = JTable::getInstance('Category');
- $category->extension = $extension;
- $category->title = $title;
- $category->description = $desc;
- $category->published = 1;
- $category->access = 1;
- $category->params = '{"target":"","image":""}';
- $category->metadata = '{"page_title":"","author":"","robots":""}';
- $category->language = '*';
-
- // Set the location in the tree
- $category->setLocation($parent_id, 'last-child');
-
- // Check to make sure our data is valid
- if (!$category->check())
- {
- JError::raiseNotice(500, $category->getError());
-
- return false;
- }
-
- // Now store the category
- if (!$category->store(true))
- {
- JError::raiseNotice(500, $category->getError());
-
- return false;
- }
-
- // Build the path for our category
- $category->rebuildPath($category->id);
-
- // Check if data is inserted correctly in tjsu_users table
- if ($result)
- {
- // Creat easysocial group
- jimport('techjoomla.jsocial.jsocial');
- jimport('techjoomla.jsocial.easysocial');
-
- $esdata = array();
- $esdata['title'] = $formData->get('name', 'string');
- $esdata['description'] = $formData->get('description', 'string');
- $esdata['uid'] = $formData->get('userid', 0);
-
- /* Easysocial group type -
- 1. Open Group
- 2. Closed Group
- 3. Invite only groupInvite only */
- $esdata['type'] = '3';
-
- $catid = array();
- $params = JComponentHelper::getParams('com_subusers');
- $catid['catId'] = $params->get('escategory', '');
-
- // Create object
- $jsSocialEasysocialObj = new JSocialEasysocial;
- $groupid = $jsSocialEasysocialObj->createGroup($esdata, $catid);
-
- // @TODO with easy social
- $member = $formData->get('userid', 0);
-
- if ($member)
- {
- $memberdata = new stdClass;
- $memberdata->cluster_id = $groupid;
- $memberdata->uid = $member;
- $memberdata->type = 'user';
- $memberdata->created = 'user';
- $memberdata->state = '1';
- $memberdata->owner = '1';
- $memberdata->admin = '1';
- $memberdata->invited_by = '0';
- $memberdata->admin = '1';
- $memberdata->reminder_sent = $category->id;
-
- // Insert data in easysocial cluster table table
- $grpMember = JFactory::getDBO()->insertObject('#__social_clusters_nodes', $memberdata);
- }
-
- // Check if data is inserted correctly in tjsu_users table
- if ($groupid)
- {
- $groupdata = new stdClass;
- $groupdata->grp_id = $groupid;
- $groupdata->client_id = $table->id;
- $groupdata->category_id = $category->id;
-
- // Insert data in easysocial xref table
- $grpid = JFactory::getDBO()->insertObject('#__es_group_xref', $groupdata);
-
- if ($grpid)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- 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('organization.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;
- }
-
- /**
- * To check if entered org id is already exists or not
- *
- * @param string $orgId orgId
- *
- * @return boolean
- *
- * @since 1.6
- */
- public function validateOrgId($orgId)
- {
- $query = "SELECT id FROM #__tjsu_organizations WHERE id = '" . $orgId . "'";
- $this->_db->setQuery($query);
- $orgIdExists = $this->_db->loadResult();
- $nameid = "";
-
- if ($orgIdExists)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * To check if entered is orgemail
- *
- * @param string $orgEmail Eamilid
- *
- * @return boolean
- *
- * @since 1.6
- */
- public function validateOrgEmail($orgEmail)
- {
- $query = "SELECT id FROM #__tjsu_organizations WHERE email = '" . $orgEmail . "'";
- $this->_db->setQuery($query);
- $emailExists = $this->_db->loadResult();
- $nameid = "";
-
- if ($emailExists)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-}
diff --git a/src/site/models/organizations.php b/src/site/models/organizations.php
deleted file mode 100755
index 367c1a8..0000000
--- a/src/site/models/organizations.php
+++ /dev/null
@@ -1,302 +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 SubusersModelOrganizations 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',
- 'created_by', 'a.created_by',
- 'ordering', 'a.ordering',
- 'state', 'a.state',
- 'email', 'a.email',
- 'logo', 'a.logo',
- );
- }
-
- 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 for organisation
- *
- * @return JDatabaseQuery
- *
- * @since 1.6
- */
- protected function getListQuery()
- {
- $app = JFactory::getApplication();
-
- // 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_organizations` As a');
-
- // $query->join('LEFT', '#__tjsu_users AS uc ON uc.client_id = a.id');
-
- if (!JFactory::getUser()->authorise('core.edit.state', 'com_subusers'))
- {
- $query->where('a.state = 1');
- }
-
- // Filter by search in organisation name
- $search = $app->getUserStateFromRequest('.filter.search', 'filter_organisation_search');
-
- if (!empty($search))
- {
- if (stripos($search, 'id:') === 0)
- {
- $query->where('a.id = ' . (int) substr($search, 3));
- }
- else
- {
- $search = $db->Quote('%' . $db->escape($search, true) . '%');
- $query->where('( a.name LIKE ' . $search . ' OR a.created_by 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/views/announcementform/index.html b/src/site/views/announcementform/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/announcementform/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/announcementform/tmpl/default.php b/src/site/views/announcementform/tmpl/default.php
deleted file mode 100755
index 6d34e88..0000000
--- a/src/site/views/announcementform/tmpl/default.php
+++ /dev/null
@@ -1,101 +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;
-
-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');
-$user = JFactory::getUser();
-$userId = $user->get('id');
-
-?>
-
-
-
-
-
-
- item->id)): ?>
-
-
-
-
-
-
-
-
-
diff --git a/src/site/views/announcementform/tmpl/default.xml b/src/site/views/announcementform/tmpl/default.xml
deleted file mode 100755
index 7a5e1ff..0000000
--- a/src/site/views/announcementform/tmpl/default.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/site/views/announcementform/tmpl/index.html b/src/site/views/announcementform/tmpl/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/announcementform/tmpl/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/announcementform/view.html.php b/src/site/views/announcementform/view.html.php
deleted file mode 100755
index 55a96c5..0000000
--- a/src/site/views/announcementform/view.html.php
+++ /dev/null
@@ -1,124 +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');
-
-/**
- * View to edit
- *
- * @since 1.6
- */
-class SubusersViewAnnouncementform 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));
- }
-
- $jinput = JFactory::getApplication()->input;
- $this->org_id = $jinput->get('org_id', '', 'INT');
-
- $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/announcements/index.html b/src/site/views/announcements/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/announcements/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/announcements/tmpl/default.php b/src/site/views/announcements/tmpl/default.php
deleted file mode 100755
index 2576825..0000000
--- a/src/site/views/announcements/tmpl/default.php
+++ /dev/null
@@ -1,193 +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;
-
-JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
-JHtml::_('bootstrap.tooltip');
-JHtml::_('behavior.multiselect');
-JHtml::_('formbehavior.chosen', 'select');
-
-$mainframe = JFactory::getApplication();
-$search_organisation = $mainframe->getUserStateFromRequest('.filter_organisation_search', 'filter_organisation_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');
-?>
-
-
-
-
-
-
diff --git a/src/site/views/announcements/tmpl/default.xml b/src/site/views/announcements/tmpl/default.xml
deleted file mode 100755
index 5328edd..0000000
--- a/src/site/views/announcements/tmpl/default.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/site/views/announcements/tmpl/default_filter.php b/src/site/views/announcements/tmpl/default_filter.php
deleted file mode 100755
index cb8b85f..0000000
--- a/src/site/views/announcements/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']);
-?>
-
-
\ No newline at end of file
diff --git a/src/site/views/announcements/tmpl/index.html b/src/site/views/announcements/tmpl/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/announcements/tmpl/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/announcements/view.html.php b/src/site/views/announcements/view.html.php
deleted file mode 100755
index b5a1192..0000000
--- a/src/site/views/announcements/view.html.php
+++ /dev/null
@@ -1,129 +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');
-
-/**
- * View class for a list of Subusers.
- *
- * @since 1.6
- */
-class SubusersViewAnnouncements 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();
- $user = JFactory::getUser();
-
- $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/organization/index.html b/src/site/views/organization/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/organization/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/organization/tmpl/default.php b/src/site/views/organization/tmpl/default.php
deleted file mode 100755
index bbf7678..0000000
--- a/src/site/views/organization/tmpl/default.php
+++ /dev/null
@@ -1,151 +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.module.helper');
-JHTML::_('behavior.modal');
-
-$document = JFactory::getDocument();
-$document->addStylesheet(JUri::root(true) . '/media/com_subusers/css/subusers.css');
-$canEdit = JFactory::getUser()->authorise('core.edit', 'com_subusers');
-$pagetitle = $this->item->name;
-JFactory::getDocument()->setTitle($pagetitle);
-if (!$canEdit && JFactory::getUser()->authorise('core.edit.own', 'com_subusers'))
-{
- $canEdit = JFactory::getUser()->id == $this->item->created_by;
-}
-?>
-
-item): ?>
-
- item):?>
-
-
-
loadTemplate("slider"); ?>
-
-
-
-
- item->description;?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/site/views/organization/tmpl/default.xml b/src/site/views/organization/tmpl/default.xml
deleted file mode 100755
index 9c121d9..0000000
--- a/src/site/views/organization/tmpl/default.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/site/views/organization/tmpl/default_membership.php b/src/site/views/organization/tmpl/default_membership.php
deleted file mode 100755
index 2726e70..0000000
--- a/src/site/views/organization/tmpl/default_membership.php
+++ /dev/null
@@ -1,69 +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.filesystem.file');
-jimport('joomla.filesystem.folder');
-$document = JFactory::getDocument();
-$document->addStylesheet(JUri::root(true) . '/media/com_subusers/css/subusers.css');
-$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;
-}
-
-?>
- oluser_id)
- {
- if ($this->memberstate == '')
- {
- ?>
-
- memberstate == 0)
- {
-
- ?>
-
- memberstate == 1)
- {
- ?>
-
-
-
-
-
-
-
diff --git a/src/site/views/organization/tmpl/default_slider.php b/src/site/views/organization/tmpl/default_slider.php
deleted file mode 100755
index 7eba3ee..0000000
--- a/src/site/views/organization/tmpl/default_slider.php
+++ /dev/null
@@ -1,59 +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.filesystem.file');
-jimport( 'joomla.filesystem.folder' );
-
-$document = JFactory::getDocument();
-$document->addStylesheet(JUri::root(true).'/media/com_subusers/css/subusers.css');
-$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->id;
- if(JFolder::exists($dir))
- {
- $filter = '.';
- //We only need images so exculding 'index.html' from folder
- $exclude = array('index.html', '.svn', 'CVS', '.txt', '.php');
- $files = JFolder::files($dir, $filter, false, false, $exclude );
- $fileroute = JUri::root(true) . '/images/com_subusers/partner_slides/org_'.(int) $this->item->id;
- ?>
-
-
-
-
-
- $file) { ?>
-
-
-
- $file) : ?>
-
- ' ;?>
-
-
-
-
-
-
- Previous
-
-
-
- Next
-
-
-
-
diff --git a/src/site/views/organization/tmpl/index.html b/src/site/views/organization/tmpl/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/organization/tmpl/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/organization/view.html.php b/src/site/views/organization/view.html.php
deleted file mode 100755
index 4b61306..0000000
--- a/src/site/views/organization/view.html.php
+++ /dev/null
@@ -1,146 +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');
-
-/**
- * View to edit
- *
- * @since 1.6
- */
-class SubusersViewOrganization 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');
- $this->oluser_id = $user->id;
- $model = $this->getModel();
-
- $jinput = JFactory::getApplication()->input;
- $orgid = $jinput->get('id', '0', 'INT');
-
- $this->memberOrgId = $model->checkmember($this->oluser_id, $orgid);
- $this->memberstate = $model->checkmemberstate($this->oluser_id, $orgid);
- $this->checkIfOrgAdmin = $model->checkIfOrgAdmin($this->item->id, $this->oluser_id);
-
- if (!empty($this->item))
- {
- $this->form = $this->get('Form');
- }
-
- if (!$orgid)
- {
- $app->redirect(JRoute::_('index.php?option=com_subusers&view=organizations&layout=pin', false));
- }
-
- // 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/organizationform/index.html b/src/site/views/organizationform/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/organizationform/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/organizationform/tmpl/default.php b/src/site/views/organizationform/tmpl/default.php
deleted file mode 100755
index 4bc39df..0000000
--- a/src/site/views/organizationform/tmpl/default.php
+++ /dev/null
@@ -1,271 +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');
-
-// Create object
-$doc = JFactory::getDocument();
-$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');
-
-// Load admin language file
-$lang = JFactory::getLanguage();
-$lang->load('com_subusers', JPATH_SITE);
-
-$doc->addScript(JUri::base() . '/media/com_subusers/js/form.js');
-$doc->addStylesheet(JUri::root(true) . '/media/com_subusers/css/subusers.css');
-$user = JFactory::getUser();
-$userId = $user->get( 'id' );
-
-// Acl helper call
-require_once JPATH_COMPONENT . '/helpers/acl.php';
-
-// Call static method for language constant
-SubusersFrontendHelper::getLanguageConstant();
-$orgId = $this->item->id;
-$userdata = SubusersAclHelper::partnerAdminName($orgId);
-?>
-
-
-
-
-
-
-
- item->id)): ?>
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/site/views/organizationform/tmpl/default.xml b/src/site/views/organizationform/tmpl/default.xml
deleted file mode 100755
index 0379285..0000000
--- a/src/site/views/organizationform/tmpl/default.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/site/views/organizationform/tmpl/index.html b/src/site/views/organizationform/tmpl/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/organizationform/tmpl/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/organizationform/view.html.php b/src/site/views/organizationform/view.html.php
deleted file mode 100755
index 6837c1b..0000000
--- a/src/site/views/organizationform/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 SubusersViewOrganizationform 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');
- $this->subusersParams = JComponentHelper::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'));
- }
-
- if (empty($title))
- {
- if (!empty($this->item->name))
- {
- $title = $this->item->name;
- }
- else
- {
- $title = JText::_('COM_SUBUSERS_ORGANIZATION_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/organizations/index.html b/src/site/views/organizations/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/organizations/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/organizations/tmpl/default.php b/src/site/views/organizations/tmpl/default.php
deleted file mode 100755
index b55bb28..0000000
--- a/src/site/views/organizations/tmpl/default.php
+++ /dev/null
@@ -1,216 +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');
-
-// Load js
-$doc = JFactory::getDocument();
-$doc->addScript(JUri::base() . '/media/com_subusers/js/sub.js');
-
-$mainframe = JFactory::getApplication();
-$search_organisation = $mainframe->getUserStateFromRequest('.filter_organisation_search', 'filter_organisation_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');?>
-
-
-
-
-
-
-
diff --git a/src/site/views/organizations/tmpl/default.xml b/src/site/views/organizations/tmpl/default.xml
deleted file mode 100755
index 5328edd..0000000
--- a/src/site/views/organizations/tmpl/default.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/site/views/organizations/tmpl/default_filter.php b/src/site/views/organizations/tmpl/default_filter.php
deleted file mode 100755
index cb8b85f..0000000
--- a/src/site/views/organizations/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']);
-?>
-
-
\ No newline at end of file
diff --git a/src/site/views/organizations/tmpl/index.html b/src/site/views/organizations/tmpl/index.html
deleted file mode 100755
index 42682b4..0000000
--- a/src/site/views/organizations/tmpl/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/site/views/organizations/tmpl/pin.php b/src/site/views/organizations/tmpl/pin.php
deleted file mode 100755
index 9673a26..0000000
--- a/src/site/views/organizations/tmpl/pin.php
+++ /dev/null
@@ -1,160 +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;
-
-JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
-JHtml::_('bootstrap.tooltip');
-JHtml::_('behavior.multiselect');
-JHtml::_('formbehavior.chosen', 'select');
-
-$mainframe = JFactory::getApplication();
-$search_organisation = $mainframe->getUserStateFromRequest('.filter_organisation_search', 'filter_organisation_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');
-
-$document = JFactory::getDocument();
-$document->addStylesheet(JUri::root(true) . '/media/com_subusers/css/subusers.css');
-?>
-
-
-
-
diff --git a/src/site/views/organizations/view.html.php b/src/site/views/organizations/view.html.php
deleted file mode 100755
index 6e8c444..0000000
--- a/src/site/views/organizations/view.html.php
+++ /dev/null
@@ -1,162 +0,0 @@
-
- * @package Subusers
- * @author Techjoomla
- * @copyright Copyright (c) 2009-2015 TechJoomla. All rights reserved
- * @license GNU General Public License version 2, or later
- */
-
-// No direct access
-defined('_JEXEC') or die('Restricted access');
-
-jimport('joomla.application.component.view');
-
-JPATH_SITE . 'components/com_subusers/helpers/subusers.php';
-
-/**
- * View class for a list of Subusers.
- *
- * @since 1.6
- */
-class SubusersViewOrganizations 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();
- $user = JFactory::getUser();
- $layout = $app->input->get('layout', 'default');
-
- $this->state = $this->get('State');
- $this->items = $this->get('Items');
- $this->pagination = $this->get('Pagination');
- $this->params = $app->getParams('com_subusers');
-
- $user = JFactory::getUser();
- $uid = $user->id;
-
- // Import helper file
- require_once JPATH_COMPONENT . '/helpers/acl.php';
-
- // Check logged in user is admin of organization
- $this->isAdmin = SubusersAclHelper::isOrganisationAdmin($uid);
-
- // Check logged in user is superuser or not
- $this->isSuperAdmin = SubusersAclHelper::isSuperAdmin($uid);
-
- if ($layout == 'default')
- {
- if (!$user->id)
- {
- $mainframe = JFactory::getApplication();
- $mainframe->redirect("index.php?option=com_subusers&view=organizations&layout=pin&Itemid=");
- }
- elseif(!$this->isSuperAdmin)
- {
- $mainframe = JFactory::getApplication();
- $mainframe->redirect("index.php?option=com_subusers&view=organizations&layout=pin");
- }
- }
-
- // 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))
- {
- $title = JText::_('COM_SUBUSERS_ORGANIZATION_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;
- }
-}