summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-01 01:37:57 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-01 01:37:57 +0000
commit9a27954c4c16bdee874490deabaf34b8eaff5edf (patch)
treee7fa023428d73a2a113023d059c930350f345203 /LedgerSMB/DBObject
parent182af25edbe0f0d3f2fab4ea61465e552004c242 (diff)
Menu cross sections, used for example in handhelds, now work from an API point of view
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1477 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/DBObject')
-rw-r--r--LedgerSMB/DBObject/Menu.pm33
1 files changed, 29 insertions, 4 deletions
diff --git a/LedgerSMB/DBObject/Menu.pm b/LedgerSMB/DBObject/Menu.pm
index 733d8f91..f92c02cb 100644
--- a/LedgerSMB/DBObject/Menu.pm
+++ b/LedgerSMB/DBObject/Menu.pm
@@ -40,11 +40,39 @@ th result set, This function does not return an entry for the top-level menu.
sub generate {
my ($self) = shift @_;
- my @args;
@{$self->{menu_items}} = $self->exec_method(funcname => 'menu_generate');
+ $self->__generate;
+
+ return @{$self->{menu_items}};
+}
+
+=over
+
+=item Menu::generate_secton($object)
+
+This class acts like Menu::Generate except it returns only a cross-section of
+the menu. Basically it returns all nodes which are direct children below
+$object->{parent_id}.
+
+=cut
+
+sub generate_section {
+ my ($self) = shift @_;
+
+ @{$self->{menu_items}} = $self->exec_method(funcname => 'menu_children');
+ $self->__generate;
+
+ return @{$self->{menu_items}};
+}
+
+# Private method which contains logic common to the full menu and section logic
+
+sub __generate {
+ my ($self) = @_;
$self->debug({file => '/tmp/menu'});
+ my @args;
shift @{$self->{menu_items}};
@@ -61,6 +89,3 @@ sub generate {
}
}
}
- return @{$self->{menu_items}};
-}
-