$name, 'parent' => $parent)); ui_print_result_message ($result, __('Successfully created'), __('Could not be created')); } } if ($update) { $name = (string) get_parameter ('name'); $parent = (int) get_parameter ('parent'); if ($name == '') { ui_print_error_message (__('Not updated. Blank name')); } else { $result = db_process_sql_update ('tnetwork_component_group', array ('name' => $name, 'parent' => $parent), array ('id_sg' => $id)); ui_print_result_message ($result, __('Successfully updated'), __('Not updated. Error updating data')); } } if ($delete) { $result = db_process_sql_delete ('tnetwork_component_group', array ('id_sg' => $id)); if ($result !== false) $result = true; else $result = false; ui_print_result_message ($result, __('Successfully deleted'), __('Not deleted. Error deleting data')); } if ($multiple_delete) { $ids = (array)get_parameter('delete_multiple', array()); db_process_sql_begin(); foreach ($ids as $id) { $result = db_process_sql_delete ('tnetwork_component_group', array ('id_sg' => $id)); if ($result === false) { db_process_sql_rollback(); break; } } if ($result !== false) { db_process_sql_commit(); } if ($result !== false) $result = true; else $result = false; ui_print_result_message ($result, __('Successfully multiple deleted'), __('Not deleted. Error deleting multiple data')); } if (($id || $new) && !$delete && !$multiple_delete) { require_once ('manage_nc_groups_form.php'); return; } $url = ui_get_url_refresh (array ('offset' => false, 'create' => false, 'update' => false, 'delete' => false, 'new' => false, 'crt' => false, 'upd' => false, 'id' => false)); $filter = array (); $filter['offset'] = (int) get_parameter ('offset'); $filter['limit'] = (int) $config['block_size']; $groups = db_get_all_rows_filter ('tnetwork_component_group', $filter); if ($groups === false) $groups = array (); $table->width = '98%'; $table->head = array (); $table->head[0] = __('Name'); $table->head[1] = __('Parent'); $table->head[2] = __('Action') . html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();'); $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->align = array (); $table->align[2] = 'center'; $table->size = array (); $table->size[0] = '50%'; $table->size[1] = '40%'; $table->size[2] = '80px'; $table->data = array (); $total_groups = db_get_all_rows_filter ('tnetwork_component_group', false, 'COUNT(*) AS total'); $total_groups = $total_groups[0]['total']; ui_pagination ($total_groups, $url); foreach ($groups as $group) { $data = array (); $data[0] = ''.$group['name'].''; $data[1] = network_components_get_group_name ($group['parent']); $data[2] = "" . html_print_input_image ('del', 'images/cross.png', 1, '', true, array ('title' => __('Delete'))) . "" . html_print_checkbox_extended ('delete_multiple[]', $group['id_sg'], false, false, '', 'class="check_delete"', true); array_push ($table->data, $data); } if(isset($data)) { echo "
"; html_print_input_hidden('multiple_delete', 1); html_print_table ($table); echo "
"; html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); echo "
"; echo "
"; } else { echo "
".__('There are no defined component groups')."
"; } echo '
'; echo '
'; html_print_input_hidden ('new', 1); html_print_submit_button (__('Create'), 'crt', false, 'class="sub next"'); echo '
'; echo '
'; ?>