genSubjHconf: Generate subject hour confirmation PDFs for psychology...

View source: R/genSubjHconf.R

genSubjHconfR Documentation

Generate subject hour confirmation PDFs for psychology students and optionally send them via email

Description

The function generates a PDF with information about subject hours, study title, subjects email address, name of the organisator of the study, digital signature of the organisator, timestamp of the encryption key, and a code conatining the encrypted infomation. This information can be used to validate the data and data-integrity of the PDF against manipulation. The code can be verified with the function axDecode.

Usage

genSubjHconf(
  studyTitle = "Study title",
  organizer = "Organizer",
  mailTo = "dummy@dummy.local",
  testSubjectHours = "1 h",
  signatureFileName = "dummysig.png",
  workingDirectory = "",
  newKey = FALSE,
  useKey = "dummykey_313937302d30312d30312030303a30303a3031.rda",
  fontscale = 1,
  sendMail = FALSE,
  mailFrom = "",
  mailCc = "",
  mailSubject = "",
  mailBody = "",
  SMTPserver = "",
  SMTPlogin = "",
  SMTPpassword = "",
  verbose = TRUE
)

Arguments

studyTitle

String of the title of the study

organizer

String of the organizer of the study

mailTo

String with email addresses of study participants. The subject hour confirmation is locked to the email address. Optionally, the email is used to sent the confirmation to the participants.

testSubjectHours

String with the number of test subject hours to be assigned, (e.g., "1.25 h", "30min").

signatureFileName

String with the name of the signature file. Allowed file formats is png! Default file is "dummysig.png".

workingDirectory

String of the path of the working directory in which the supplemental files (e.g., scanned signature) and output files (e.g., encryption key, subject hour confirmation PDFs) are stored. Path should end in a slash (/).

newKey

Logical value if a new encryption key for the code should be generated. You have to use the same key for encryption and decryption. The number code at the end of the key contains a timestamp converted to be saveable on different operating systems. Don't rename the key, because the timestamp is needed for decryption. In addition, it helps to differentiate between several keys.

useKey

String with the name of the key which should be used for encryption of the code. Default is "dummykey_313937302d30312d30312030303a30303a3031.rda".

fontscale

Integer value to scale the size of the fonts. Default is 1. Values > 1 enlarge the fontsize, values < 1 reduce the fontsize.

sendMail

Logical value if mails should be send or not. Be careful with this option and test it in advance. Default is false

mailFrom

String to set the email sender (your email address)

mailCc

String to set the Cc of the mail (e.g., to receive a copy of the mails)

mailSubject

String to set the subject of the mail

mailBody

String to set the body of the mail (mailtext)

SMTPserver

String with the name of your mailserver. SSL transport encryption (port 465) is used.

SMTPlogin

String with the login of your mailserver

SMTPpassword

String with the password of your mailserver

verbose

Logical to have a verbose console output (TRUE, default) or not (FALSE)

Value

Returns PDFs with information about subject hours, study title, subjects email address, name of the organisator of the study, digital signature of the organisator, timestamp of the encryption key, and a code with the encrypted infomation. The encrypted information can be used to validate the information and the integrity of the PDF against manipulation. The code can be verified with the function axDecode.

Author(s)

Axel Zinkernagel zinkernagel@uni-landau.de

Examples

## Not run: 
# 1. Generate a dummy PDF in the working directory
genSubjHconf(workingDirectory = "/my/working/directory/")

# 2. Generate PDFs with a new encryption key, but dont sent them per email
emails <- c("dummy1@dummy.local", "dummy2@dummy.local", "dummy3@dummy.local")

genSubjHconf(studyTitle = "My Study", organizer = "My name", mailTo = emails,
            testSubjectHours = "30min",
            signatureFileName = "My_signature_scan.png",
            workingDirectory = "/my/working/directory/",newKey = TRUE)

# Show the filename of the generated key (the key is saved in the working
# directory).
whichKey("2021−01−15 16:40:22")

# Decode the code printed on the pdf (code must be in one line!)
load("/my/working/directory/key_323032312d30312d31352031363a34303a3232.rda")
axDecode("oHtDit5N34y/s+uhOviVKWq/7QGRyQ/M4dP+txAnxpWRcoS...",key)

# 3. Generate PDFs with an existing key and sent the PDFs via email
# Be careful with the mail option, you are able to send mass mails.
genSubjHconf(studyTitle = "My Study", organizer = "My name", mailTo = emails,
          testSubjectHours = "30min",
          signatureFileName = "My_signature_scan.png",
          workingDirectory = "/my/working/directory/",
          useKey = "key_32303231....rda",
          sendMail = TRUE, mailFrom = "my@email.address",
          mailCc = "my@addressFor.copies", mailSubject = "My mail subject",
          mailBody = "This is my mailbody",
          SMTPserver = "my.smtpserver.com",
          SMTPlogin = "myLogin",
          SMTPpassword = "myPassword")


## End(Not run)

axzinker/axBoost documentation built on July 4, 2024, 9:14 p.m.