<?php

/*
/**
* CHRONOFORMS version 1.0 stable
* Copyright (c) 2006 Chrono_Man, ChronoEngine.com. All rights reserved.
* Author: Chrono_Man (ChronoEngine.com)
* See readme.html.
* Visit http://www.ChronoEngine.com for regular update and information.
**/

/* ensure that this file is called from another file */
defined( '_VALID_MOS' ) or die( 'Direct access to this file is prohibited.' );
class mosChronoContact extends mosDBTable {
  // Declaration and initialisation of the instantiation variable
  // INT(11) AUTO_INCREMENT
  var $id=null;
  // TEXT
  var $name=null;
  // TEXT
  var $html=null;
  // TEXT
  var $scriptcode=null;
  // TEXT
  var $redirecturl=null;
  // TINYINT(1)
  var $emailresults=null;
  // TEXT
  var $extraemail=null;
  // TEXT
  var $emailsubject=null;
  // TEXT
  var $onsubmitcode=null;
  // TEXT
  var $onsubmitcodeb4=null;
  // TEXT
  var $attformtag=null;
  // TEXT
  var $submiturl=null;
  // TEXT
  var $emailtemplate=null;
  
  var $paramsall = null;
  
  var $titlesall = null;
  
  var $autogenerated = null;
    // TINYINT(1)
  var $published=null;

  // The constructor is called by the instantiation
  function mosChronoContact( &$database ) {
    $this->mosDBTable( '#__chrono_contact', 'id', $database );
	global $mosConfig_absolute_path, $chronocontact_params;
	
	if( !isset($GLOBALS['chronocontact_params']) || !empty($_REQUEST['chronocontact_params'])) {
			// pull id of letterman component
			$query = "SELECT a.id FROM `#__components` AS a"
			. "\n WHERE `a`.`option` = 'com_chronocontact' AND `parent` = 0";
			$database->setQuery( $query );
			$chronocontact_id = $database->loadResult();
			
			// load Letterman parameters
			$component = new mosComponent( $database );
			$component->load( $chronocontact_id );
			$GLOBALS['chronocontact_params'] = $chronocontact_params = new mosParameters( $component->params );
			
			
		}	
  }
}


class mosChronoContact_Plugins extends mosDBTable {
  // Declaration and initialisation of the instantiation variable
  // INT(11) AUTO_INCREMENT
  var $id=null;
  var $name=null;
  var $event=null;
  var $form_id=null;
  var $params=null;
  var $extra1=null;
  var $extra2=null;
  var $extra3=null;
  var $extra4=null;
  var $extra5=null;

  // The constructor is called by the instantiation
	function mosChronoContact_Plugins( &$database ) {
		$this->mosDBTable( '#__chrono_contact_plugins', 'id', $database );
	}
}
?>
