$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'; $table_remote->size['name'] = '30%'; $table_remote->style['name'] = 'font-weight: bold'; // Enable eHorus user configuration. $row = []; $row['name'] = ('eHorus configuration at user level'); $row['control'] = 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['name'] = __('User'); $row['control'] = html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true); $table_remote->data['ehorus_user'] = $row; // Pass. $row = []; $row['name'] = __('Password'); $row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true); $row['control'] .= ui_print_reveal_password('ehorus_pass', true); $table_remote->data['ehorus_pass'] = $row; // Directory hostname. $row = []; $row['name'] = __('API Hostname'); $row['control'] = html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true); $table_remote->data['ehorus_hostname'] = $row; // Directory port. $row = []; $row['name'] = __('API Port'); $row['control'] = html_print_input_text('ehorus_port', $config['ehorus_port'], '', 6, 100, true); $table_remote->data['ehorus_port'] = $row; // Request timeout. $row = []; $row['name'] = __('Request timeout'); $row['control'] = html_print_input_text('ehorus_req_timeout', $config['ehorus_req_timeout'], '', 3, 10, true); $table_remote->data['ehorus_req_timeout'] = $row; // Test. $row = []; $row['name'] = __('Test'); $row['control'] = html_print_button(__('Start'), 'test-ehorus', false, '', 'class="sub next"', true); $row['control'] .= ''; $row['control'] .= ''; $row['control'] .= ''; $row['control'] .= ' '; $table_remote->data['ehorus_test'] = $row; // Print. echo '
'; echo ''; if ($config['style'] === 'pandora_black' && !is_metaconsole()) { html_print_image( 'include/ehorus/images/ehorus-logo.png', false, ['class' => 'w400px'] ); } else { html_print_image( 'include/ehorus/images/ehorus-logo-grey.png', false, ['class' => 'w400px'] ); } 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 '
'; echo '
'; html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'); echo '
'; echo '
'; ?>