<?php

	class XenStaff_Model_UserGroupOptions extends XenForo_Model
	{	

	// creates a check box for each user group with an id > 2

		public function getUserGroupOptions($selectedGroupIds)
		{

			$userGroups = array();
			foreach ($this->getAllButCommonUserGroups() AS $userGroup)
			{
				$userGroups[] = array(
				'label' => $userGroup['title'],
				'value' => $userGroup['user_group_id'],
				'selected' => in_array($userGroup['user_group_id'], $selectedGroupIds)
				);
			}

			return $userGroups;

		}

		public function getAllButCommonUserGroups()
		{

			return $this->_getDb()->fetchAll('
			SELECT user_group_id, title
			FROM xf_user_group
			WHERE user_group_id > 2
			ORDER BY user_group_id
			');

		}

	}