Skip to content

Commit

Permalink
Merge pull request #178 from pravinTek/modifyDateFormat
Browse files Browse the repository at this point in the history
Issue #145 feat: to get usergoups title based on user id
  • Loading branch information
vaivk369 authored Jan 22, 2020
2 parents 8b7442b + 9c3ef87 commit 4830d33
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tjreports/site/models/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -1552,4 +1552,38 @@ public function addTjReportsPlugins()

return $count;
}

/**
* Method to get report plugin of particular type for inter linking
*
* @param Int $userId User Id
*
* @return Array
*
* @since __DEPLOY_VERSION__
*/
protected function getUserGroups($userId)
{
if (!$userId)
{
return array();
}

$db = JFactory::getDbo();
$query = $db->getQuery(true);

// Get the titles for the user groups.
$query = $db->getQuery(true)
->select($db->quoteName('ug.id'))
->select($db->quoteName('ug.title'))
->from($db->quoteName('#__usergroups', 'ug'))
->join('INNER', $db->qn('#__user_usergroup_map', 'ugm') . ' ON (' .
$db->qn('ugm.group_id') . ' = ' . $db->qn('ug.id') . ')')
->where($db->quoteName('ugm.user_id') . ' = ' . (int) $userId);

$db->setQuery($query);

// Set the titles for the user groups.
return $db->loadAssocList('id', 'title');
}
}

0 comments on commit 4830d33

Please sign in to comment.