예제 #1
0
 private static function home_child_list($id, $layer)
 {
     if (is_numeric($id)) {
         $content_array = array();
         $equipment_type = new EquipmentType($id);
         $equipment_type_child_array = $equipment_type->get_children();
         if (is_array($equipment_type_child_array) and count($equipment_type_child_array) >= 1) {
             foreach ($equipment_type_child_array as $key => $value) {
                 $equipment_type = new EquipmentType($value);
                 $content_array[self::$home_list_counter]['padding'] = 0.5 * $layer;
                 $content_array[self::$home_list_counter]['name'] = $equipment_type->get_name();
                 $content_array[self::$home_list_counter]['category'] = $equipment_type->get_cat_name();
                 $content_array[self::$home_list_counter]['id'] = $value;
                 if ($equipment_type->get_location_id() == null) {
                     $content_array[self::$home_list_counter]['location'] = "<span class='italic'>none</span>";
                 } else {
                     $location = new Location($equipment_type->get_location_id());
                     $content_array[self::$home_list_counter]['location'] = $location->get_name(false);
                 }
                 $paramquery = $_GET;
                 $paramquery['action'] = "detail";
                 $paramquery['id'] = $value;
                 $params = http_build_query($paramquery, '', '&#38;');
                 $content_array[self::$home_list_counter]['detail_params'] = $params;
                 $paramquery = $_GET;
                 $paramquery['action'] = "delete";
                 $paramquery['id'] = $value;
                 $params = http_build_query($paramquery, '', '&#38;');
                 $content_array[self::$home_list_counter]['delete_params'] = $params;
                 $paramquery = $_GET;
                 $paramquery['action'] = "add_child";
                 $paramquery['id'] = $value;
                 $params = http_build_query($paramquery, '', '&#38;');
                 $content_array[self::$home_list_counter]['create_child_params'] = $params;
                 $temp_counter = self::$home_list_counter;
                 self::$home_list_counter++;
                 $equipment_type_child_array = self::home_child_list($value, $layer + 1);
                 if (is_array($equipment_type_child_array)) {
                     $content_array = $content_array + $equipment_type_child_array;
                 }
             }
             return $content_array;
         } else {
             return null;
         }
     } else {
         return null;
     }
 }