<?

/**
 * date.mod.php
 * @package   Modules
 */

/**
 * Module name
 */
define("MOD_DATE",$name);
define("DEFAULT_DATEFORMAT","F j, Y");
define("DEFAULT_TIMEFORMAT","g:i a");

$modules[$name]= new DateModule();

/**
 * DateModule
 *
 * This module makes it possible to add time and date variables from the
 * webserver in the mail that is send. This way it is possible to get extra
 * information on the submitter.
 * @package   Modules
 * @author    Herman Suijs
 */
class DateModule extends Module {
  var 
$name "DateModule";
  var 
$id MOD_DATE;
  var 
$execlevel 16;
  var 
$vars = array();

  
/**
   * Constructor
   *
   * Set options and call the superConstructor
   */
  
function DateModule() {
    
$this->options[] = new Option("date_include:include_date","",false,false,"");
    
$this->options[] = new Option("date_format:dateformat","",false,true,DEFAULT_DATEFORMAT);
    
$this->options[] = new Option("time_format:timeformat","",false,true,DEFAULT_TIMEFORMAT);
    
$this->Module();
  } 
/* function DateModule() */
  
  /**
   * Before action
   *
   * Check options and set the vars array
   */
  
function before_action() {
    
$this->check_options();
  } 
/* function before_action() */

  /**
   * Do action
   *
   * Get the values and add them to the variables in formhandler
   */
  
function do_action() {
    global 
$formHandler,$debug;
    
$this->action();

    
$date=date($this->options[1]->value);
    
$time=date($this->options[2]->value);
    
//$extra_vars=array();
    
$extra_vars['date']=$date;
    
$extra_vars['time']=$time;
    
$formHandler->addto_vars($extra_vars,REPLACE);
  } 
/* function do_action() */

  /**
   * After action
   *
   * Cleanup
   */
  
function after_action() {
    
$this->clean_up();
  } 
/* function after_action() */
/* class DateModule extends Module */