forked from extern/egroupware
added a singleton pattern to the accounts class
This commit is contained in:
parent
ed7b31d496
commit
48a17e28c1
@ -124,6 +124,28 @@ class accounts extends accounts_backend
|
|||||||
'start' => 'start with',
|
'start' => 'start with',
|
||||||
'exact' => 'exact',
|
'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
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -136,6 +158,18 @@ class accounts extends accounts_backend
|
|||||||
$this->accounts_backend(); // call constructor of extended class
|
$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
|
* Searches / lists accounts: users and/or groups
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user