Help, I broke something
Posted: Thu Feb 03, 2011 9:16 pm
I was trying to change the font size in a pdf file created from some php code on our website and I broke it.
I tried to restore it to the backup of the original and yet it is still broken...
The error we are getting is:
Warning: require_once(/MembersOnly/includes/clubs.inc.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/82/5428282/html/MembersOnly/pdf-book.php on line 7
Fatal error: require_once() [function.require]: Failed opening required '/MembersOnly/includes/clubs.inc.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/82/5428282/html/MembersOnly/pdf-book.php on line 7
This is running a file called pdf-book.php. The code for that file looks like this:
Code: Select all
<?php
session_start();
require '../config.php';
require_once $INCLUDES . 'clubs.inc.php';
require_once $INCLUDES . 'people.inc.php';
require_once $INCLUDES . 'teams.inc.php';
define('FPDF_FONTPATH', $INCLUDES . 'fpdf/font/' );
require_once $INCLUDES . 'fpdf/fpdi.php';
$hFactor = 1.15;
$vFactor = 5.25;
$fSize = 12;
$fFace = 'Arial';
$cl = new clsClubList();
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile( $DIR_HOME . 'admin_prefix/files/prefix.pdf' );
for ( $i=0; $i < $pagecount; $i++ ) {
$pdf->addPage();
$image = $pdf->ImportPage( $i+1 );
$pdf->useTemplate( $image );
}
for( $i=0; $i < count( $cl->items ); $i++ ) {
$club = $cl->items[$i];
//Start a new page
$pdf->AddPage();
//Render the club name and address
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 0, $vFactor, $club->items['NAME'], 0, 1, 'C' );
$pdf->SetFont( $fFace, '', $fSize );
$pdf->Cell( 0, $vFactor, $club->items['STREET_ADDRESS'], 0, 1, 'C' );
$pdf->Cell( 0, $vFactor, $club->items['CITY'] . ', ' . $club->items['STATE'] . ' ' . $club->items['ZIP'], 0, 1, 'C' );
$pdf->Cell( 0, $vFactor, ' ', 0, 1, 'C' );
//Render the course detail information
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 35 * $hFactor, $vFactor, 'Course rating:', 0, 0, 'L' );
$pdf->SetFont( $fFace, '', $fSize );
$crl = new clsCourseRatingList( $club->items['ID'] );
for ( $j=0; $j < count( $crl->items ); $j++ ) {
$rating = $crl->items[$j];
if ( ( ( $j % 2 ) == 0 ) && ( $j != 0 ) ) {
$pdf->Cell( 35 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
}
$tempStr = $rating->items['NAME'] . ' ' . $rating->items['RATING'] . ' Slope: ' . $rating->items['SLOPE'];
if ( ( $j % 2 ) == 0 ) {
$pdf->Cell( 75 * $hFactor, $vFactor, $tempStr, 0, 0, 'L' );
} else {
$pdf->Cell( 75 * $hFactor, $vFactor, $tempStr, 0, 1, 'L' );
}
}
if ( ( $j % 2 ) != 0 ) {
$pdf->Cell( 35 * $hFactor, $vFactor, ' ', 0, 1, 'L' );
}
$pdf->Cell( 0, $vFactor, ' ', 0, 1, 'L' );
//Render the course detail information
$person = new clsPerson( $club->items['CLUB_MANAGER_ID'] );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 35 * $hFactor, $vFactor, 'Club Manager', 0, 0, 'L' );
$pdf->SetFont( $fFace, '', $fSize );
$buf = $person->items['FIRST_NAME'] . ' ' . $person->items['LAST_NAME'];
$pdf->Cell( 45 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, $person->items['PHONE'], 0, 0, 'L' );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 30 * $hFactor, $vFactor, 'Invitational:', 0, 0, 'L' );
$pdf->SetFont( $fFace, '', $fSize );
$pdf->Cell( 30 * $hFactor, $vFactor, $club->items['INVITATIONAL'], 0, 1, 'L' );
$person = new clsPerson( $club->items['HEAD_PRO_ID'] );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 35 * $hFactor, $vFactor, 'Head Pro', 0, 0, 'L' );
$pdf->SetFont( $fFace, '', $fSize );
$buf = $person->items['FIRST_NAME'] . ' ' . $person->items['LAST_NAME'];
$pdf->Cell( 45 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, $person->items['PHONE'], 0, 0, 'L' );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 37 * $hFactor, $vFactor, 'Joined GCWGA:', 0, 0, 'L' );
$pdf->SetFont( $fFace, '', $fSize );
$pdf->Cell( 0, $vFactor, $club->items['JOINED'], 0, 1, 'L' );
$person = new clsPerson( $club->items['GROUNDS_SUPER_ID'] );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 35 * $hFactor, $vFactor, 'Grounds Super.', 0, 0, 'L' );
$pdf->SetFont( $fFace, '', $fSize );
$buf = $person->items['FIRST_NAME'] . ' ' . $person->items['LAST_NAME'];
$pdf->Cell( 45 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, $person->items['PHONE'], 0, 0, 'L' );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 25 * $hFactor, $vFactor, 'Softspikes', 0, 0, 'L' );
$pdf->SetFont( $fFace, '', $fSize );
if ( $club->items['SOFTSPIKES_REQUIRED'] ) {
$pdf->Cell( 0, $vFactor, 'Required', 0, 1, 'L' );
} else {
$pdf->Cell( 0, $vFactor, 'Recommended', 0, 1, 'L' );
}
$person = new clsPerson( $club->items['CLUB_CHAMP_ID'] );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 45 * $hFactor, $vFactor, 'Current Club champ:', 0, 0, 'L' );
$pdf->SetFont( $fFace, '', $fSize );
$buf = $person->items['FIRST_NAME'] . ' ' . $person->items['LAST_NAME'];
$pdf->Cell( 45 * $hFactor, $vFactor, $buf, 0, 1, 'L' );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 45 * $hFactor, $vFactor, 'Delegates:', 0, 1, 'L' );
$pdf->SetFont( $fFace, '', $fSize );
//Delegate 1
$delPerson = new clsPerson( $club->items['DELEGATE_1_ID'] );
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$buf = $delPerson->items['FIRST_NAME'] . ' ' . $delPerson->items['LAST_NAME'];
$pdf->Cell( 35 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
//Alternate
$altPerson = new clsPerson( $club->items['ALTERNATE_ID'] );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 60 * $hFactor, $vFactor, 'Alternate:', 0, 0, 'R' );
$buf = $altPerson->items['FIRST_NAME'] . ' ' . $altPerson->items['LAST_NAME'];
$pdf->SetFont( $fFace, '', $fSize );
$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );
//Back to Delegate 1
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, $delPerson->items['STREET_ADDRESS'], 0, 0, 'L' );
//Back to Alternate
$pdf->Cell( 60 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 0, $vFactor, $altPerson->items['STREET_ADDRESS'], 0, 1, 'L' );
//Back to Delegate 1
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$buf = $delPerson->items['CITY'] . ', ' . $delPerson->items['STATE'] . ' ' . $delPerson->items['ZIP'];
$pdf->Cell( 35 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
//Back to Alternate
$pdf->Cell( 60 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$buf = $altPerson->items['CITY'] . ', ' . $altPerson->items['STATE'] . ' ' . $altPerson->items['ZIP'];
$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );
//Back to Delegate 1
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, $delPerson->items['PHONE'], 0, 0, 'L' );
//Back to Alternate
$pdf->Cell( 60 * $hFactor, $vFactor, ' ' , 0, 0, 'L' );
$pdf->Cell( 0, $vFactor, $altPerson->items['PHONE'], 0, 1, 'L' );
//Blank line
$pdf->Cell( 0, $vFactor, ' ', 0, 1, 'L' );
//Second Delegate
$delPerson = new clsPerson( $club->items['DELEGATE_2_ID'] );
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$buf = $delPerson->items['FIRST_NAME'] . ' ' . $delPerson->items['LAST_NAME'];
$pdf->Cell( 35 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
//Ladies chair
$ladPerson = new clsPerson( $club->items['LADIES_CHAIR_ID'] );
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 60 * $hFactor, $vFactor, 'Ladies Golf Chair:', 0, 0, 'R' );
$pdf->SetFont( $fFace, '', $fSize );
$buf = $ladPerson->items['FIRST_NAME'] . ' ' . $ladPerson->items['LAST_NAME'];
$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );
//Back to Second Delegate
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, $delPerson->items['STREET_ADDRESS'], 0, 0, 'L' );
//Back to Ladies chair
$pdf->Cell( 60 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 0, $vFactor, $ladPerson->items['STREET_ADDRESS'], 0, 1, 'L' );
//Back to Second Delegate
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$buf = $delPerson->items['CITY'] . ', ' . $delPerson->items['STATE'] . ' ' . $delPerson->items['ZIP'];
$pdf->Cell( 35 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
//Back to Ladies chair
$pdf->Cell( 60 * $hFactor, $vFactor, ' ' , 0, 0, 'L' );
$buf = $ladPerson->items['CITY'] . ', ' . $ladPerson->items['STATE'] . ' ' . $ladPerson->items['ZIP'];
$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );
//Back to Second Delegate
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, $delPerson->items['PHONE'], 0, 0, 'L' );
//Back to Ladies chair
$pdf->Cell( 60 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 0, $vFactor, $ladPerson->items['PHONE'], 0, 1, 'L' );
//Blank line
$pdf->Cell( 0, $vFactor, ' ', 0, 1, 'L' );
//Third delegate
$delPerson = new clsPerson( $club->items['DELEGATE_3_ID'] );
$buf = $delPerson->items['FIRST_NAME'] . ' ' . $delPerson->items['LAST_NAME'];
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 0, $vFactor, $delPerson->items['STREET_ADDRESS'], 0, 1, 'L' );
$buf = $delPerson->items['CITY'] . ', ' . $delPerson->items['STATE'] . ' ' . $delPerson->items['ZIP'];
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );
$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
$pdf->Cell( 0, $vFactor, $delPerson->items['PHONE'], 0, 1, 'L' );
//Blank line
$pdf->Cell( 0, $vFactor, ' ', 0, 1, 'L' );
//Team header
$pdf->SetFont( $fFace, 'B', $fSize );
$pdf->Cell( 55 * $hFactor, $vFactor, 'Spring Team Roster', 0, 0, 'L' );
$pdf->Cell( 25 * $hFactor, $vFactor, '', 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, 'HCP index', 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, 'Phone Number', 0, 1, 'L' );
//Team roster
$pdf->SetFont( $fFact, '', $fSize-2 );
$tl = new clsTeamItemList( $club->items['ID'], 'ACTIVE', $limit );
for( $j=0; $j < count( $tl->items ); $j++ ) {
$teamItem = $tl->items[$j];
$teamPerson = $teamItem->getPerson();
$personName = $teamPerson->items['FIRST_NAME'] . ' ' . $teamPerson->items['LAST_NAME'];
$pdf->Cell( 55 * $hFactor, $vFactor, $personName, 0, 0, 'L' );
if ( $teamItem->items['CAPTAIN'] ) {
$pdf->Cell( 25 * $hFactor, $vFactor, 'captain', 0, 0, 'L' );
} else {
$pdf->Cell( 25 * $hFactor, $vFactor, '', 0, 0, 'L' );
}
$pdf->Cell( 35 * $hFactor, $vFactor, $teamPerson->items['HANDICAP'], 0, 0, 'L' );
$pdf->Cell( 35 * $hFactor, $vFactor, $teamPerson->items['PHONE'], 0, 1, 'L' );
}
//Render the team information
}
$pdf->Output();
?>Anyone have any ideas of what I can do to fix my mistake? I can provide more documentation if needed.
THANK YOU!!!! To anyone and everyone who is willing to help this newbie