Login   Register  
PHP Classes
elePHPant
Icontem

File: sc_select_ajax_handler.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Panos Kyriakakis  >  AJAXed list boxes  >  sc_select_ajax_handler.php  >  Download  
File: sc_select_ajax_handler.php
Role: Application script
Content type: text/plain
Description: Ajax handling functions
Class: AJAXed list boxes
Generate AJAXed linked select inputs
Author: By
Last change: updated to version 0.5
Date: 2009-04-22 05:23
Size: 2,898 bytes
 

Contents

Class file image Download
<?php
// sc_classes.php v0.5

// Copyright (c) 2006,7,8 Panos Kyriakakis (http://www.salix.gr)
// 
// 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//   

    
include("sc_classes.php"); // <----- fix this to point to correct location

    
sc_ajax_select_boxes::openDB(    'localhost'// server
                                    
'lsb'// database name
                                    
'root'// db username
                                    
'' // db password
                                  
); 
    
    if( isset(
$_REQUEST['class']) )
      
$class $_REQUEST['class'];
    else
      
$class =''
      
    if( 
$class == 'updater' ) {
      
$link_field_value $_REQUEST['linkval'];
      
$table $_REQUEST['table'];
      
$keyfld $_REQUEST['keyfld'];
      
$keyval $_REQUEST['keyval'];
      
$flds $_REQUEST['flds'];
      
$xml_encoding $_REQUEST['xml_encoding'];
    
      
$sc_ajax_updater = new sc_ajax_updater();
      
      
$rows $sc_ajax_updater->ajax_get_records($table$keyfld$keyval$flds);
      if( 
count($rows)!=|| $link_field_value=='0' )
          
$sc_ajax_updater->ajax_output_xml($rows$xml_encoding);
      else
          
$sc_ajax_updater->ajax_output_xml_for_none($xml_encoding);
    }    
    else {
      
$link_field_value $_REQUEST['linkval'];
      
$table $_REQUEST['table'];
      
$key $_REQUEST['key'];
      
$text $_REQUEST['text'];
      
$order $_REQUEST['order'];
      
$extra_where stripslashes($_REQUEST['extra_where']);
      
$select_prompt_text $_REQUEST['select_prompt_text'];
      
$linkfld $_REQUEST['linkfld'];
      
$xml_encoding $_REQUEST['xml_encoding'];
      
$sc_ajax_select_boxes = new sc_ajax_select_boxes();

      
$rows $sc_ajax_select_boxes->ajax_get_records($table$key$text$order
                                              
$linkfld$link_field_value,
                                              
$extra_where);
      if( 
count($rows)!=|| $link_field_value=='0' )
          
$sc_ajax_select_boxes->ajax_output_xml($rows$select_prompt_text$xml_encoding);
      else
          
$sc_ajax_select_boxes->ajax_output_xml_for_none($xml_encoding);

    }
    
?>