<?php

	class XenStaff_Model_StaffGroupsUserIds extends XenForo_Model
	{	

		public function getListofUsersPerStaffGroup()
		{
			$userIds = array();

			foreach ($this->getAllUserIdsPerStaffGroup() AS $userId)
			{
				$userIds[] = array(
				'user_id' => $userId['user_id'],
				'user_group_id' => $userId['user_group_id']
				);
			}


			return $userIds;

		}

		public function getAllUserIdsPerStaffGroup()
		{

                        $staffgroups = XenForo_Application::get('options')->staffdisplayGroups;

                        if (empty($staffgroups))
                        {
                                 $staffgroups = array(3,4);
                        }

                        $staffgroups = implode(',', $staffgroups);

			return $this->_getDb()->fetchAll('
			SELECT user_id, user_group_id
			FROM xf_user_group_relation
			WHERE user_group_id IN (' . $staffgroups . ')
			ORDER BY user_group_id
			');

		}


	}