当前位置: 首页>>代码示例>>PHP>>正文


PHP Crud::setSearchFields方法代码示例

本文整理汇总了PHP中Crud::setSearchFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Crud::setSearchFields方法的具体用法?PHP Crud::setSearchFields怎么用?PHP Crud::setSearchFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Crud的用法示例。


在下文中一共展示了Crud::setSearchFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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", '&nbsp;', '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();
开发者ID:makeadiff,项目名称:exdon,代码行数:31,代码来源:donations.php


注:本文中的Crud::setSearchFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。