Exemplo n.º 1
0
$page_title = "External Donations Approval";
$crud->title = "External Donation";
$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);
Exemplo n.º 2
0
<?php

require './common.php';
$crud = new Crud("Event");
$crud->setListingQuery("SELECT * FROM Event ORDER BY todo_on DESC");
$crud->render();