<?php

defined('BASEPATH') or exit('No direct script access allowed');

$aColumns = [
    db_prefix() . 'hpysubscriptions.name as name',
    db_prefix() . 'hpysubscriptions.users as users',
    db_prefix() . 'hpysubscriptions.price as price',
];

$sIndexColumn = 'id';
$sTable       = db_prefix() . 'hpysubscriptions';

$filter = [];
$where  = [];


$join = [
];

$result = data_tables_init($aColumns, $sIndexColumn, $sTable, $join, $where, [
    db_prefix() . 'hpysubscriptions.id',
]);

$output  = $result['output'];
$rResult = $result['rResult'];

foreach ($rResult as $aRow) {
    $row = [];


    $row[] = '<a href="' . admin_url('hpysubscriptions/subscription/' . $aRow['id']) . '" class="mbot10 display-block">' . $aRow['name'] . '</a>';
    $row[] = '<a href="' . admin_url('hpysubscriptions/subscription/' . $aRow['id']) . '" class="mbot10 display-block">' . $aRow['users'] . '</a>';
    $row[] = '<a href="' . admin_url('hpysubscriptions/subscription/' . $aRow['id']) . '" class="mbot10 display-block">' . $aRow['price'] . '</a>';
    $options = icon_btn('hpysubscriptions/subscription/' . $aRow['id'], 'pencil-square-o');
    $row[]   = $options .= icon_btn('hpysubscriptions/sterge/' . $aRow['id'], 'times', 'btn-danger _delete');


    $row['DT_RowClass'] = 'has-row-options';
    $output['aaData'][] = $row;
}
