/**
  * @param \stdClass $row
  */
 public function loadFromRow(\stdClass $row)
 {
     parent::loadFromRow($row);
     $this->setAmount($row->amount)->setUrl($row->url)->setPosition($row->position)->setLocalPosition($row->local_position)->setLevel($row->level)->setLocalFirstName($row->local_first_name)->setLocalLastName($row->local_last_name)->setLocalAddress($row->local_address)->setLocalCity($row->local_city)->setLocalState($row->local_state)->setLocalZip($row->local_zip)->setLocalPhone($row->local_phone)->setLocalEmail($row->local_email);
 }
 /**
  * @param \stdClass $row
  */
 public function loadFromRow(\stdClass $row)
 {
     parent::loadFromRow($row);
     $this->setDonationAmount($row->donation_amount);
 }
 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() . ',';
                 echo $entry->getPaymentAmount() . ',';
                 echo '"' . str_replace('"', '""', $entry->getPaymentMethod($entry->getPaymentMethodId())) . '",';
                 echo $entry->getPaidAt('n/j/Y') . ',';
                 echo '"' . str_replace("\n", ' ', str_replace("\r", ' ', str_replace('"', '""', $entry->getNotes()))) . '",';
             }
         }
     }
     exit;
 }
 /**
  * @param \stdClass $row
  */
 public function loadFromRow(\stdClass $row)
 {
     parent::loadFromRow($row);
     $this->setMessage($row->message)->setColor($row->color);
 }
 /**
  * @param \stdClass $row
  */
 public function loadFromRow(\stdClass $row)
 {
     parent::loadFromRow($row);
     $this->setIsSponsor($row->is_sponsor)->setIsUpgraded($row->is_upgraded)->setVegetarianQty($row->vegetarian_qty)->setTicketsSent($row->tickets_sent);
 }
 /**
  * @param \stdClass $row
  */
 public function loadFromRow(\stdClass $row)
 {
     parent::loadFromRow($row);
     $this->setTicketsSent($row->tickets_sent);
 }
 /**
  * @param \stdClass $row
  */
 public function loadFromRow(\stdClass $row)
 {
     parent::loadFromRow($row);
     $this->setEntryTypes($row->entry_types)->setNeedsAmpedSound($row->needs_amped_sound)->setGroupSize($row->group_size)->setFloatParkingSpaces($row->float_parking_spaces)->setFloatParkingSpaceCost($row->float_parking_space_cost)->setDonationAmount($row->donation_amount)->setDescription($row->description);
 }
 /**
  * @param \stdClass $row
  */
 public function loadFromRow(\stdClass $row)
 {
     parent::loadFromRow($row);
     $this->setEntryTypeId($row->entry_type_id)->setIsCornerBooth($row->is_corner_booth)->setPriceForCornerBooth($row->price_for_corner_booth)->setDescription($row->description);
 }