// The event could have multiple schedules.
$eventDates = '';
$dates = new SetaPDF_Core_Text_Block( $boldFont, self::PDF_FONT_SIZE );
+ $recCounter = 0;
foreach ( $event['recurrences'] as $rec ) {
if ( !in_array( $rec['name'], array( 'Imported', 'Imported Event Schedule') ) ) {
$eventDates .= $rec['name'] . ' ';
$eventDates .= " {$startTime} - {$endTime}";
}
}
+ if ( count($rec['day_of_week']['names']) < 7 && count($rec['day_of_week']['names']) > 0 ) {
+ $eventDates .= " ( ";
+ foreach ( $rec['day_of_week']['names'] as $day ) {
+ $eventDates .= substr( $day, 0, 3 ) . ' ';
+ }
+ $eventDates .= ")";
+ }
+ ++$recCounter;
+ if ( $recCounter != count( $event['recurrences'] ) ) {
+ $eventDates .= "\n";
+ }
}
- //$eventDates .= $event['dates'];
- //if ( isset( $event['recurDays'] ) && ( $event['recurDays'] ) ) {
- //$eventDates .= ' ' . $event['recurDays'];
- //}
- //if ( !$event['all_day'] ) {
- //$startTime = strftime( "%l:%M %P", strtotime( $event['starting_date'] ) );
- //$endTime = strftime( "%l:%M %P", strtotime( $event['ending_date'] ) );
- //if ( $startTime != $endTime ) {
- //$eventDates .= " {$startTime} - {$endTime}";
- //} else {
- //$eventDates .= " {$startTime}";
- //}
- //}
$dates->setText($eventDates);
$dates->setWidth(self::DATE_WIDTH);
- $lineCount = $dates->getLineCount();
- if ( $dates->getLineCount() > 1 ) {
- $pdfY -= $dates->getLineHeight();
+ $lineCount = $dates->getLineCount() - 1;
+ $dateHeight = 0;
+ if ( $lineCount ) {
+ $lineCount = $dates->getLineCount() - 1;
+ $dateHeight = self::LINE_HEIGHT * $lineCount;
+ $pdfY -= $dateHeight;
}
$dates->draw($page->getCanvas(), self::PDF_LFT_COL_X, $pdfY);
- if ( $dates->getLineCount() > 1 ) {
- $pdfY += $dates->getLineHeight();
+ if ( $lineCount ) {
+ $pdfY += $dateHeight;
}
// title
}
$pdfY -= self::LINE_HEIGHT;
+ if ( $lineCount ) {
+ $pdfY -= $dateHeight;
+ }
if ( isset($event['locations']) && !empty($event['locations']) && $event['hide_address']['name'] == 'No' ) {
$address = array();