Changeset 1441


Ignore:
Timestamp:
Jan 29, 2014, 2:25:18 PM (4 years ago)
Author:
dkg
Message:

make attendee index more readable

  • limit the paging to 100 people per column (means some attendee indexes will be larger).
  • add header and footer to make it easier to keep track of the full list
Location:
trunk/jpdd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/jpdd/class.jpdd.event.php

    r1424 r1441  
    7171    }
    7272
     73    function participantCount() {
     74      global $jpdd;
     75      $z = $jpdd->getSingletonFromSQL('SELECT COUNT(DISTINCT person_id) AS participants FROM attendance JOIN workshop ON (workshop_id = workshop.id) WHERE event_id = '.$this->getID());
     76      return $z['participants'];
     77    }
     78
    7379        function handleCreation() {
    7480          // just insert a new row, grab the created ID, and re-initialize
  • trunk/jpdd/class.jpdd.pdf.php

    r1365 r1441  
    249249                                                                           'ORDER BY lower(last_name),lower(first_name),lower(middle_name)');
    250250          $peopspercol = ceil(count($peops)/($columns*$pagecount));
    251           $linehi = ($this->_page_height - 2*$this->_margin)/($peopspercol + 1); // adding 1 to account for the column header:
     251          $headerhi = 14;
     252          $linehi = ($this->_page_height - 2*$this->_margin - 2*$headerhi)/($peopspercol + 1); // adding 1 to account for the column header:
    252253
    253254          $fontsize = min($linehi*0.8,12);
     
    258259                $col = 0;
    259260                $this->addPage();
     261                $page += 1;
     262                $first = null;
     263                $last = null;
    260264                while ($col < $columns) {
    261265                  $row = 0;
    262266                  // column header
    263                   $this->SetXY($this->_margin + $col*($colwid + $gutter), $this->_margin);
    264                   $this->SetFont($this->_font, 'B');
     267                  $this->SetXY($this->_margin + $col*($colwid + $gutter), $this->_margin + $headerhi);
     268                  $this->SetFont($this->_font, 'B', $fontsize);
    265269                  $this->fitCell($colwid/2, $linehi, 'Name', 1);
    266270                  $this->fitCell($colwid/3, $linehi, 'Workshop', 1);
     
    272276                  while ((count($peops) > 0) && ($row < $peopspercol)) {
    273277                        $peop = array_shift($peops);
    274                         $this->SetXY($this->_margin + $col*($colwid + $gutter), $this->_margin + ($row+1)*$linehi);
     278                        if (is_null($first))
     279                          $first = $peop;
     280                        $last = $peop;
     281                        $this->SetXY($this->_margin + $col*($colwid + $gutter), $this->_margin + $headerhi + ($row+1)*$linehi);
    275282            $fillthisrow = floor($row/4)%2;
    276283                        $this->fitCell($colwid/2, $linehi, iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $peop['last_name'].', '.$peop['first_name'].' '.$peop['middle_name']), 0, 0, 'L', $fillthisrow);
     
    283290                  if ($col < $columns) {
    284291                        $x = $this->_margin + ($colwid+$gutter)*$col - $gutter/2;
    285                         $this->Line($x, $this->_margin + $linehi, $x, $this->_page_height - $this->_margin);
     292                        $this->Line($x, $this->_margin + $linehi + $headerhi, $x, $this->_page_height - $this->_margin - $headerhi);
    286293                  }
     294                }
     295                if (!is_null($first) and !is_null($last)) {
     296                  // add header describing the page.
     297                  $header = $jpdd->getActiveEvent()->getTitle().' Attendee Index';
     298                  $right = iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $first['last_name'].' - '.$last['last_name']);
     299                  $pagenotes = $page.' of '.$pagecount;
     300                  $this->SetXY($this->_margin, $this->_margin);
     301                  $this->SetFont($this->_font, 'B', $headerhi*0.8);
     302                  $this->fitCell($this->_page_width - 2*$this->_margin, $headerhi, $header, 0, 0, 'L');
     303                  $this->SetXY($this->_margin, $this->_margin);
     304                  $this->fitCell($this->_page_width - 2*$this->_margin, $headerhi, $right, 0, 0, 'R');
     305                  $this->SetXY($this->_margin, $this->_page_height - $this->_margin - $headerhi);
     306                  $this->fitCell($this->_page_width - 2*$this->_margin, $headerhi, $pagenotes, 0, 0, 'R');
    287307                }
    288308          }
  • trunk/jpdd/class.jpdd.php

    r1436 r1441  
    531531    }
    532532    function addAttendeeIndexPDF(&$pdf) {
    533       $pdf->addAttendeeIndex();
     533      $attendeecount = $this->getActiveEvent()->participantCount();
     534      $pdf->addAttendeeIndex(ceil($attendeecount/400)*2);
    534535    }
    535536
Note: See TracChangeset for help on using the changeset viewer.