Login   Register  
PHP Classes
elePHPant
Icontem

File: field.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Valics Lehel  >  PHP or Java Class Code Generator  >  field.php  >  Download  
File: field.php
Role: Application script
Content type: text/plain
Description: app script
Class: PHP or Java Class Code Generator
Generate PHP or Java database access classes
Author: By
Last change:
Date: 6 years ago
Size: 1,726 bytes
 

Contents

Class file image Download
<?php
include_once("config.inc.php");
include_once(
INCLUDE_PATH."cls_fast_template.php");
include_once(
INCLUDE_PATH."cls_string.php");
session_start();
$stringutil = new String("");
$all_url_vars=array();
$all_url_vars=$stringutil->parse_all();
if(
$all_url_vars["action"]!= "add")
{
$ft = new FastTemplate(TEMPLATE_PATH);
$ft->define(array("main"=>"template_body.html""content"=>"template_generate.html"));
$ft->parse("BODY", array("content","main"));
print 
$ft->fetch("BODY");
}
else if (
$all_url_vars["action"] == "add")
{
    
$ft = new FastTemplate(TEMPLATE_PATH);
    
$ft->define(array("main"=>"template_body.html""content"=>"template_generate.html"));
    
$position=strpos($_SESSION['dbuffer'],";");
    
$firstfield=substr($_SESSION['dbuffer'],0,$position);
    if(
$all_url_vars["fields"]!=$firstfield){
        
$goodbuffer=$all_url_vars["fields"];
        
$goodbuffer.=";";
        
$tok=explode(";",$_SESSION['dbuffer']);
        
$toknr=sizeof($tok);
        for(
$i=0;$i<$toknr;$i++)
        {
            if(!empty(
$tok[$i]))
                if(
$tok[$i]==$all_url_vars["fields"])
                {
                    
$goodbuffer.="";
                }
                else if(
$tok[$i]!=$all_url_vars["fields"])
                {
                    
$goodbuffer.=$tok[$i];
                    
$goodbuffer.=";";
                }
            
        }
    }
    else if(
$all_url_vars["fields"]==$firstfield)
    {
        
$goodbuffer=$_SESSION['dbuffer'];
    }
    
    
$_SESSION['dbfields']=$goodbuffer;
    
$ft->assign("TABLE",$_SESSION['table']);
    
$ft->assign("DBFIELDS",$goodbuffer);
    
$tokexample=explode(";",$goodbuffer);
    
$tokenr=sizeof($tokexample);
    
$example="";
    for(
$i=0;$i<$tokenr-1;$i++)
    {
        
$example.=ucwords($tokexample[$i]);
        
$example.=";";
    }
    
$ft->assign("EXAMPLE",$example);
    
$ft->parse("BODY", array("content","main"));
    print 
$ft->fetch("BODY");
}
?>