| @@ 104-111 (lines=8) @@ | ||
| 101 | */ |
|
| 102 | function __construct($dbms=False, Api\Db $db=null) |
|
| 103 | { |
|
| 104 | if(is_object($db)) |
|
| 105 | { |
|
| 106 | $this->m_odb = $db; |
|
| 107 | } |
|
| 108 | else |
|
| 109 | { |
|
| 110 | $this->m_odb = isset($GLOBALS['egw']->db) && is_object($GLOBALS['egw']->db) ? $GLOBALS['egw']->db : $GLOBALS['egw_setup']->db; |
|
| 111 | } |
|
| 112 | if (!($this->m_odb instanceof Api\Db)) |
|
| 113 | { |
|
| 114 | throw new Api\Exception\AssertionFailed('no EGroupware\Api\Db object!'); |
|
| @@ 104-111 (lines=8) @@ | ||
| 101 | { |
|
| 102 | $this->frontend = $frontend; |
|
| 103 | ||
| 104 | if (is_object($GLOBALS['egw_setup']->db)) |
|
| 105 | { |
|
| 106 | $this->db = $GLOBALS['egw_setup']->db; |
|
| 107 | } |
|
| 108 | else |
|
| 109 | { |
|
| 110 | $this->db = $GLOBALS['egw']->db; |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| @@ 42-49 (lines=8) @@ | ||
| 39 | */ |
|
| 40 | function __construct($account_id = '') |
|
| 41 | { |
|
| 42 | if (is_object($GLOBALS['egw_setup']) && is_object($GLOBALS['egw_setup']->db)) |
|
| 43 | { |
|
| 44 | $this->db = $GLOBALS['egw_setup']->db; |
|
| 45 | } |
|
| 46 | else |
|
| 47 | { |
|
| 48 | $this->db = $GLOBALS['egw']->db; |
|
| 49 | } |
|
| 50 | ||
| 51 | $this->account_id = get_account_id($account_id); |
|
| 52 | } |
|
| @@ 71-78 (lines=8) @@ | ||
| 68 | */ |
|
| 69 | function __construct($account_id = null) |
|
| 70 | { |
|
| 71 | if (is_object($GLOBALS['egw_setup']->db)) |
|
| 72 | { |
|
| 73 | $this->db = $GLOBALS['egw_setup']->db; |
|
| 74 | } |
|
| 75 | else |
|
| 76 | { |
|
| 77 | $this->db = $GLOBALS['egw']->db; |
|
| 78 | } |
|
| 79 | if ((int)$this->account_id != (int)$account_id) |
|
| 80 | { |
|
| 81 | $this->account_id = get_account_id((int)$account_id,@$GLOBALS['egw_info']['user']['account_id']); |
|