/** * Renders the given root objects to HTML and calls _list_child_elements() * * @param array &$root_objects reference to the array of root objects * @param midcom_helper_reflector_tree &$ref Reflector singleton */ private function _list_root_elements(&$root_objects, midcom_helper_reflector_tree &$ref) { echo "<ul class=\"midgard_admin_asgard_navigation\">\n"; $label_mapping = array(); foreach ($root_objects as $i => $object) { $label_mapping[$i] = htmlspecialchars($ref->get_object_label($object)); } asort($label_mapping); foreach ($label_mapping as $index => $label) { $object = $root_objects[$index]; $selected = $this->_is_selected($object); $css_class = get_class($object); $this->_common_css_classes($object, $ref, $css_class); $mode = $this->_request_data['default_mode']; if (strpos($css_class, 'readonly')) { $mode = 'view'; } $this->shown_objects[$object->guid] = true; echo " <li class=\"{$css_class}\">"; $icon = $ref->get_object_icon($object); if (empty($label)) { $label = "#oid_{$object->id}"; } echo "<a href=\"" . midcom_connection::get_url('self') . "__mfa/asgard/object/{$mode}/{$object->guid}/\" title=\"GUID: {$object->guid}, ID: {$object->id}\">{$icon}{$label}</a>\n"; // If there is exactly one root object, show its children, since this is what the user most likely wants to reach if ($selected || sizeof($root_objects) == 1) { $this->_list_child_elements($object); } echo " </li>\n"; } echo "</ul>\n"; }