<?php

if (!defined('XOOPS_ROOT_PATH')) exit();

/**
 * This extends XoopsGroup to that user group list can get count of users.
 */
class XoopsGroupEx extends XoopsGroup
{
	/**
	 * $group is used for initialize. This class is no adapter pattern.
	 * @param $group XoopsGroup
	 */
	function XoopsGroupEx($group = null)
	{
		parent::XoopsGroup();
		$this->initVar('user_count', XOBJ_DTYPE_INT, null, false);

		$this->setVar('groupid', $group->get('groupid'));
		$this->setVar('name', $group->get('name'));
		$this->setVar('description', $group->get('description'));
		$this->setVar('group_type', $group->get('group_type'));

		if (is_object($group)) {
			$memberHandler =& xoops_gethandler('member');

			$this->setVar('user_count', $memberHandler->getUserCountByGroup($this->get('groupid')));
		}
	}
}

?>