本文整理汇总了PHP中js::datatable方法的典型用法代码示例。如果您正苦于以下问题:PHP js::datatable方法的具体用法?PHP js::datatable怎么用?PHP js::datatable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类js
的用法示例。
在下文中一共展示了js::datatable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listClients
public function listClients()
{
// At a glance - Let's view the client's basic info, If you can see billing, then show subscription
// and show total amount collected. Put in a datatable so we can search.
$headers = ["Client", "Address", "VIP", "Tickets"];
if ($this->canSeeBilling()) {
$billing = ['Subscription', 'Total Income'];
$headers = array_merge($headers, $billing);
}
$rows = [];
$companies = $this->query("SELECT * from companies ORDER by company_since DESC");
foreach ($companies as $company) {
$tcontent = null;
$ticks = $this->query("SELECT id,ticket_title FROM tickets WHERE company_id='{$company['id']}' ORDER by ticket_opents DESC LIMIT 10");
foreach ($ticks as $tick) {
$tcontent .= "<a href='/ticket/{$tick['id']}/'>{$tick['ticket_title']}</a><br/>";
}
$ticketblock = base::popover("Ticket History", $tcontent, 'right');
$row = ["<a href='/client/{$company['id']}/'>{$company['company_name']}</a>", "{$company['company_address']}, {$company['company_city']}, {$company['company_state']}", $company['company_vip'] ? "Yes" : "No", "<a href='#' {$ticketblock}>" . $this->returnCountFromTable("tickets", "company_id='{$company['id']}'") . "</a>"];
if ($this->canSeeBilling()) {
$plan = $this->query("SELECT * from plans WHERE id='{$company['company_plan']}'", true)[0];
if (!$plan) {
$plandata = "No Subscription";
} else {
$plandata = "{$plan['plan_name']} ({$plan['plan_amount']})";
}
$ttl = 0;
$transactions = $this->query("SELECT transaction_amount FROM transactions WHERE company_id='{$company['id']}'");
foreach ($transactions as $transaction) {
$ttl += $transaction['transaction_amount'];
}
$ttl = "\$" . number_format($ttl, 2);
$new = [$plandata, $ttl];
$row = array_merge($row, $new);
}
$rows[] = $row;
}
$this->exportJS(js::datatable('clientList'));
$addButton = button::init()->text("Add Account")->icon('plus')->addStyle('btn-success')->url('/clients/create/')->render();
$table = table::init()->headers($headers)->rows($rows)->id('clientList')->render();
$widget = widget::init()->header("Customer List")->content($table)->isTable()->icon('user')->rightHeader($addButton)->render();
$this->export(base::row($widget));
}
示例2: showTransactionLog
public function showTransactionLog()
{
$data = base::span(4, $this->adminNav('billing'));
$headers = ['Merchant ID', 'Date', 'Amount', 'Fee', 'Net', 'Merchant', 'Description', 'Ticket', 'Company'];
$transactions = $this->query("SELECT * from transactions ORDER by transaction_ts DESC");
$rows = [];
foreach ($transactions as $transaction) {
$rows[] = [$transaction['transaction_merchant_id'], date("m/d/y h:ia", $transaction['transaction_ts']), number_format($transaction['transaction_amount'], 2), number_format($transaction['transaction_fee'], 2), number_format($transaction['transaction_net'], 2), $transaction['transaction_source'], $transaction['transaction_desc'], "<a href='/ticket/{$transaction['ticket_id']}/'>{$transaction['ticket_id']}</a>", $this->getCompanyById($transaction['company_id'])];
}
$table = table::init()->id('tlog')->headers($headers)->rows($rows)->render();
$data .= widget::init()->span(6)->header('Transaction Log')->content($table)->icon('credit-card')->istable(true)->render();
$this->exportjs(js::datatable('tlog', 50));
$headers = ['Payout Schedule', 'Amount'];
$rows = [];
$now = time();
$transfers = $this->query("SELECT * from transfers WHERE transfer_ts > {$now} ORDER by transfer_ts DESC");
foreach ($transfers as $transfer) {
$rows[] = [$this->fbTime($transfer['transfer_ts']), number_format($transfer['transfer_amt'] / 100, 2)];
}
$table = table::init()->headers($headers)->rows($rows)->render();
$data .= widget::init()->span(2)->header('Payout Schedule')->icon('truck')->content($table)->istable(true)->render();
$this->export(base::row($data, true));
}