const PDF_LOGO_X = 20;
const PDF_LOGO_Y = 760;
const PDF_LFT_COL_X = 20;
- const PDF_RGT_COL_X = 200;
+ const PDF_RGT_COL_X = 160;
private $pages = array();
/**
)
)
);
+ } else if ( in_array($action, array( 'event-list-name', 'nameSearch' )) ) {
+ $toDate = null;
} else {
if ( isset($_REQUEST['t']) && $t = filter_var( $_REQUEST['t'], FILTER_SANITIZE_STRING ) ) {
switch ( $t ) {
$toDate = date('m/d/Y', strtotime( '+ 2 weeks' ));
}
}
- if ( $fromDate && $toDate ) {
+ if ( $fromDate && $toDate && !$_REQUEST['event_name']) {
$from = date('Y-m-d', strtotime($fromDate));
$to = date('Y-m-d', strtotime($toDate));
$this->dateRange = "start_time BETWEEN CAST('{$from}' AS DATE) AND CAST('{$to}' as DATE)";
FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
WHERE DATE(start_time) BETWEEN '{$from}' AND '{$to}'
)";
+ } else if ( $fromDate ) {
+ $from = date('Y-m-d', strtotime($fromDate));
+ $this->dateRange = "id IN (
+ SELECT id
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
+ WHERE DATE(start_time) >= '{$from}')";
}
//echo '<pre>$this->dateRange: ' . print_r($this->dateRange, true) . '</pre>';
SELECT event
FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times AS ET
WHERE active
- AND " . $this->dateRange . ") ";
+ AND " . $this->dateRange . "
+ ) ";
$results = $this->wpdb->get_results( $sql, ARRAY_A );
if ( !empty( $results ) ) {
foreach ( $results as $result ) {
$index = 0;
foreach ( $events as $eventId => $event ) {
+ $lineCount = 1;
$eventTopY = $pdfY;
// dates
$dates = new SetaPDF_Core_Text_Block( $boldFont, self::PDF_FONT_SIZE );
$lineCount = $dates->getLineCount();
$dates->draw($page->getCanvas(), self::PDF_LFT_COL_X, $pdfY);
- $pdfY -= self::LINE_HEIGHT * $lineCount;
-
// title
$title = new SetaPDF_Core_Text_Block( $boldFont, self::PDF_FONT_SIZE );
$title->setText($event['name']);
+ $title->setAlign('center');
+ $title->setWidth(self::PDF_WIDTH);
$lineCount = $title->getLineCount();
$title->draw($page->getCanvas(), self::PDF_LFT_COL_X, $pdfY);
- $pdfY -= self::LINE_HEIGHT * $lineCount;
+ $pdfY -= self::LINE_HEIGHT;
- /*
- if ( isset($event['categories']) && !empty($event['categories']) ) {
- $categoryNames = array();
- $category = new SetaPDF_Core_Text_Block( $boldFont, self::PDF_FONT_SIZE );
- $category->setText('Categories:');
- $category->draw($page->getCanvas(), self::PDF_RGT_COL_X, $eventTopY );
- foreach ( $event['categories'] as $category ) {
- $categoryNames[] = $category['name'];
- }
- // output the categories
- $category = new SetaPDF_Core_Text_Block( $font, self::PDF_FONT_SIZE );
- $category->setText( implode( ',', $categoryNames ) );
- $category->draw($page->getCanvas(), self::PDF_RGT_COL_X + 50, $eventTopY );
- }
- */
-
- if ( isset($event['locations']) && !empty($event['locations']) ) {
+ if ( isset($event['locations']) && !empty($event['locations']) && $event['hide_address']['name'] == 'No' ) {
$address = array();
$address[] = $event['locations']['name'];
$address[] = $event['locations']['address'];
$location->setText(implode(', ', $address));
$location->draw($page->getCanvas(), self::PDF_LFT_COL_X, $pdfY);
- $pdfY -= self::LINE_HEIGHT * $lineCount;
+ $pdfY -= self::LINE_HEIGHT;
}
// check for phone, url or email to output
$contact = new SetaPDF_Core_Text_Block( $font, self::PDF_FONT_SIZE );
$contact->setText( implode( ' - ', $contactInfo ) );
$contact->draw( $page->getCanvas(), self::PDF_LFT_COL_X, $pdfY );
- $pdfY -= self::LINE_HEIGHT * $lineCount;
+ $pdfY -= self::LINE_HEIGHT;
}
- if ( $event['cost'] && !$event['free'] ) {
+ if ( $event['cost'] && !$event['free']['value'] ) {
$cost = new SetaPDF_Core_Text_Block( $font, self::PDF_FONT_SIZE );
$cost->setText( $event['cost'] );
$cost->draw( $page->getCanvas(), self::PDF_LFT_COL_X, $pdfY );
$pdfY -= self::LINE_HEIGHT;
- } else if ( $event['free'] ) {
+ } else if ( $event['free']['value'] ) {
$cost = new SetaPDF_Core_Text_Block( $font, self::PDF_FONT_SIZE );
$cost->setText( 'FREE' );
$cost->draw( $page->getCanvas(), self::PDF_LFT_COL_X, $pdfY );
$pdfY -= self::LINE_HEIGHT;
}
- $pdfY -= self::LINE_HEIGHT * 2;
+ $pdfY -= self::LINE_HEIGHT;
if ( isset($event['intro']) && $event['intro'] ) {
$intro->setText($introText);
$intro->setWidth(self::PDF_WIDTH - 30);
$lineCount = $intro->getLineCount();
+ if ( $lineCount > 1 ) {
+ $pdfY -= self::LINE_HEIGHT;
+ }
$intro->draw($page->getCanvas(), self::PDF_LFT_COL_X, $pdfY);
+ //echo '<pre>lineCount: ' . print_r($lineCount, true) . '</pre>';
+ $pdfY -= self::LINE_HEIGHT;// * $lineCount;
- $pdfY -= self::LINE_HEIGHT * $lineCount;
$page->getCanvas()->draw()->line(self::PDF_LFT_COL_X, $pdfY, self::PDF_WIDTH, $pdfY);
- $pdfY -= self::LINE_HEIGHT;
- if ( $lineCount == 1 ) {
- $pdfY -= self::LINE_HEIGHT;
- }
+ $pdfY -= self::LINE_HEIGHT * 2;
}
// line at the bottom of the event
++$index;