public function showListPanel($options = array()) { $rand_id = rand(0, 1000); $defaults = array('id' => $rand_id, 'headers' => array(), 'title' => '', 'connection_id' => -1, 'list' => array(), 'hideNoneRowsMsg' => false, 'object_type' => ''); $options = array_merge($defaults, $options); $object_type = $options['object_type']; $con_id = $options['connection_id']; $title = $options['title']; $list_data = array(); $headers_data = $options['headers']; $id = $options['id']; $hide_none_rows = $options['hideNoneRowsMsg']; foreach ($options['list'] as $index => $row) { $last_index = count($row) - 1; if (isset($row[$last_index]['edit_button'])) { $edit_button = SystemHelper::addIconButton(array('icon' => $row[$last_index]['edit_button']['icon'], 'url' => $row[$last_index]['edit_button']['url'], 'tooltip' => $row[$last_index]['edit_button']['label'], 'tooltip-align' => 'right', 'is_popup' => $row[$last_index]['remove_button']['url'] != "#" ? true : false, 'onClick' => isset($row[$last_index]['remove_button']['onClick']) ? $row[$last_index]['remove_button']['onClick'] : "", 'popup_title' => $row[$last_index]['edit_button']['label'], 'returnHTML' => true)); } if (isset($row[$last_index]['remove_button'])) { $remove_button = SystemHelper::addIconButton(array('icon' => $row[$last_index]['remove_button']['icon'], 'url' => $row[$last_index]['remove_button']['url'], 'tooltip' => $row[$last_index]['remove_button']['label'], 'tooltip-align' => 'right', 'is_popup' => $row[$last_index]['remove_button']['url'] != "#" ? true : false, 'onClick' => isset($row[$last_index]['remove_button']['onClick']) ? $row[$last_index]['remove_button']['onClick'] : "", 'popup_title' => $row[$last_index]['remove_button']['label'], 'returnHTML' => true)); } $row[$last_index] = (isset($edit_button) ? $edit_button : "") . " " . (isset($remove_button) ? $remove_button : ""); $list_data[] = $row; } $add_button = SystemHelper::addIconButton(array('icon' => $options['add_button']['icon'], 'url' => $options['add_button']['url'] . ($rand_id == $id ? "/" . $id : ""), 'tooltip' => $options['add_button']['label'], 'tooltip-align' => 'right', 'is_popup' => true, 'data' => array('panel_id' => $id), 'popup_title' => $options['add_button']['label'], 'returnHTML' => true)); //$remove_button = $options['buttons']['remove']; //$edit_button = $options['buttons']['edit']; //$refresh_button = $options['buttons']['refresh']; $panel = "<b>" . $title . " " . $add_button . "</b>"; $panel .= "<div class='ls-box'>"; $panel .= SystemHelper::createTableFromArray(array('id' => "listpanel_table_" . $id, 'headers' => $headers_data, 'hideNoneRowsMsg' => $hide_none_rows, 'show_always_as_mobile' => true, 'data' => $list_data)); $panel .= "</div>"; if (isset($options['returnHTML']) && $options['returnHTML']) { return $panel; } echo $panel; }