Results 1 to 2 of 2

Thread: fmcompute and or .ini file question

  1. #1
    Join Date
    Apr 2008

    Default fmcompute and or .ini file question

    I am using FormMail to grade and maintain scores
    for quizzes submitted online.

    all is well except I would like to change the score if students turn in
    quizzes after the "latedate"


    (for testing purposes i made all answers "A")

    currently my .ini file runs a script and computes the "TotalScore"

    I would like it to go one step further .. something like:

    $currenttime = strtotime("now");
    $latedate= xyz date; ///ie. something like $duedate + 2 days...

    if ($currenttime > $latedate){
    TotalScore = max(TotalScore, 75);

    but none of this works on the .ini file.. and I don't know how to properly fix it... I have purchased the fmcompute module...

    any help would be greatly appreciated..

    BTW if any teachers are reading this.. this set up has saved me TONS of time.. I can give a quiz each week, get it graded and returned and scores
    compiled x300 students... all effortlessly...

  2. #2
    Join Date
    Dec 2003

    Default Re: fmcompute and or .ini file question


    The problem consists of these subproblems:
    1. Collecting the submission date.
    2. Collecting the "late" date.
    3. Comparing the two dates.
    The Computation Module currently lacks date processing, but dates can be represented as numbers or as strings and compared that way.

    To collect the submission date, derive a field on your HTML form:
    HTML Code:
    <input type="hidden" name="derive_fields"
     value="date_now=%fullyear%.%moy0%.%dom0%.%hour240%" />
    So, 10am on Jan 14th 2010, will produce a "date_now" field of "2010011410".

    This allows you to compare down to hour level. If you want to compare to minute, you can add the minutes too.

    If you just want to compare to day level, leave out the hour (.%hour240%).

    Next, in your computation, just create a local variable to contain the late date:
    string          late_date;
    late_date = '2010011412';  /* this format is YYYYMMDDHH */
    And, finally, import the date_now field and do your comparison:
    import string date_now;
    if (date_now > late_date) {
       /* the logic you want to execute when the submission is late */
    Depending on how worried you are about hacking students, you can do various checks on the "date_now" value to ensure it's real. Or, you can derive in in the INI file in the "special_fields" section.

    When you change your quiz, you just have to change the "late_date" value to the new value.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Newbie question on open_basedir error
    By zenprofit in forum FormMail Subscription Support
    Replies: 14
    Last Post: 14-Feb-2005, 10:35 PM
  2. question about PHP version 4.3.8
    By djgotee in forum FormMail Subscription Support
    Replies: 4
    Last Post: 29-Nov-2004, 12:46 AM
  3. TARGET_EMAIL question
    By middleburyman in forum FormMail Subscription Support
    Replies: 1
    Last Post: 03-Sep-2004, 09:30 PM
  4. Uploading question
    By tray in forum FormMail Subscription Support
    Replies: 2
    Last Post: 11-Aug-2004, 10:31 PM
  5. at mangle / e-mail question
    By Ibis in forum FormMail Subscription Support
    Replies: 3
    Last Post: 25-Feb-2004, 03:59 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts