plugins/conversions/LoggingEngine/plugins conversions.php,NONE,1.1

Sebastian Bergmann <[email protected]> Sun, 11 Apr 2004 09:45:16 +0000
Newsgroups gmane.comp.web.phpopentracker.cvs
Message-ID <[email protected]>
Update of /cvsroot/phpopencounter/plugins/conversions/LoggingEngine/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2596/conversions/LoggingEngine/plugins

Added Files:
	conversions.php 
Log Message:
Initial import of Conversions plugin by Daniel Kehoe and Adrian Lanning.

--- NEW FILE: conversions.php ---
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: conversions.php,v 1.1 2004/04/11 09:45:14 bergmann Exp $
//

/**
* Stores information about conversions (sales, inquiries, sign-ups).
*
* @author   Daniel Kehoe <[email protected]>
* @version  $Revision: 1.1 $
* @since    phpOpenTracker-Conversions 1.0.0
*/
class phpOpenTracker_LoggingEngine_Plugin_conversions extends phpOpenTracker_LoggingEngine_Plugin {
  /**
  * @var string $table
  */
  var $table = 'pot_conversions';

  /**
  * @return array
  * @access public
  */
  function pre() {

	// collect any data on conversions to sales, inquiries or sign-ups
	if (!empty($this->container['conversions']['sale']) || 
		!empty($this->container['conversions']['inquiry']) ||
		!empty($this->container['conversions']['signup'])) {
			
		$this->db->query(
	      sprintf(
	        "INSERT INTO %s
	                     (accesslog_id,
	                      client_id,
	                      sale, 
	                      inquiry,
	                      signup,
	                      email,
	                      zip,
	                      country,
	                      name)
	              VALUES ('%d',
	              		  '%d',
	                      '%d',
	                      '%d',
	                      '%d',
	                      '%s', 
	                      '%s',
	                      '%s',
	                      '%s')",
	
	        $this->table,
	        $this->container['accesslog_id'],
	        $this->container['client_id'],
	        $this->container['conversions']['sale'],
	        $this->container['conversions']['inquiry'],
	        $this->container['conversions']['signup'],
	        $this->db->prepareString($this->container['conversions']['email']),
	        $this->db->prepareString($this->container['conversions']['zip']),
	        $this->db->prepareString($this->container['conversions']['country']),
	        $this->db->prepareString($this->container['conversions']['name'])
	      )
	    );
    	$this->container['conversions']['sale'] = '';
        $this->container['conversions']['inquiry'] = '';
        $this->container['conversions']['signup'] = '';
        $this->container['conversions']['email'] = '';
        $this->container['conversions']['zip'] = '';
        $this->container['conversions']['country'] = '';
        $this->container['conversions']['name'] = '';
	} // end of capture conversions data
    	
    return true;
  }
}

?>



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click