$config['ehorus_custom_field'], 'display_on_front' => 1, ]; $result = (bool) db_process_sql_insert('tagent_custom_fields', $values); $custom_field_exists = $custom_field_created = $result; } // Enable table. $table_enable = new StdClass(); $table_enable->data = []; $table_enable->width = '100%'; $table_enable->id = 'ehorus-enable-setup'; $table_enable->class = 'databox filters'; $table_enable->size['name'] = '30%'; $table_enable->style['name'] = 'font-weight: bold'; // Enable eHorus. $row = []; $row['name'] = __('Enable eHorus'); $row['control'] = html_print_checkbox_switch('ehorus_enabled', 1, $config['ehorus_enabled'], true); $table_enable->data['ehorus_enabled'] = $row; // Remote config table. $table_remote = new StdClass(); $table_remote->data = []; $table_remote->width = '100%'; $table_remote->styleTable = 'margin-bottom: 10px;'; $table_remote->id = 'ehorus-remote-setup'; $table_remote->class = 'databox filters filter-table-adv'; $table_remote->size['ehorus_hostname'] = '50%'; $table_remote->size['ehorus_port'] = '50%'; // Enable eHorus user configuration. $row = []; $row['ehorus_user_level_conf'] = html_print_label_input_block( __('eHorus configuration at user level'), html_print_checkbox_switch( 'ehorus_user_level_conf', 1, $config['ehorus_user_level_conf'], true ) ); $table_remote->data['ehorus_user_level_conf'] = $row; // User. $row = []; $row['ehorus_user'] = html_print_label_input_block( __('User'), html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true), ['div_class' => 'ehorus-remote-setup-ehorus_user'] ); // Pass. $row['ehorus_pass'] = html_print_label_input_block( __('Password'), html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true), ['div_class' => 'ehorus-remote-setup-ehorus_user'] ); $table_remote->data['ehorus_pass'] = $row; // Directory hostname. $row = []; $row['ehorus_hostname'] = html_print_label_input_block( __('API Hostname'), html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true) ); // Directory port. $row['ehorus_port'] = html_print_label_input_block( __('API Port'), html_print_input_text('ehorus_port', $config['ehorus_port'], '', 6, 100, true) ); $table_remote->data['ehorus_port'] = $row; // Request timeout. $row = []; $row['ehorus_req_timeout'] = html_print_label_input_block( __('Request timeout'), html_print_input_text('ehorus_req_timeout', $config['ehorus_req_timeout'], '', 3, 10, true) ); $table_remote->data['ehorus_req_timeout'] = $row; // Test. $row = []; $test_start = ''; $test_start .= ''; $test_start .= ''; $test_start .= ' '; $row['ehorus_test'] = html_print_label_input_block( __('Test'), html_print_button( __('Start'), 'test-ehorus', false, '', [ 'icon' => 'cog', 'mode' => 'secondary mini', 'style' => 'width: 115px;', ], true ).$test_start ); $table_remote->data['ehorus_test'] = $row; // Print. echo '
'; echo ''; if ($config['style'] === 'pandora_black' && is_metaconsole() === true) { html_print_image( 'include/ehorus/images/ehorus-logo.png', false, ['class' => 'w400px mrgn_top_15px'] ); } else { html_print_image( 'include/ehorus/images/ehorus-logo-grey.png', false, ['class' => 'w400px mrgn_top_15px'] ); } echo ''; echo '
'; echo '
'; echo __('Remote Management System'); echo '
'; echo ''; echo 'https://ehorus.com'; echo ''; echo '
'; if ($custom_field_created !== null) { ui_print_result_message($custom_field_created, __('Custom field eHorusID created'), __('Error creating custom field')); } if ($custom_field_created) { $info_messsage = __('eHorus has his own agent identifiers'); $info_messsage .= '. '.__('To store them, it will be necessary to use an agent custom field'); $info_messsage .= '.
'.__('Possibly the eHorus id will have to be filled in by hand for every agent').'.'; ui_print_info_message($info_messsage); } if ($config['ehorus_enabled'] && !$custom_field_exists) { $error_message = __('The custom field does not exists already'); ui_print_error_message($error_message); } echo "
"; // Form enable. echo '
'; html_print_input_hidden('update_config', 1); html_print_table($table_enable); echo '
'; // Form remote. echo '
'; echo '
'; echo ''.__('eHorus API').''; html_print_input_hidden('update_config', 1); html_print_table($table_remote); echo '
'; echo '
'; html_print_action_buttons( html_print_submit_button( __('Update'), 'update_button', false, ['icon' => 'update'], true ) ); echo '
'; ?>