Example #1
0
            echo $doc;
            exit;
        } else {
            $content .= 'Function not available';
        }
        break;
    case 'view':
    default:
        if (empty($eid)) {
            // Default action, view the calendar or event
            COM_setArgNames(array('eid', 'ts', 'range', 'cat'));
            $eid = COM_sanitizeID(COM_getArgument('eid'), false);
        }
        if (!empty($eid)) {
            USES_evlist_class_repeat();
            $Rep = new evRepeat($eid);
            $pagetitle = COM_stripslashes($Rep->Event->title);
            if ($view == 'print') {
                $template = 'print';
                $query = '';
            }
            $query = isset($_GET['query']) ? $_GET['query'] : '';
            $content .= $Rep->Render('', $query, $template);
        } else {
            // Shouldn't be in this file without an event ID to display or edit
            echo COM_refresh(EVLIST_URL . '/index.php');
            exit;
        }
        break;
}
$display = EVLIST_siteHeader($pagetitle);
Example #2
0
            echo $doc;
            exit;
        } else {
            $content .= 'Function not available';
        }
        break;
    case 'view':
    default:
        if (empty($eid)) {
            // Default action, view the calendar or event
            COM_setArgNames(array('eid', 'ts', 'range', 'cat'));
            $eid = COM_sanitizeID(COM_getArgument('eid'), false);
        }
        if (!empty($eid)) {
            USES_evlist_class_repeat();
            $Rep = new evRepeat($eid);
            $pagetitle = COM_stripslashes($Rep->Event->title);
            if ($view == 'print') {
                $template = 'event_print';
                $query = '';
            }
            $query = isset($_GET['query']) ? $_GET['query'] : '';
            $content .= $Rep->Detail('', $query, $template);
        } else {
            // Shouldn't be in this file without an event ID to display or edit
            echo COM_refresh(EVLIST_URL . '/index.php');
            exit;
        }
        break;
}
$display = EVLIST_siteHeader($pagetitle);
Example #3
0
 /**
  *   Print tickets as PDF documents
  *   Tickets can be printed for an event, a single occurrence,
  *   or all tickets for a user ID.
  *
  *   @param  string  $ev_id  Event ID
  *   @param  integer $rp_id  Repeat ID
  *   @param  integer $uid    User ID
  *   @return string          PDF Document containing tickets
  */
 public static function PrintTickets($ev_id = '', $rp_id = 0, $uid = 0)
 {
     global $_CONF;
     $checkin_url = $_CONF['site_admin_url'] . '/plugins/evlist/checkin.php?tic=';
     // get the tickets, paid and unpaid. Need event id and uid.
     $tickets = self::GetTickets($ev_id, $rp_id, $uid);
     // The PDF functions in lgLib are a recent addition. Make sure that
     // the lgLib version supports PDF creation since we can't yet check
     // the lglib version during installation
     if (empty($tickets) || !function_exists('USES_lglib_class_fpdf')) {
         return "There are no tickets available to print";
     }
     USES_lglib_class_fpdf();
     USES_evlist_class_repeat();
     USES_evlist_class_tickettype();
     $ev_id = NULL;
     // create params array for qrcode, if used
     $params = array('module_size' => 5);
     $pdf = new FPDF();
     $pdf->SetLeftMargin(20);
     $pdf->AddPage();
     $tic_types = array();
     foreach ($tickets as $tic_id => $ticket) {
         if (!isset($tick_types[$ticket->tic_type])) {
             $tick_types[$ticket->tic_type] = new evTicketType($ticket->tic_type);
         }
         // If we don't already have the event info, get it and construct
         // the address string
         if ($ev_id != $ticket->ev_id) {
             $Ev = new evEvent($ticket->ev_id);
             $ev_id = $Ev->id;
             $addr = array();
             if ($Ev->Detail->street != '') {
                 $addr[] = $Ev->Detail->street;
             }
             if ($Ev->Detail->city != '') {
                 $addr[] = $Ev->Detail->city;
             }
             if ($Ev->Detail->province != '') {
                 $addr[] = $Ev->Detail->province;
             }
             if ($Ev->Detail->country != '') {
                 $addr[] = $Ev->Detail->country;
             }
             if ($Ev->Detail->postal != '') {
                 $addr[] = $Ev->Detail->postal;
             }
             $address = implode(' ', $addr);
         }
         // Get the repeat(s) for the ticket(s) to print a ticket for each
         // occurrence.
         $repeats = evRepeat::GetRepeats($ticket->ev_id, $ticket->rp_id);
         foreach ($repeats as $rp_id => $event) {
             $ev_date = $event->date_start;
             $ev_time = $event->time_start1 . ' - ' . $event->time_end1;
             if (!empty($event->time_start2)) {
                 $ev_time .= '; ' . $event->time_start1 . ' - ' . $event->time_end2;
             }
             $fee = self::formatAmount($ticket->fee);
             // Get the veritcal position of the current ticket
             // for positioning the qrcode
             $y = $pdf->GetY();
             // Title
             $pdf->SetFont('Times', 'B', 12);
             $pdf->Cell(130, 10, "{$tick_types[$ticket->tic_type]->description}: {$Ev->Detail->title}", 1, 0, 'C');
             $pdf->Ln(13);
             $pdf->SetFont('Times', '', 12);
             $pdf->SetX(-40);
             $pdf->Cell(0, 30, 'Fee: ' . $fee);
             if ($ticket->fee > 0) {
                 $pdf->Ln(5);
                 if ($ticket->paid >= $ticket->fee) {
                     $pdf->SetX(-40);
                     $pdf->Cell(0, 30, 'Paid');
                 } else {
                     $pdf->SetX(-55);
                     $due = $ticket->fee - $ticket->paid;
                     $pdf->Cell(0, 30, 'Balance Due: ' . self::formatAmount($due));
                 }
             }
             $pdf->SetX(20);
             $pdf->Cell(0, 8, "Date:", 0, 0);
             $pdf->setX(40);
             $pdf->Cell(0, 8, $ev_date, 0, 1);
             $pdf->Cell(0, 6, "Time:", 0, 0);
             $pdf->SetX(40);
             $pdf->Cell(0, 6, $ev_time, 0, 1);
             if ($Ev->Detail->location != '') {
                 $pdf->Ln(5);
                 $pdf->Cell(0, 2, 'Where: ', 0, 0);
                 $pdf->SetX(40);
                 $pdf->Cell(0, 2, $Ev->Detail->location, 0, 1);
             }
             if (!empty($address)) {
                 if ($Ev->Detail->location == '') {
                     $pdf->Ln(5);
                     $pdf->Cell(0, 2, 'Where: ', 0, 0);
                 }
                 $pdf->Ln(4);
                 $pdf->SetX(40);
                 $pdf->Cell(0, 2, $address, 0, 1);
             }
             // Footer
             $pdf->Ln(6);
             $pdf->setFont('Times', 'I', 10);
             $pdf->Cell(0, 10, $_CONF['site_name'], 0, 0);
             $pdf->Ln(6);
             $pdf->Cell(0, 10, $ticket->tic_id);
             // print qrcode if possible
             $params['data'] = $checkin_url . $tic_id . '&rp=' . $rp_id;
             $qrc_status = LGLIB_invokeService('qrcode', 'getcode', $params, $qrcode, $svc_msg);
             if ($qrc_status == PLG_RET_OK) {
                 $pdf->SetX(-40);
                 $pdf->Image($qrcode['path'], null, $y, 25);
             }
             $pdf->Ln();
             $y = $pdf->GetY();
             $pdf->Line(10, $y, 200, $y);
             $pdf->Ln();
         }
     }
     $pdf->Output();
 }