src/UI/SettingsForm.php
public static function dueDate()
    {
        global $USER;
        if ( ! $USER ) return false;
        $due = Settings::linkGet('due', '');
        $timezone = Settings::linkGet('timezone', 'Pacific/Honolulu');
        $time = Settings::linkGet('penalty_time', 86400);
        $cost = Settings::linkGet('penalty_cost', 0.2);

        if ( ! $USER->instructor ) {
            if ( strlen($due) < 1 ) {
                echo("<p>"._m("There is currently no due date/time for this assignment.")."</p>\n");
                return;
            }
            $dueDate = self::getDueDate();
            echo("<p>"._m("Due date: ").htmlent_utf8($due)."</p>\n");
            echo("<p>".$dueDate->penaltyinfo."</p>\n");
            if ( $dueDate->message ) {
                echo('<p style="color:red;">'.$dueDate->message.'</p>'."\n");
            }
            return;
        }
?>
        <label for="due">
            <?= _m("Please enter a due date in ISO 8601 format (2015-01-30T20:30) or leave blank for no due date.
            You can leave off the time to allow the assignment to be turned in any time during the day.") ?><br/>
        <input type="text" class="form-control" value="<?php echo(htmlspec_utf8($due)); ?>" name="due"></label>
        <label for="timezone">
            <?= _m("Please enter a valid PHP Time Zone like 'Pacific/Honolulu' (default).  If you are
            teaching in many time zones around the world, 'Pacific/Honolulu' is a good time
            zone to choose - this is why it is the default.") ?><br/>
        <input type="text" class="form-control" value="<?php echo(htmlspec_utf8($timezone)); ?>" name="timezone"></label>
            <p><?= _m("The next two fields determine the 'overall penalty' for being late.  We define a time period
            (in seconds) and a fractional penalty per time period.  The penalty is assessed for each
            full or partial time period past the due date.  For example to deduct 20% per day, you would
            set the period to be 86400 (24*60*60) and the penalty to be 0.2.") ?>
            </p>
        <label for="penalty_time"><?= _m("Please enter the penalty time period in seconds.") ?><br/>
        <input type="text" class="form-control" value="<?php echo(htmlspec_utf8($time)); ?>" name="penalty_time"></label>
        <label for="penalty_cost"><?= _m("Please enter the penalty deduction as a decimal between 0.0 and 1.0.") ?><br/>
        <input type="text" class="form-control" value="<?php echo(htmlspec_utf8($cost)); ?>" name="penalty_cost"></label>
<?php
    }
public static function dueDate()
    {
        global $USER;
        if ( ! $USER ) return false;
        $due = Settings::linkGet('due', '');
        $timezone = Settings::linkGet('timezone', 'Pacific/Honolulu');
        $time = Settings::linkGet('penalty_time', 86400);
        $cost = Settings::linkGet('penalty_cost', 0.2);

        if ( ! $USER->instructor ) {
            if ( strlen($due) < 1 ) {
                echo("<p>"._m("There is currently no due date/time for this assignment.")."</p>\n");
                return;
            }
            $dueDate = self::getDueDate();
            echo("<p>"._m("Due date: ").htmlent_utf8($due)."</p>\n");
            echo("<p>".$dueDate->penaltyinfo."</p>\n");
            if ( $dueDate->message ) {
                echo('<p style="color:red;">'.$dueDate->message.'</p>'."\n");
            }
            return;
        }
?>
        <label for="due">
            <?= _m("Please enter a due date in ISO 8601 format (2015-01-30T20:30) or leave blank for no due date.
            You can leave off the time to allow the assignment to be turned in any time during the day.") ?><br/>
        <input type="text" class="form-control" value="<?php echo(htmlspec_utf8($due)); ?>" name="due"></label>
        <label for="timezone">
            <?= _m("Please enter a valid PHP Time Zone like 'Pacific/Honolulu' (default).  If you are
            teaching in many time zones around the world, 'Pacific/Honolulu' is a good time
            zone to choose - this is why it is the default.") ?><br/>
        <input type="text" class="form-control" value="<?php echo(htmlspec_utf8($timezone)); ?>" name="timezone"></label>
            <p><?= _m("The next two fields determine the 'overall penalty' for being late.  We define a time period
            (in seconds) and a fractional penalty per time period.  The penalty is assessed for each
            full or partial time period past the due date.  For example to deduct 20% per day, you would
            set the period to be 86400 (24*60*60) and the penalty to be 0.2.") ?>
            </p>
        <label for="penalty_time"><?= _m("Please enter the penalty time period in seconds.") ?><br/>
        <input type="text" class="form-control" value="<?php echo(htmlspec_utf8($time)); ?>" name="penalty_time"></label>
        <label for="penalty_cost"><?= _m("Please enter the penalty deduction as a decimal between 0.0 and 1.0.") ?><br/>
        <input type="text" class="form-control" value="<?php echo(htmlspec_utf8($cost)); ?>" name="penalty_cost"></label>
<?php
    }
public static function dueDate ( ) { global $ USER ; if ( ! $ USER ) return false ; $ due = Settings :: linkGet ( 'due' , '' ) ; $ timezone = Settings :: linkGet ( 'timezone' , 'Pacific/Honolulu' ) ; $ time = Settings :: linkGet ( 'penalty_time' , 86400 ) ; $ cost = Settings :: linkGet ( 'penalty_cost' , 0.2 ) ; if ( ! $ USER -> instructor ) { if ( strlen ( $ due ) < 1 ) { echo ( "<p>" . _m ( "There is currently no due date/time for this assignment." ) . "</p>\n" ) ; return ; } $ dueDate = self :: getDueDate ( ) ; echo ( "<p>" . _m ( "Due date: " ) . htmlent_utf8 ( $ due ) . "</p>\n" ) ; echo ( "<p>" . $ dueDate -> penaltyinfo . "</p>\n" ) ; if ( $ dueDate -> message ) { echo ( '<p style="color:red;">' . $ dueDate -> message . '</p>' . "\n" ) ; } return ; } ?>
        <label for="due">
            <?= _m ( "Please enter a due date in ISO 8601 format (2015-01-30T20:30) or leave blank for no due date.
            You can leave off the time to allow the assignment to be turned in any time during the day." ) ?><br/>
        <input type="text" class="form-control" value="<?php echo ( htmlspec_utf8 ( $ due ) ) ; ?>" name="due"></label>
        <label for="timezone">
            <?= _m ( "Please enter a valid PHP Time Zone like 'Pacific/Honolulu' (default).  If you are
            teaching in many time zones around the world, 'Pacific/Honolulu' is a good time
            zone to choose - this is why it is the default." ) ?><br/>
        <input type="text" class="form-control" value="<?php echo ( htmlspec_utf8 ( $ timezone ) ) ; ?>" name="timezone"></label>
            <p><?= _m ( "The next two fields determine the 'overall penalty' for being late.  We define a time period
            (in seconds) and a fractional penalty per time period.  The penalty is assessed for each
            full or partial time period past the due date.  For example to deduct 20% per day, you would
            set the period to be 86400 (24*60*60) and the penalty to be 0.2." ) ?>
            </p>
        <label for="penalty_time"><?= _m ( "Please enter the penalty time period in seconds." ) ?><br/>
        <input type="text" class="form-control" value="<?php echo ( htmlspec_utf8 ( $ time ) ) ; ?>" name="penalty_time"></label>
        <label for="penalty_cost"><?= _m ( "Please enter the penalty deduction as a decimal between 0.0 and 1.0." ) ?><br/>
        <input type="text" class="form-control" value="<?php echo ( htmlspec_utf8 ( $ cost ) ) ; ?>" name="penalty_cost"></label>
<?php }
Emit the text and form fields to support due dates
Emit the text and form fields to support due dates