diff --git a/phpgwapi/inc/class.accounts.inc.php b/phpgwapi/inc/class.accounts.inc.php index 5618bec6a4..b6d21cdca2 100644 --- a/phpgwapi/inc/class.accounts.inc.php +++ b/phpgwapi/inc/class.accounts.inc.php @@ -124,6 +124,28 @@ class accounts extends accounts_backend 'start' => 'start with', 'exact' => 'exact', ); + + /** + * the instance of the accounts class + * + * @var accounts + */ + static $_instance = NULL; + + /** + * the singleton pattern + * + * @return accounts + */ + static function getInstance() + { + if (self::$_instance === NULL) { + self::$_instance = new accounts; + } + + return self::$_instance; + } + /** * Constructor * @@ -136,6 +158,18 @@ class accounts extends accounts_backend $this->accounts_backend(); // call constructor of extended class } + /** + * set the accountId used by this class + * + * @param int $accountId + */ + function setAccountId($accountId) + { + if($accountId && is_numeric($accountId)) { + $this->account_id = (int)$accountId; + } + } + /** * Searches / lists accounts: users and/or groups *