本文整理汇总了PHP中Crud::setListingFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Crud::setListingFields方法的具体用法?PHP Crud::setListingFields怎么用?PHP Crud::setListingFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crud
的用法示例。
在下文中一共展示了Crud::setListingFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Crud
<?php
require '../common.php';
$user = new Crud("User");
$user->setListingFields('name', 'email', 'phone', 'status');
$user->addListDataField('parent_user_id', 'User', 'POC', '');
$user->fields['parent_user_id']['data']['0'] = 'None';
$user->render();
示例2: array
$crud->allow['add'] = false;
// $crud->allow['edit'] = false;
$crud->allow['sorting'] = false;
$all_donation_types = array('ecs' => 'ECS', 'globalgiving' => 'Global Giving', 'online' => 'Online', 'other' => "Other", 'any' => 'Any');
$all_donation_status = array('TO_BE_APPROVED_BY_POC' => 'Not Deposited', 'DEPOSIT COMPLETE' => 'Deposited', 'any' => 'Any');
$all_cities = $sql->getById("SELECT id,name FROM cities ORDER BY name");
$all_cities[0] = 'Any';
// Filtering code - goes on the top.
$html = new HTML();
$html->options['output'] = 'return';
$crud->code['before_content'] = '<form action="donations.php" method="post" class="form-area">' . $html->buildInput("city_id", 'City', 'select', $city_id, array('options' => $all_cities)) . '<div id="select-date-area">' . $html->buildInput("donation_type", 'Type', 'select', $donation_type, array('options' => $all_donation_types)) . $html->buildInput("donation_status", 'Status', 'select', $donation_status, array('options' => $all_donation_status)) . $html->buildInput('from', 'From', 'text', $from, array('class' => 'date-picker')) . $html->buildInput('to', 'To', 'text', $to, array('class' => 'date-picker')) . '</div><a href="#" id="select-date-toggle">More Options</a><br />' . $html->buildInput("action", ' ', 'submit', 'Filter', array('class' => 'btn btn-primary')) . '</form><br /><br />';
$html->options['output'] = 'print';
// The SQL for the listing
$crud->setListingQuery("SELECT D.* FROM external_donations D \n\tINNER JOIN users U ON U.id=D.fundraiser_id\n\tWHERE " . implode(" AND ", $checks) . " ORDER BY D.created_at DESC");
// Fields customization.
$crud->addField("donation_type", 'Type', 'enum', array(), $all_donation_types, 'select');
$all_donation_status_without_any = $all_donation_status;
unset($all_donation_status_without_any['any']);
$crud->addField("donation_status", 'Donation Status', 'enum', array(), $all_donation_status_without_any, 'select');
$crud->addListDataField("donor_id", "donours", "Donor", "", array('fields' => 'id,first_name'));
$crud->fields['donor_id']['extra_info']['readonly'] = true;
$crud->addListDataField("fundraiser_id", "users", "Fundraiser", "", array('fields' => 'id,CONCAT(first_name, " ", last_name) AS name'));
$crud->fields['fundraiser_id']['extra_info']['readonly'] = true;
$crud->addListingField('Status', array('html' => '($row["donation_status"] == "DEPOSIT COMPLETE")' . ' ? "<span class=\\"with-icon success\\">Deposited - <a href=\'?status_action=disapprove&select_row[]=$row[id]\'>Undo Approval?</a></span>"' . ' : "<span class=\\"with-icon error\\">Not Deposited Yet - <a href=\'?status_action=approve&select_row[]=$row[id]\'>Approve?</a></span>"'));
// Show only the listing
$crud->setListingFields("donation_type", "amount", "donor_id", "fundraiser_id", "created_at", 'status');
$crud->setSearchFields('amount', 'donor_id', 'fundraiser_id');
// The other includes
$template->addResource(joinPath($config['site_url'], 'bower_components/jquery-ui/ui/minified/jquery-ui.min.js'), 'js', true);
$template->addResource(joinPath($config['site_url'], 'bower_components/jquery-ui/themes/base/minified/jquery-ui.min.css'), 'css', true);
render();