public static function _load_account($parent = null, $prefix = '') { $db = my_db::open(); $result = array(); foreach ($db->query('select id, name, total from acc where acc_id ' . ($parent ? '=' . $db->esc($parent) : 'is null') . ' order by name') as $account) { $result[$account['id']] = $prefix . $account['name'] . ' (' . $account['total'] . ')'; $result += acc_ctrl::_load_account($account['id'], $prefix . $account['name'] . ' > '); } return $result; }
public function __construct() { parent::__construct(); security::logged_in(); $this->db = my_db::open(); $this->message = ''; $this->id = null; $this->name = new text(); $this->date = new text(); $this->entry = array(); $this->total = 0; $this->account = array(); $this->account = acc_ctrl::_load_account(); }