From 3a5e7b08e568a586ce15d452293a40bf2587fe67 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 24 Mar 2020 15:14:57 +0100 Subject: [PATCH] WIP: Added class and page for PENs management --- .../modules/configuration_wizard_setup.php | 35 +++ .../include/class/ConfigPEN.class.php | 220 ++++++++++++++++++ 2 files changed, 255 insertions(+) create mode 100644 pandora_console/godmode/modules/configuration_wizard_setup.php create mode 100644 pandora_console/include/class/ConfigPEN.class.php diff --git a/pandora_console/godmode/modules/configuration_wizard_setup.php b/pandora_console/godmode/modules/configuration_wizard_setup.php new file mode 100644 index 0000000000..ccf5ef04ca --- /dev/null +++ b/pandora_console/godmode/modules/configuration_wizard_setup.php @@ -0,0 +1,35 @@ + 'noaccess']); + } + + include 'general/noaccess.php'; + exit; + } + + $this->baseUrl = 'index.php?sec=configuration_wizard_setup&sec2=godmode/modules/private_enterprise_numbers'; + + } + + + /** + * Run main page. + * + * @return void + */ + public function run() + { + // Require specific CSS and JS. + ui_require_css_file('wizard'); + ui_require_css_file('discovery'); + + // Header section. + // Breadcrums. + $this->setBreadcrum([]); + + $this->prepareBreadcrum( + [ + [ + 'link' => '', + 'label' => __('Wizard Setup'), + 'selected' => false, + ], + [ + 'link' => $this->baseUrl, + 'label' => __('Private Enterprise Numbers'), + 'selected' => true, + ], + ], + true + ); + + ui_print_page_header( + __('Private Enterprise Numbers'), + '', + false, + '', + true, + '', + false, + '', + GENERIC_SIZE_TEXT, + '', + $this->printHeader(true) + ); + + $this->createMainTable(); + + } + + + /** + * Undocumented function + * + * @return void + */ + private function createMainTable() + { + global $config; + // Get the count of PENs. + $countPENs = db_get_value( + 'count(*)', + 'tnetwork_profile' + ); + + // Get all the data. + $resultPENs = db_get_all_rows_filter( + 'tnetwork_profile', + [ + 'order' => 'id_np', + 'limit' => $config['block_size'], + ] + ); + + hd($resultPENs); + + ui_pagination($countPENs, false, $this->offset); + // Create the table with Module Block list. + $table = new StdClasS(); + $table->class = 'databox data'; + $table->width = '75%'; + $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;'; + $table->rowid = []; + $table->data = []; + + $table->cellpadding = 0; + $table->cellspacing = 0; + $table->width = '100%'; + $table->class = 'info_table'; + + $table->head = []; + $table->head[0] = html_print_checkbox('all_delete', 0, false, true, false); + $table->head[1] = __('PEN'); + $table->head[2] = __('Manufacturer ID'); + $table->head[3] = __('Description'); + $table->head[4] = ''.__('Action').''; + + $table->size = []; + $table->size[0] = '20px'; + $table->size[1] = '10%'; + $table->size[2] = '25%'; + $table->size[4] = '70px'; + + $table->align = []; + $table->align[3] = 'left'; + + $table->data = []; + + foreach ($resultPENs as $row) { + $data = []; + $data[0] = html_print_checkbox_extended('delete_multiple[]', $row['id_np'], false, false, '', 'class="check_delete"', true); + $data[1] = ''.$row['id_np'].''; + $data[2] = ''.$row['name'].''; + $data[3] = ''.ui_print_truncate_text(io_safe_output($row['description']), 'description', true, true, true, '[…]').''; + $table->cellclass[][3] = 'action_buttons'; + $data[4] = html_print_input_image( + 'edit_pen_'.$row['id_np'].'_', + 'images/edit.png', + $row['id_np'], + 'max-width: 27px;', + true, + [ + 'title' => 'Edit', + 'onclick' => 'javascript:modifyPENLine(event)', + ] + ); + $data[4] .= html_print_input_image( + 'delete_pen_'.$row['id_np'].'_', + 'images/cross.png', + $row['id_np'], + '', + true, + [ + 'title' => 'Delete PEN', + 'onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;', + ] + ); + + array_push($table->data, $data); + } + + html_print_table($table); + + } + + +}