Changeset 191
- Timestamp:
- Jan 31, 2007 1:10:12 AM (6 years ago)
- Location:
- trunk/jpdd
- Files:
-
- 3 edited
-
class.jpdd.pdf.php (modified) (2 diffs)
-
class.jpdd.php (modified) (3 diffs)
-
class.jpdd.workshop.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jpdd/class.jpdd.pdf.php
r185 r191 179 179 $ypos += $linehi; 180 180 } 181 181 $this->_workshop = NULL; 182 182 } 183 183 … … 226 226 } 227 227 } 228 $this->_org = NULL; 228 229 } 229 230 -
trunk/jpdd/class.jpdd.php
r189 r191 313 313 314 314 315 function addOpenWorkshopsToPDF(&$pdf) { 316 $cats = $this->getAll('category'); 317 $pdf->newPage(); 318 reset($cats); 319 while (list(,$cat) = each($cats)) { 320 $wshops = $cat->getM2MPeers('workshop', 'workshop_category', 'Workshops'); 321 $wshops = array_filter($wshops, create_function('$x', 'return !$x->isFull();')); 322 if (count($wshops)) { 323 // don't start a section header more than halfway down the 324 // page: (this is a hack) 325 if ($pdf->GetY() >= $pdf->_page_height/2) 326 $pdf->newPage(); 327 $pdf->SetFont('helvetica', 'B', 24); 328 $pdf->Cell($pdf->_page_width - 2*$pdf->_margin, 30, html_entity_decode($cat->getTitle()), 1, 1); 329 $pdf->SetY($pdf->GetY() + 20); 330 reset($wshops); 331 while(list(,$w) = each($wshops)) 332 $w->writeToPDF(&$pdf); 333 } 334 } 335 return $ret; 336 } 337 315 338 function addSignupPDFs(&$pdf) { 316 339 $workshops = $this->getAll('workshop'); … … 339 362 $this->addSignupPDFs(&$pdf); 340 363 $this->addTablePDFs(&$pdf); 364 $this->addOpenWorkshopsToPDF(&$pdf); 341 365 } 342 366 … … 424 448 return array('all.pdf' => array('description' => 'All together', 425 449 'function' => 'addAllPDFs'), 426 'door.pdf' => array('description' => ' printouts for the doors',450 'door.pdf' => array('description' => 'Printouts for the doors', 427 451 'function' => 'addDoorPDFs'), 428 'attendance.pdf' => array('description' => ' attendance sheets for the workshops',452 'attendance.pdf' => array('description' => 'Attendance sheets for the workshops', 429 453 'function' => 'addSignupPDFs'), 430 'table.pdf' => array('description' => 'pages for the entrance table', 454 'open.pdf' => array('description' => 'Catalog of all open workshops', 455 'function' => 'addOpenWorkshopsToPDF'), 456 'table.pdf' => array('description' => 'Pages for the entrance table', 431 457 'function' => 'addTablePDFs')); 432 458 } -
trunk/jpdd/class.jpdd.workshop.php
r180 r191 295 295 } 296 296 297 // make it all stay on the same page, if possible.. 298 function writeToPDF(&$pdf) { 299 $font = 'helvetica'; 300 $titlesize = 20; 301 $bodysize = 12; 302 $linesp = 1.2; 303 $title = html_entity_decode($this->getTitle()); 304 $txt = $this->getDescription(); 305 // convert back to plain text: 306 $txt = html_entity_decode(strip_tags(trim(preg_replace(array('|<br */?>|i', '|<p */?>|i'), array("\n", "\n\n"), $txt))), ENT_QUOTES); 307 $wid = $pdf->_page_width - 2*$pdf->_margin; 308 309 $pres = $this->getM2MPeers('person', 'presenter'); 310 $prestxt = join("\n", array_map(create_function('$p', 'return " ".trim(strip_tags($p->getNameWithOrgs()));'), $pres)); 311 312 $hi = 0; 313 $pdf->SetFont($font, 'B', $titlesize); 314 $hi += ($pdf->LineCount($title, $wid) * $titlesize*$linesp); 315 $pdf->SetFont($font, 'B', $bodysize); 316 $hi += ($pdf->LineCount($prestxt, $wid) * $bodysize*$linesp); 317 $hi += $bodysize/2; 318 319 $pdf->SetFont($font, '', $bodysize); 320 $hi += ($pdf->LineCount($txt, $wid) * $bodysize*$linesp); 321 322 if (($pdf->GetY() + $hi + $this->_margin) > $pdf->_page_height) 323 $pdf->newPage(); 324 325 $pdf->SetFont($font, 'B', $titlesize); 326 $pdf->MultiCell($wid, $titlesize*$linesp, $title, 0, 'L'); 327 $pdf->SetFont($font, 'B', $bodysize); 328 $pdf->MultiCell($wid, $bodysize*$linesp, $prestxt, 0, 'L'); 329 $pdf->SetY($pdf->GetY() + $bodysize/2); 330 $pdf->SetFont($font, '', $bodysize); 331 $pdf->MultiCell($wid, $bodysize*$linesp, $txt, 0, 'L'); 332 333 // add some space at the bottom, if possible: 334 $pdf->SetY($pdf->GetY() + 20); 335 } 336 297 337 function getPDF($pdfname) { 298 338 require_once('class.jpdd.pdf.php');
Note: See TracChangeset
for help on using the changeset viewer.

