Fix #269: Managed Area layer legend items not appearing.

As a result of fixing #255, where we removed parent node ids from the
list of visible layer ids, the map legend for nested layers fails to
render on the map export.

This change will append all parentLayerIds from visible layers to the
PrintTask template when the map is exported.
This loop will terminate early if `result[i++]` (which is a layer Id) is `0`, which is what AGS REST layers are indexed from.