本文整理汇总了PHP中Entry::getTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP Entry::getTotal方法的具体用法?PHP Entry::getTotal怎么用?PHP Entry::getTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry::getTotal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportToCsv
public static function exportToCsv()
{
global $wpdb;
$tables = array(CruiseEntry::TABLE_NAME => 'cruise', FestivalEntry::TABLE_NAME => 'festival', MurderMysteryEntry::TABLE_NAME => 'murder-mystery', ParadeEntry::TABLE_NAME => 'parade', Donation::TABLE_NAME => 'donation', FlagHandle::TABLE_NAME => 'flag-handle', Sponsorship::TABLE_NAME => 'sponsorship');
$year = isset($_POST['pride_export']) && is_numeric($_POST['pride_export']) ? abs(round($_POST['pride_export'])) : NULL;
$table = isset($_POST['table']) && array_key_exists($_POST['table'], $tables) ? $_POST['table'] : NULL;
header('Content-type: text/csv');
if ($table === NULL) {
header('Content-disposition: attachment;filename=export.csv');
echo 'No Data to Export';
} else {
header('Content-disposition: attachment;filename=' . ($year !== NULL ? $year : 'all') . '-' . $tables[$table] . '-entries.csv');
echo "Entry Date,Entry Year,Organization,First Name,Last Name,Email,Phone,Address,City,State,Zip,";
switch ($table) {
case FestivalEntry::TABLE_NAME:
echo "Entry Type,Corner Booth,";
break;
case MurderMysteryEntry::TABLE_NAME:
echo "Upgraded Meal,Vegetarian Count,Entry Type,";
break;
case ParadeEntry::TABLE_NAME:
echo "Entry Types,Description,Parking Spots,Amped Sound,Group Size,Donation,";
break;
case Donation::TABLE_NAME:
echo "Donation,";
break;
case FlagHandle::TABLE_NAME:
echo "Message,Color,";
break;
}
echo "Qty,Amount Due,Amount Paid,Payment Method,Paid On,Notes";
$rows = $wpdb->get_results("\n\t\t\t\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t" . $wpdb->prefix . $table . "\n\t\t\t\tWHERE\n\t\t\t\t\tentry_year " . ($year === NULL ? " > 0 " : " = " . $year) . "\n\t\t\t\tORDER BY\n\t\t\t\t\tid ASC");
if ($rows) {
foreach ($rows as $row) {
switch ($table) {
case CruiseEntry::TABLE_NAME:
$entry = new CruiseEntry();
break;
case FestivalEntry::TABLE_NAME:
$entry = new FestivalEntry();
break;
case MurderMysteryEntry::TABLE_NAME:
$entry = new MurderMysteryEntry();
break;
case ParadeEntry::TABLE_NAME:
$entry = new ParadeEntry();
break;
case Donation::TABLE_NAME:
$entry = new Donation();
break;
case FlagHandle::TABLE_NAME:
$entry = new FlagHandle();
break;
case Sponsorship::TABLE_NAME:
$entry = new Sponsorship();
break;
default:
$entry = new Entry();
}
$entry->loadFromRow($row);
echo "\r\n";
echo $entry->getCreatedAt('n/j/Y') . ',';
echo $entry->getEntryYear() . ',';
echo '"' . str_replace('"', '""', $entry->getOrganization()) . '",';
echo '"' . str_replace('"', '""', $entry->getFirstName()) . '",';
echo '"' . str_replace('"', '""', $entry->getLastName()) . '",';
echo '"' . str_replace('"', '""', $entry->getEmail()) . '",';
echo '"' . str_replace('"', '""', $entry->getPhone()) . '",';
echo '"' . str_replace('"', '""', $entry->getAddress()) . '",';
echo '"' . str_replace('"', '""', $entry->getCity()) . '",';
echo '"' . str_replace('"', '""', $entry->getState()) . '",';
echo '"' . str_replace('"', '""', $entry->getZip()) . '",';
switch ($table) {
case FestivalEntry::TABLE_NAME:
echo '"' . str_replace('"', '""', $entry->getEntryType()) . '",';
echo ($entry->isCornerBooth() ? 'Y' : 'N') . ',';
break;
case MurderMysteryEntry::TABLE_NAME:
echo ($entry->isUpgraded() ? 'Y' : 'N') . ',';
echo $entry->getVegetarianQty() . ',';
echo ($entry->isSponsor() ? 'Table' : 'Ticket') . ',';
break;
case ParadeEntry::TABLE_NAME:
echo '"' . str_replace('"', '""', implode(',', $entry->getEntryTypes())) . '",';
echo '"' . str_replace("\n", ' ', str_replace("\r", ' ', str_replace('"', '""', $entry->getDescription()))) . '",';
echo $entry->getFloatParkingSpaces() . ',';
echo ($entry->needsAmpedSound() ? 'Y' : 'N') . ',';
echo $entry->getGroupSize() . ',';
echo $entry->getDonationAmount() . ',';
break;
case Donation::TABLE_NAME:
echo $entry->getDonationAmount() . ',';
break;
case FlagHandle::TABLE_NAME:
echo '"' . str_replace("\n", ' ', str_replace("\r", ' ', str_replace('"', '""', $entry->getMessage()))) . '",';
echo '"' . str_replace("\n", ' ', str_replace("\r", ' ', str_replace('"', '""', $entry->getColor()))) . '",';
break;
}
echo $entry->getQty() . ',';
echo $entry->getTotal() . ',';
//.........这里部分代码省略.........
示例2: getTotal
/**
* @return float
*/
public function getTotal()
{
return parent::getTotal() + ($this->is_corner_booth ? $this->getPriceForCornerBooth() : 0);
}