Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vj langconst #68

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bc08544
Task #173952 Fix: Joomla 4 compatibility (#55)
divyachaudhari Aug 27, 2021
e8eebec
Task #173952 Chore: Script changes (#56)
divyachaudhari Oct 7, 2021
6878902
Task #173952 Chore: Table changes - changing default values for chang…
divyachaudhari Oct 7, 2021
8616a5a
Little corrections on text (#50)
kokbira Oct 7, 2021
ff6b65c
Task #173952 Chore: Changes in DB file (#58)
divyachaudhari Dec 8, 2021
0e68344
Task #166370 feat: use namespace in overall product
ankush-maherwal Apr 28, 2022
91fc1c5
Merge pull request #59 from ankush-maherwal/joomla-4
ankush-maherwal Apr 28, 2022
7e5a06d
Task #166370 feat: use namespace in overall product
ankush-maherwal Apr 29, 2022
babd606
Merge pull request #60 from ankush-maherwal/joomla-4
ankush-maherwal Apr 29, 2022
afdb2c1
Task #166370 feat: use namespace in overall product
ankush-maherwal Apr 29, 2022
e0a9c03
Merge pull request #61 from ankush-maherwal/joomla-4
ankush-maherwal Apr 29, 2022
338c045
Task #166370 feat: use namespace in overall product
ankush-maherwal Apr 29, 2022
56c695a
Merge pull request #62 from ankush-maherwal/joomla-4
ankush-maherwal Apr 29, 2022
857ed7e
Task #190386 feat: Joomla 4 related changes
ankush-maherwal Nov 16, 2022
36b12dc
Merge pull request #63 from ankush-maherwal/joomla-4
ankush-maherwal Nov 16, 2022
55fd13b
Joomla 4 hierarchy compatibility issues
MeghaBiranje Jun 27, 2023
d4f0132
Resolve comments
MeghaBiranje Jun 28, 2023
5fd1f2c
Merge pull request #65 from MeghaBiranje/j4compatible
ankush-maherwal Jun 28, 2023
2eef721
Bug #202982 fix: User create hierarchey menu in FE it shows error.
ManasiBadave Aug 9, 2023
6641afa
Bug #202982 fix: User create hierarchey menu in FE it shows error.
ManasiBadave Aug 9, 2023
57614f8
Merge pull request #66 from ManasiBadave/Bug#202982
ankush-maherwal Aug 25, 2023
6d3c839
change lang const
Dec 23, 2024
1ba8ec5
change done
Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ Here is a live example of how general and context specific hierarchy can be:
Mark, Swapnil, Mary & Vaishali normally report to Vijay. However Mary and Vaishali have been asked to additionally report to Parth in the special context of a 'Project A'

## How to Install
Donwload the code. Package it as a Zip and install it using the Joomla extension manager.
Download the code. Package it as a Zip and install it using the Joomla extension manager.

## Configurtion
Integration Options : Core Joomla, EasySocial, JomSocial, EasyProfile, Community Builder
Integration Options: Core Joomla, EasySocial, JomSocial, EasyProfile, Community Builder

## Frontend Menus
The Hierarchy management system supports the following menus on the frontend.

### My Team
Shows a list view of people directly reporting to the logged in user. List can be filtered by Context. Default (context ?) is None.
Shows a list view of people directly reporting to the logged in user. List can be filtered by Context. Default (context ?) is None.

From this view they can drill down to the user and see a short User information page and also the team that reports to that user. An Icon will let you switch to a visual representation that will show a chart view.

The default layout to use can be set in menu parameters.
Expand Down
31 changes: 17 additions & 14 deletions administrator/assets/elements/integrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
*/

defined('_JEXEC') or die('Restricted access');
jimport('joomla.form.formfield');
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Filesystem\File;

/**
* JFormFieldIntegrations class
Expand All @@ -17,7 +20,7 @@
* @subpackage component
* @since 1.0
*/
class JFormFieldIntegrations extends JFormField
class FormFieldIntegrations extends FormField
{
/**
*Function to construct a hierarchy view
Expand Down Expand Up @@ -63,37 +66,37 @@ public function fetchElement ($name, $value, $controlName)
if ($name == 'jform[integration]')
{
$options = array();
$options[] = JHtml::_('select.option', '2', JText::_('COM_HIERARCHY_NATIVE'));
$options[] = HTMLHelper::_('select.option', '2', Text::_('COM_HIERARCHY_NATIVE'));

if (JFile::exists($this->communityMainFile))
if (File::exists($this->communityMainFile))
{
$options[] = JHtml::_('select.option', '1', JText::_('COM_HIERARCHY_JOMSOCIAL'));
$options[] = HTMLHelper::_('select.option', '1', Text::_('COM_HIERARCHY_JOMSOCIAL'));
}

if (JFile::exists($this->jeventsMainFile))
if (File::exists($this->jeventsMainFile))
{
$options[] = JHtml::_('select.option', '3', JText::_('COM_HIERARCHY_JEVENT'));
$options[] = HTMLHelper::_('select.option', '3', Text::_('COM_HIERARCHY_JEVENT'));
}

if (JFile::exists($this->esMainFile))
if (File::exists($this->esMainFile))
{
$options[] = JHtml::_('select.option', '4', JText::_('COM_HIERARCHY_EASYSOCIAL'));
$options[] = HTMLHelper::_('select.option', '4', Text::_('COM_HIERARCHY_EASYSOCIAL'));
}

if (JFile::exists($this->easyProMainFile))
if (File::exists($this->easyProMainFile))
{
$options[] = JHtml::_('select.option', '5', JText::_('COM_HIERARCHY_EASYPROFILE'));
$options[] = HTMLHelper::_('select.option', '5', Text::_('COM_HIERARCHY_EASYPROFILE'));
}

if (JFile::exists($this->cbMainFile))
if (File::exists($this->cbMainFile))
{
$options[] = JHtml::_('select.option', '6', JText::_('COM_HIERARCHY_COMMUNITY_BUILDER'));
$options[] = HTMLHelper::_('select.option', '6', Text::_('COM_HIERARCHY_COMMUNITY_BUILDER'));
}

$fieldName = $name;
}

$html = JHtml::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value, $controlName . $name);
$html = HTMLHelper::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value, $controlName . $name);

return $html;
}
Expand Down
8 changes: 5 additions & 3 deletions administrator/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@

// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Factory;

/**
* Hierarchy view class for the hierarchy package.
*
* @since 1.6
*/
class HierarchyController extends JControllerLegacy
class HierarchyController extends BaseController
{
/**
* Method to display a view.
Expand All @@ -31,8 +33,8 @@ public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/hierarchy.php';

$view = JFactory::getApplication()->input->getCmd('view', 'hierarchys');
JFactory::getApplication()->input->set('view', $view);
$view = Factory::getApplication()->input->getCmd('view', 'hierarchys');
Factory::getApplication()->input->set('view', $view);

parent::display($cachable, $urlparams);

Expand Down
42 changes: 24 additions & 18 deletions administrator/controllers/hierarchy.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@

// No direct access
defined('_JEXEC') or die;

jimport('joomla.application.component.controllerform');
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Router\Route;

/**
* The Hierarchy Controller
*
* @since 1.6
*/
class HierarchyControllerHierarchy extends JControllerForm
class HierarchyControllerHierarchy extends FormController
{
/**
* Constructor.
Expand All @@ -30,11 +34,11 @@ public function __construct()
{
$this->view_list = 'hierarchys';

$this->db = JFactory::getDbo();
JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_hierarchy/tables');
$this->hierarchyTableObj = JTable::getInstance('Hierarchy', 'HierarchyTable', array('dbo', $this->db));
$this->db = Factory::getDbo();
Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_hierarchy/tables');
$this->hierarchyTableObj = Table::getInstance('Hierarchy', 'HierarchyTable', array('dbo', $this->db));

$this->msg = JText::_('COM_HIERARCHY_REPORTEES_SAVE_MSG');
$this->msg = Text::_('COM_HIERARCHY_REPORTEES_SAVE_MSG');
parent::__construct();
}

Expand All @@ -51,21 +55,21 @@ public function __construct()
public function save($key = null, $urlVar = null)
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

// Initialise variables.
$app = JFactory::getApplication();
$app = Factory::getApplication();
$model = $this->getModel('hierarchy', 'HierarchyModel');

// Get the user data.
$data = JFactory::getApplication()->input->get('jform', array(), 'array');
$data = Factory::getApplication()->input->get('jform', array(), 'array');

// Validate the posted data.
$form = $model->getForm();

if (!$form)
{
JError::raiseError(500, $model->getError());
$app->enqueueMessage($model->getError(), 'error');

return false;
}
Expand All @@ -76,7 +80,7 @@ public function save($key = null, $urlVar = null)
$data = $model->validate($form, $data);
}

$jinput = JFactory::getApplication()->input;
$jinput = Factory::getApplication()->input;
$data['user_id'] = $jinput->get('user_id', '', 'int');
$data['created_by'] = $jinput->get('created_by', '', 'int');
$data['modified_by'] = $jinput->get('modified_by', '', 'int');
Expand Down Expand Up @@ -112,7 +116,7 @@ public function save($key = null, $urlVar = null)
$return = $model->save($data);
}

$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$id = $input->get('id');

if (empty($id))
Expand All @@ -124,8 +128,9 @@ public function save($key = null, $urlVar = null)

if ($task == 'apply')
{
$redirect = JRoute::_('index.php?option=com_hierarchy&view=hierarchy&layout=edit&id=' . $id, false);
$app->redirect($redirect, $this->msg);
$redirect = Route::_('index.php?option=com_hierarchy&view=hierarchy&layout=edit&id=' . $id, false);
$app->enqueueMessage($this->msg);
$app->redirect($redirect);
}

// Clear the profile id from the session.
Expand All @@ -138,8 +143,9 @@ public function save($key = null, $urlVar = null)
}

// Redirect to the list screen.
$redirect = JRoute::_('index.php?option=com_hierarchy&view=hierarchys', false);
$app->redirect($redirect, $this->msg);
$redirect = Route::_('index.php?option=com_hierarchy&view=hierarchys', false);
$app->enqueueMessage($this->msg);
$app->redirect($redirect);

// Flush the data from the session.
$app->setUserState('com_hierarchy.edit.hierarchy.data', null);
Expand All @@ -154,7 +160,7 @@ public function save($key = null, $urlVar = null)
*/
public function getAutoSuggestUsers()
{
$jinput = JFactory::getApplication()->input;
$jinput = Factory::getApplication()->input;
$userId = $jinput->get('user_id', '', 'int');

// Get the model.
Expand Down
43 changes: 23 additions & 20 deletions administrator/controllers/hierarchys.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@

// No direct access.
defined('_JEXEC') or die;

jimport('joomla.application.component.controlleradmin');
jimport('joomla.filesystem.file');
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

/**
* The Hierarchys List Controller
*
* @since 1.6
*/
class HierarchyControllerHierarchys extends JControllerAdmin
class HierarchyControllerHierarchys extends AdminController
{
/**
* Proxy for getModel
Expand Down Expand Up @@ -47,23 +49,22 @@ public function getModel($name = 'hierarchy', $prefix = 'HierarchyModel', $confi
*/
public function csvImport()
{
jimport('joomla.filesystem.file');
$app = JFactory::getApplication();
$app = Factory::getApplication();

// Start file heandling functionality
$fname = $_FILES['csvfile']['name'];
$rowNum = 0;
$uploadsDir = JFactory::getApplication()->getCfg('tmp_path') . '/' . $fname;
JFile::upload($_FILES['csvfile']['tmp_name'], $uploadsDir);
$uploadsDir = Factory::getApplication()->get('tmp_path') . '/' . $fname;
File::upload($_FILES['csvfile']['tmp_name'], $uploadsDir);

if ($file = fopen($uploadsDir, "r"))
{
$ext = JFile::getExt($uploadsDir);
$ext = File::getExt($uploadsDir);

if ($ext != 'csv')
{
$app->enqueueMessage(JText::_('COM_HIERARCHY_CSV_FORMAT_ERROR'), 'Message');
$app->redirect(JRoute::_('index.php?option=com_hierarchy&view=hierarchys', false));
$app->enqueueMessage(Text::_('COM_HIERARCHY_CSV_FORMAT_ERROR'), 'Message');
$app->redirect(Route::_('index.php?option=com_hierarchy&view=hierarchys', false));

return;
}
Expand Down Expand Up @@ -100,14 +101,14 @@ public function csvImport()
}
else
{
$app->enqueueMessage(JText::_('COM_HIERARCHY_IMPORT_CSV_ERROR'), 'error');
$app->redirect(JRoute::_('index.php?option=com_hierarchy&view=hierarchys', false));
$app->enqueueMessage(Text::_('COM_HIERARCHY_IMPORT_CSV_ERROR'), 'error');
$app->redirect(Route::_('index.php?option=com_hierarchy&view=hierarchys', false));

return;
}

$model = $this->getModel();
$userID = JFactory::getUser()->id;
$userID = Factory::getUser()->id;

$data = array();

Expand All @@ -123,8 +124,10 @@ public function csvImport()
$result = $model->save($data);
}

$msg = JText::_('COM_HIERARCHY_IMPORT_CSV_SUCCESS_MSG');
$app->redirect(JRoute::_('index.php?option=com_hierarchy&view=hierarchys', false), $msg);
$msg = Text::_('COM_HIERARCHY_IMPORT_CSV_SUCCESS_MSG');

$app->enqueueMessage($msg, 'success');
$app->redirect(Route::_('index.php?option=com_hierarchy&view=hierarchys', false));

return;
}
Expand All @@ -140,7 +143,7 @@ public function csvImport()
*/
public function getUserId($email)
{
$db = JFactory::getDbo();
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__users'))
Expand All @@ -160,7 +163,7 @@ public function getUserId($email)
public function remove()
{
$model = $this->getModel();
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$post = $input->post;
$userIds = $post->get('cid', '', 'ARRAY');

Expand All @@ -181,11 +184,11 @@ public function remove()

if ($model->delete($hierarchyIds))
{
$msg = JText::_('COM_HIERARCHY_HIERARCHY_DELETED_SCUSS');
$msg = Text::_('COM_HIERARCHY_HIERARCHY_DELETED_SCUSS');
}
else
{
$msg = JText::_('COM_HIERARCHY_HIERARCHY_DELETED_ERROR');
$msg = Text::_('COM_HIERARCHY_HIERARCHY_DELETED_ERROR');
}

$this->setRedirect("index.php?option=com_hierarchy&view=hierarchys", $msg);
Expand Down
Loading