WPCW_certificate_notFound();
    }
} else {
    // Check database for the certificate by the ID
    $certificateDetails = WPCW_certificate_getCertificateDetails_byAccessKey($certificateID);
    // Not a valid certificate, abort
    if (!$certificateDetails) {
        WPCW_certificate_notFound();
    }
    $courseDetails = WPCW_courses_getCourseDetails($certificateDetails->cert_course_id);
    $userInfo = get_userdata($certificateDetails->cert_user_id);
    // Not a valid course or user data
    if (!$certificateDetails || !$userInfo) {
        WPCW_certificate_notFound();
    }
    // Generate certificate to download
    $cert = new WPCW_Certificate();
    // GW 150114 Richtigen Usernamen (Vor- und Nachnamen) holen.
    $cert->generatePDF(WPCW_users_getUsersName($userInfo), $courseDetails->course_title, $certificateDetails, 'browser');
    // $cert->generatePDF(WPCW_users_getUsersName($current_user), $courseDetails->course_title, $certificateDetails, 'browser');
    die;
}
/**
 * Show a generic error, details not found.
 */
function WPCW_certificate_notFound()
{
    _e('No certificate was found.', 'wp_courseware');
    die;
}
die;
 /**
  * Renders the signature area for the certificate.
  */
 function render_handleSignature()
 {
     // Have we got a text or image signature?
     $signature = '';
     $signatureType = WPCW_arrays_getValue($this->settingsList, 'cert_signature_type', 'text');
     $signatureImg = WPCW_arrays_getValue($this->settingsList, 'cert_sig_image_url');
     // Get the text for the signature
     if ('text' == $signatureType) {
         $signature = WPCW_arrays_getValue($this->settingsList, 'cert_sig_text');
         // Nothing to do, signature is empty
         if (!$signature) {
             return;
         }
         // Create the signature
         $signature_len = $this->pdffile->GetStringWidth($signature);
         $this->pdffile->SetXY($this->signature_X + ($this->footer_line_length - $signature_len) / 2, $this->footer_Y);
         $this->pdffile->Cell(0, 0, $signature, false, false);
     } else {
         // No image to work with
         if (!$signatureImg) {
             return;
         }
         // Image is fetched using URL, and resized to match the space. We're using
         // an image that's twice the size to get it to scale nicely.
         $sigWidth = WPCW_Certificate::px2mm(WPCW_CERTIFICATE_SIGNATURE_WIDTH_PX);
         $sigHeight = WPCW_Certificate::px2mm(WPCW_CERTIFICATE_SIGNATURE_HEIGHT_PX);
         $this->pdffile->Image($signatureImg, $this->signature_X + ($this->footer_line_length - $sigWidth) / 2, $this->footer_Y - $sigHeight + 3, $sigWidth);
         // Only force width
     }
 }
 /**
  * Renders the signature area for the certificate.
  */
 function render_handleSignature()
 {
     $topLineY = 257;
     // Have we got a text or image signature?
     $signature = '';
     $signatureType = WPCW_arrays_getValue($this->settingsList, 'cert_signature_type', 'text');
     $signatureImg = WPCW_arrays_getValue($this->settingsList, 'cert_sig_image_url');
     // Get the text for the signature
     if ('text' == $signatureType) {
         // Use codepage translation of signature text
         $encoding = WPCW_arrays_getValue($this->settingsList, 'certificate_encoding', 'ISO-8859-1');
         $signature = iconv('UTF-8', $encoding . '//TRANSLIT//IGNORE', WPCW_arrays_getValue($this->settingsList, 'cert_sig_text'));
         // Nothing to do, signature is empty
         if (!$signature) {
             return;
         }
         // Create the signature
         $signature_len = $this->pdffile->GetStringWidth($signature);
         $this->pdffile->SetXY($this->signature_X + ($this->footer_line_length - $signature_len) / 2, $topLineY);
         $this->pdffile->Cell(300, 150, $signature, false, false);
     } else {
         // No image to work with
         if (!$signatureImg) {
             return;
         }
         // Image is fetched using URL, and resized to match the space. We're using
         // an image that's twice the size to get it to scale nicely.
         $sigWidth = WPCW_Certificate::px2mm(WPCW_CERTIFICATE_SIGNATURE_WIDTH_PX);
         $sigHeight = WPCW_Certificate::px2mm(WPCW_CERTIFICATE_SIGNATURE_HEIGHT_PX);
         // Only force width
         $this->pdffile->Image($signatureImg, 122, 252, $sigWidth);
     }
 }
Exemple #4
0
        die;
    } else {
        WPCW_certificate_notFound();
    }
} else {
    // Check database for the certificate by the ID
    $certificateDetails = WPCW_certificate_getCertificateDetails_byAccessKey($certificateID);
    // Not a valid certificate, abort
    if (!$certificateDetails) {
        WPCW_certificate_notFound();
    }
    $courseDetails = WPCW_courses_getCourseDetails($certificateDetails->cert_course_id);
    $userInfo = get_userdata($certificateDetails->cert_user_id);
    // Not a valid course or user data
    if (!$certificateDetails || !$userInfo) {
        WPCW_certificate_notFound();
    }
    // Generate certificate to download
    $cert = new WPCW_Certificate();
    $cert->generatePDF(WPCW_users_getUsersName($userInfo), $courseDetails->course_title);
    die;
}
/**
 * Show a generic error, details not found.
 */
function WPCW_certificate_notFound()
{
    _e('No certificate was found.', 'wp_courseware');
    die;
}
die;
        WPCW_certificate_notFound();
    }
    // GW 150225 Gender ermitteln
    $anrede = "Herr/Frau";
    // Standard
    if ($userInfo->ID) {
        $gender = $wpdb->get_var(" \n\t\t\t\t\tSELECT meta_value  \n\t\t\t\t\tFROM wp13_usermeta \n\t\t\t\t\tWHERE meta_key = 'datr_gender'\n\t\t\t\t\tAND user_id = " . $userInfo->ID);
        if ($gender == "male") {
            $anrede = "Herr";
        }
        if ($gender == "female") {
            $anrede = "Frau";
        }
    }
    // Generate certificate to download
    $cert = new WPCW_Certificate();
    //echo "current_user:<br>";var_dump($current_user); echo "<br><br><br>";
    //echo "userInfo:<br>";var_dump($userInfo); echo "<br><br><br>";
    // GW 150114 Richtigen Usernamen (Vor- und Nachnamen) holen.
    // $cert->generatePDF(WPCW_users_getUsersName($userInfo), $courseDetails->course_title, $certificateDetails, 'browser');
    //$cert->generatePDF(WPCW_users_getUsersName($current_user)."|".$current_user->user_login."|".$anrede, $courseDetails->course_title, $certificateDetails, 'browser');
    $cert->generatePDF(WPCW_users_getUsersName($userInfo) . "|" . $userInfo->user_login . "|" . $anrede, $courseDetails->course_title, $certificateDetails, 'browser');
    die;
}
/**
 * Show a generic error, details not found.
 */
function WPCW_certificate_notFound()
{
    _e('No certificate was found.', 'wp_courseware');
    die;