Module m_hierarchy

Model for named hierarchies.

Copyright © 2015 Marc Worrell

Behaviours: zotonic_model.

Description

Model for named hierarchies

Function Index

append/3
assign_nrs/2Go through the flattened tree and assign the range nrs.
children/3Return a list of all the ids below the id, excluding the id itself.
contains/3Return the list of ids contained within (and including) the id.
ensure/2Ensure that all resources are present in a hierarchy.
ensure/3Ensure that all resources of a certain category are present in a hierarchy.
flush/2
m_get/3Fetch the value for the key from a model source.
menu/2Transform a hierarchy to a menu structure.
parents/3Return a list of all this id's ancestor nodes.
save/3Save a new hierarchy, replacing a previous one.
save_nocheck/3
tree/2Fetch a named tree.
tree1/2Fetch a 1 level deep tree.
tree_flat/2Make a flattened list with indentations showing the level of the tree entries.
tree_flat/3

Function Details

append/3

append(Name0, Missing, Context) -> any()

assign_nrs/2

assign_nrs(Diff, OldFlatNr) -> any()

Go through the flattened tree and assign the range nrs

children/3

children(Name, Id, Context) -> any()

Return a list of all the ids below the id, excluding the id itself

contains/3

contains(Name, Id, Context) -> any()

Return the list of ids contained within (and including) the id.

ensure/2

ensure(Category::atom() | binary() | string() | integer(), Context::#context{}) -> {ok, integer()} | {error, term()}

Ensure that all resources are present in a hierarchy.

ensure/3

ensure(Name::atom() | binary() | string(), CatId::atom() | integer() | string(), Context::#context{}) -> {ok, integer()}

Ensure that all resources of a certain category are present in a hierarchy.

flush/2

flush(Name, Context) -> any()

m_get/3

m_get(Rest::list(), Msg::zotonic_model:opt_msg(), Context::z:context()) -> zotonic_model:return()

Fetch the value for the key from a model source

menu/2

menu(Name, Context) -> any()

Transform a hierarchy to a menu structure

parents/3

parents(Name, Id, Context) -> any()

Return a list of all this id's ancestor nodes

save/3

save(Name, Tree, Context) -> any()

Save a new hierarchy, replacing a previous one.

save_nocheck/3

save_nocheck(Name, NewTree, Context) -> any()

tree/2

tree(Id, Context) -> any()

Fetch a named tree

tree1/2

tree1(Tree, Context) -> any()

Fetch a 1 level deep tree

tree_flat/2

tree_flat(Name, Context) -> any()

Make a flattened list with indentations showing the level of the tree entries. Useful for select lists.

tree_flat/3

tree_flat(Name, Id, Context) -> any()


Generated by EDoc