<?php
class Document_View_Helper_GetGroup extends Zend_View_Helper_Abstract {
	public function getGroup($groupId) {
		static $tableGroups = null;
		static $groupList = array();
		
		if (is_null($tableGroups)) {
			$tableGroups = new Application_Model_UsersGroups();
		}
		
		if (isset($groupList[$groupId]))
			return $groupList[$groupId];
		
		$group = $tableGroups->find($groupId)->current();
		
		if (!$group) {
			$group = new stdClass();
			$group->id = 0;
			$group->group_name = "-";
		}
		
		$groupList[$groupId] = $group;
		
		return $group;
	}
}