Esempio n. 1
0
        } else {
            // sql error in save() ?
            $cmd = 'rqEdit';
        }
    } else {
        if (claro_failure::get_last_failure() == 'exercise_no_title') {
            $dialogBox->error(get_lang('Field \'%name\' is required', array('%name' => get_lang('Title'))));
        } elseif (claro_failure::get_last_failure() == 'exercise_incorrect_dates') {
            $dialogBox->error(get_lang('Start date must be before end date ...'));
        }
        $cmd = 'rqEdit';
    }
}
if ($cmd == 'rqEdit') {
    $form['title'] = $exercise->getTitle();
    $form['description'] = $exercise->getDescription();
    $form['displayType'] = $exercise->getDisplayType();
    $form['randomize'] = (bool) $exercise->getShuffle() > 0;
    $form['questionDrawn'] = $exercise->getShuffle();
    $form['useSameShuffle'] = (bool) $exercise->getUseSameShuffle();
    $form['showAnswers'] = $exercise->getShowAnswers();
    $form['startDate'] = $exercise->getStartDate();
    // unix
    if (is_null($exercise->getEndDate())) {
        $form['useEndDate'] = false;
        $form['endDate'] = 0;
    } else {
        $form['useEndDate'] = true;
        $form['endDate'] = $exercise->getEndDate();
    }
    $form['useTimeLimit'] = (bool) $exercise->getTimeLimit();
Esempio n. 2
0
 $pdf->SetSubject(claro_utf8_encode($exercise->getTitle()));
 //set margins
 $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
 $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
 $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
 //set auto page breaks
 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
 //set image scale factor
 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
 $pdf->setPrintHeader(false);
 // add a page
 $pdf->AddPage();
 $htmlcontent = '<div style="font-size: xx-large; font-weight: bold;">' . claro_htmlspecialchars($exercise->getTitle()) . '<div>' . "\n";
 $pdf->writeHTML(claro_utf8_encode($htmlcontent, get_conf('charset')), true, 0, true, 0);
 //change Img URL
 $exercise->setDescription(claro_utf8_encode(change_img_url_for_pdf($exercise->getDescription()), get_conf('charset')));
 //End change Img URL
 $htmlcontent = '<div style="font-size: normal; font-weight: normal;">' . $exercise->getDescription() . '</div><br /><br />' . "\n";
 $pdf->writeHTML(claro_utf8_encode($htmlcontent, get_conf('charset')), true, 0, true, 0);
 $i = 1;
 foreach ($questionList as $question) {
     $htmlcontent = '<p><table cellspacing="4">' . "\n" . '<tbody>' . "\n" . '<tr>' . "\n" . '<th colspan="2" style="text-align: center; font-weight: bold; color: #693; background-color: #DEEECE;">' . get_lang('Question') . ' ' . $i . '</th>' . "\n" . '</tr>' . "\n" . '<tr>' . "\n" . '<td colspan="2">' . claro_htmlspecialchars(strip_tags($question['title'])) . '</td>' . "\n" . '</tr>' . "\n";
     // Question description
     if (trim(claro_htmlspecialchars($question['description']))) {
         $htmlcontent .= '<tr>' . "\n" . '<td colspan="2" style="font-size: x-small; font-style: italic;">' . change_img_url_for_pdf(claro_parse_user_text($question['description'])) . '</td>' . "\n" . '</tr>' . "\n";
     }
     // Attachment
     if (!empty($question['attachment'])) {
         $extensionsList = array('jpg', 'jpeg', 'bmp', 'gif', 'png');
         $ext = strtolower(get_file_extension($question['attachment']));
         if (in_array($ext, $extensionsList)) {