Example #1
0
function BP_NewExam(BubPdf $BubPdf, $CorrectAnswersProvided = FALSE)
{
    global $examtitle, $teacher, $exam_id, $grade, $subject, $instancedate;
    // StudentCode bubbles removed whenever CorrectAnswers are provided
    if ($CorrectAnswersProvided) {
        $BubPdf->CorrectAnswersProvided = TRUE;
    }
    $BubPdf->getAliasNbPages();
    //Defines an alias for the total number of pages. It will be substituted as the document is closed.
    $BubPdf->SetTopMargin($BubPdf->AreaTopMargin);
    $BubPdf->SetLeftMargin($BubPdf->AreaLeftMargin);
    $BubPdf->SetAutoPageBreak(TRUE, $BubPdf->AreaBotMargin);
    // bottom margin (if columns seem offset funny, this number could be to blame)
    // fill in some of the PDF meta data
    $BubPdf->SetTitle($examtitle);
    $BubPdf->SetAuthor($teacher);
    $BubPdf->SetSubject($exam_id);
    $BubPdf->SetKeywords("{$grade} {$subject} {$instancedate}");
}
Example #2
0
$DBG = 1;
// print little dashed blue rectangles around all defined bubble zones
require_once 'ans_pdf_open.php';
// for more documentation, see the top of this file
// Variables to be assigned
$exam = "Cumulative Assessment 10-B";
$grade = "Grade 4";
$teacher = "Mr. Smithman";
$subject = "Language Arts";
$instancedate = "Fall 2009";
$exam_id = "786B";
$student_code = "1870654129";
$student_name = "Rosales, Jose";
// Create a new BubPdf object.
$BubPdf = new BubPdf('P', 'in', 'LETTER', true);
// NewExam sets the margins, etc
BP_NewExam($CorrectAnswersProvided = FALSE);
BP_StudentAnswerSheetStart();
// 12 questions
BP_AddAnswerBubbles('A', 5, 12, FALSE, FALSE);
// 6 questions, True, False
BP_AddAnswerBubbles('T', 2, 6, FALSE, FALSE);
// 10 questions, alternating
BP_AddAnswerBubbles('A', 4, 10, TRUE, FALSE);
// 10 questions, yes/no
BP_AddAnswerBubbles('Y', 2, 10, FALSE, FALSE);
// 20 questions, numerical
BP_AddAnswerBubbles('1', 5, 20, FALSE, FALSE);
// 22 questions, alternating
BP_AddAnswerBubbles('A', 4, 22, TRUE, FALSE);
Example #3
0
/**
 *
 * @param string $answers            
 * @return BubPdf
 */
function emarking_create_omr_answer_sheet($answers = null)
{
    global $CFG;
    require_once $CFG->libdir . '/tcpdf/tcpdf.php';
    // for more documentation, see the top of this file
    require_once $CFG->dirroot . '/mod/emarking/lib/openbub/ans_pdf_open.php';
    // for more documentation, see the top of this file
    // Create a new BubPdf object.
    $BubPdf = new BubPdf('P', 'in', 'LETTER', true);
    $BubPdf->SetPrintHeader(false);
    $BubPdf->SetPrintFooter(false);
    // NewExam sets the margins, etc
    BP_NewExam($BubPdf, $CorrectAnswersProvided = TRUE);
    BP_StudentAnswerSheetStart($BubPdf);
    // A simple 12 question exam
    foreach ($answers as $options) {
        BP_AddAnswerBubbles($BubPdf, 'A', $options, 1, FALSE, FALSE);
    }
    BP_StudentAnswerSheetComplete($BubPdf);
    // the CreateExam call can be used to retrieve an array of the zone assignments
    $myZones = BP_CreateExam($BubPdf);
    return $BubPdf;
}