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 is a little confusing and looks like it does extra processing on the parentIds that are modifying `results` as you loop over it.  It's not clear if that is the desired behavior - are you trying to get the nested structure without going recursive?