Location: PHPKode > scripts > PXAServer > pxaserver/libreria/if_use_php5/collector.inc.php
<?php
############################################################################
# This code is developed by Guerrieri Luca                                                                #
# copyright (C) 2006/2007 hide@address.com
# This code is released under the terms of the GPL v.2 License.
# 
# The author is not responsible for data loss, or any kind of trouble that 
# results from the use of this software.
# USE IT AT YOUR OWN RISK!
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
############################################################################

/*
 * Created on 1-set-2006
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

  require ('libfunz.inc.php');
  require ('config.inc.php');
  
  $error= new MSGmanager;	//Istanzia la classe dei messaggi di errore
  
  $aj = new Ajax;
  $aj -> set_id ($_REQUEST['id']);
  $aj -> set_request($_REQUEST['resource']);
  $aj -> set_xml_file($ajax_xml_file);
  if ($_REQUEST['type']== "static"){
  //elaboriamo un file e lo restituiamo
  	$aj -> set_type("static");
  	$file2open = $template_directory.$template_name."/ajax_template/".$aj -> send_response();	//usa il link al file indicato in ajax_xml_file 
  	if (!($fp = fopen ($file2open, "r"))) {
	 	print ($this->error->print_error('file2open_collector_error'));
  	}else {
		$readed_info = fread ($fp,filesize($file2open));
		echo $readed_info;
		fclose ($fp);
  	}
  }else if ($_REQUEST['type']== "dynamic"){
  //elaboriamo una query e la restituiamo
  	$aj -> set_type("dynamic");
	$link = db_connect();
	$Qm = new QueryManager;
	$Qm ->set_query($aj -> send_response());
	$Qr = new QueryResult($Qm ->get_static_query(),"assoc",$link);	//rilascia un array con il risultato della query eseguita
	$query_array = $Qr-> result;
	db_close($link);
	$tm = new TemplateManager;
	echo $tm->make_dynamic_template($template_name,$_REQUEST['resource'].'.tpl',$_REQUEST['resource'].'.xml',$query_array);	
  }
?>
Return current item: PXAServer