Files

39 lines
1.5 KiB
PHP
Raw Permalink Normal View History

<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
global $MIRAVIAWOO;
if(isset($_GET['action']) and $_GET['action'] == 'delete') {
if(current_user_can( 'manage_options' )){
MiraviaCore::delete_profile(sanitize_text_field( $_GET['id'] ));
wp_safe_redirect(admin_url("admin.php?page=miravia_settings&subpage=profiles"));
}
}
$miraviaTable = new MiraviaTable([
'sccren' => 'miravia_profiles'
]);
$miraviaTable->custom_actions = array(
'edit' => sprintf('<a href="?page=%s&subpage=%s&action=%s&id=[id]">Editar</a>', sanitize_text_field($_REQUEST['page']), 'edit_profile', 'edit', ),
'delete' => sprintf('<a href="?page=%s&subpage=%s&action=%s&id=[id]">Eliminar</a>', sanitize_text_field($_REQUEST['page']), sanitize_text_field($_REQUEST['subpage']), 'delete'),
'upload' => '<a href="javascript:void(0)" data-profile="[id]" class="sendProductsMiravia">Upload products</a>'
);
$miraviaTable->columns = [
'id' => "ID",
'name' => "Name",
'created' => 'Created',
'updated' => 'Updated',
'sync' => 'Status Sync'
];
$profiles = MiraviaCore::get_profiles();
$miraviaTable->data_table = $profiles;
$miraviaTable->total_elements = count($profiles);
$miraviaTable->prepare_items();
?>
<div class="wrap">
<h1 class="wp-heading-inline">Mapping Profiles</h1>
<a href="<?php echo admin_url('admin.php?page=miravia_settings&subpage=create_profile')?>" class="page-title-action">Create Profile</a>
<hr class="wp-header-end">
<?php
$miraviaTable->display();
?>
</div>