Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 30 additions & 0 deletions administrator/helpers/hierarchy.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,34 @@ public static function getActions()

return $result;
}

/**
* Check the user is Course creator or not
*
* @param user_Id $user_Id Id of user*
*
* @return result format
*
* @since 1.0
*/
public function checkManager($user_Id = null)
{
if (empty($user_Id))
{
$user_Id = JFactory::getUser()->id;
}

if ($user_Id)
{
// Checking if the user is having subuser in hierarchy
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_hierarchy/models', 'hierarchys');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Includes should be at the top of the file

$HierarchyModelHierarchys = JModelLegacy::getInstance('Hierarchys', 'HierarchyModel');
$HierarchyModelHierarchys->setState('filter.user_id', $user_Id);
$isManager = $HierarchyModelHierarchys->getItems();

return $isManager;
}

return false;
}
}
8 changes: 5 additions & 3 deletions administrator/models/hierarchys.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ protected function populateState($ordering = null, $direction = null)

$published = $app->getUserStateFromRequest($this->context . '.filter.state', 'filter_published', '', 'string');
$this->setState('filter.state', $published);
$user_id = $app->getUserState('filter.user_id');

// Filtering user_id
$this->setState('filter.user_id', $app->getUserStateFromRequest($this->context . '.filter.user_id', 'filter_user_id', '', 'string'));
if (!empty($user_id))
{
$this->setState('filter.user_id', $app->getUserStateFromRequest($this->context . '.filter.user_id', 'filter_user_id', '', 'string'));
}

// Load the parameters.
$params = JComponentHelper::getParams('com_hierarchy');
Expand Down Expand Up @@ -146,7 +149,6 @@ protected function getListQuery()

$query->where('a.block=0');


// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
Expand Down
Loading