PHPsu
MANUAL ZH  |  EN
     


Current Position :| index>PHP CLASS> Class getHTML.php

Class getHTML.php

FROM: AUTHOR: TIME:2008-04-27 HITS:
<?php
/**
* ************************************************************
*
* Author: Ruben Espadas Pacheco a.k.a zir3
* Date: 21.04.2007
* Thanks to Dejitaru for your point of view of this script
*
* ************************************************************
*/

class getHTML{
    var
$id; // Attribute for all DOM's (function parameter)
    
var $name; // Attribute for all DOM's (function parameter)
    
var $value; // Attribute for all DOM's (function parameter)
phpsu is a phpschool

    
var $style; // Attribute for all DOM's
    
var $class; // Attribute for all DOM's (function parameter)
    
var $event; // Declaration for a type of event JS in a DOM
    
var $extras; // Another attributes for a DOM like disabled and check
    
var $method; // Function tu execute when the event JS it's call
phpsu.com

    
var $texto; // Text content in some DOM's
    
var $objet; // What DOM you want? (text => input text, pass => input pass, hide => input hidden ......)
    
var $label; // Attribute for all DOM's (function parameter)
    
var $size; // Attribute in some DOM's
    
var $maxlength; // Attribute in some DOM's
do you kown phpsu.com?

    
var $fin; // Flaw for options in select DOM
    
var $finLinea; // How do you want end your DOM? Example: <br />, &nbsp, </span> .....
    
var $inicioLinea; // How do you want start your DOM? Example:  &nbsp, <span> .....
    
var $methodform; // Decalration of method for a form
    
var $actionform; // Decalration of action for a form

www.phpsu.com


    
var $img; // Declaration of a PATH and name of a image for attribute src of a img DOM
    
    
function getHTML(){
        
$this->clear();
    }
    
    
//LIMPAIMOS PARAMETROS Y DECLARAMOS ALGUNAS VARIABLES PASADAS POR PARAMETRO
    
function genHTML($pObjet, $pName, $pId="", $pValue="", $pClass="", $pLabel=""){
welcome to phpsu.com

        
$this->object=trim($pObjet);
        
$this->id=trim($pId);
        
$this->name=trim($pName);
        
$this->value=trim($pValue); phpsu提供的php教程
        
$this->class=trim($pClass);
        
$this->label=trim($pLabel);
        
$this->object($this->object);
        
$this->fin = false;

phpsu提供的php教程


    }
    
    
//CREAMOS EL OBJETO HTML
    
function object($object){
        if(
$this->label && $this->id)
            echo
'<label for="'.$this->id.'">'.$this->label.'</label>'; www.phpsu.com

        switch(
$object){
        case
'text':
            
$rAct =  $this->event!=""&&$this->method!="" ? $this->actsJs():'';
phpsu.com

        echo
$this->inicioLinea.'<input type="text" id="'.$this->id.'" name="'.$this->name.'" value="'.$this->value.'" size="'.$this->size.'" maxlength="'.$this->maxlength.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.' />'.$this->finLinea; www.phpsu.com
            break;
        case
'pass':
            
$rAct =  $this->event!=""&&$this->method!="" ? $this->actsJs():'';
        echo
'<input type="password" id="'.$this->id.'" name="'.$this->name.'" value="'.$this->value.'" size="'.$this->size.'" maxlength="'.$this->maxlength.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.' />'; phpsu is a phpschool
            break;
        case
'hide':
            
$rAct =  $this->event!=""&&$this->method!="" ? $this->actsJs():'';
        echo
'<input type="hidden" id="'.$this->id.'" name="'.$this->name.'" value="'.$this->value.'" size="'.$this->size.'" maxlength="'.$this->maxlength.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.' />';
phpsu提供的php教程

            break;
        case
'button':
            
$rAct =  $this->event!=""&&$this->method!="" ? $this->actsJs():'';
        echo
'<input type="button" id="'.$this->id.'" name="'.$this->name.'" value="'.$this->value.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.' />'; phpsu is a phpschool
            break;
        case
'check':
            
$rAct =  $this->event!=""&&$this->method!="" ? $this->actsJs():'';
            echo  
'<input type="checkbox" id="'.$this->id.'" name="'.$this->name.'" value="'.$this->value.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.' />'; phpsu
            break;
        case
'radio':
            
$rAct =  $this->event!=""&&$this->method!="" ? $this->actsJs():'';
            echo  
'<input type="radio" id="'.$this->id.'" name="'.$this->name.'" value="'.$this->value.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.' />'.$this->finLinea; phpsu
            break;
        case
'select':
            
$this->fin == true ? $fin="</select>":$fin="";
            
$rAct =  $this->event!=""&&$this->method!="" ? $this->actsJs():''; phpsu.com is a free phpscool
            echo  
'<select id="'.$this->id.'" name="'.$this->name.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.'>'; phpsu提供的php教程
            break;
        case
'option':
            echo  
'<option id="'.$this->id.'" value="'.$this->value.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.'>'.$this->texto.'</option>'.$fin; www.phpsu.com
            break;
        case
'textarea':
            
$rAct =  $this->event!=""&&$this->method!="" ? $this->actsJs():'';
            echo  
'<textarea id="'.$this->id.'" name="'.$this->name.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.'>'.$this->texto.'</textarea>';
welcome to phpsu.com

            break;
        case
'iniform':
            echo
'<form id="'.$this->id.'" name="'.$this->name.'" class="'.$this->class.'" '.$rAct.' method="'.$this->methodform.'" action="'.$this->actionform.'">';

welcome to phpsu.com


            break;
        case
'endform':
            echo
'</form>';
            break;
        case
'img':
            
$rAct =  $this->event!=""&&$this->method!="" ? $this->actsJs():''; phpsu
            echo
'<img id="'.$this->id.'" src="'.$this->img.'" name="'.$this->name.'" class="'.$this->class.'" '.$rAct.' '.$this->extras.' />';
phpsu is a phpschool

            break;
        case
'default':
            echo
"Objecto no encontrado";
            break;
        }    
        
$this->clear();
    }
    
    
//LIMPIAMOS VARIABLES
    
function clear(){
phpsu.com

        unset(
$this->object,$this->id,$this->name,$this->value,$this->class,$this->event,$this->method,$this->extras,$this->text,$this->label,$this->object,$this->size,$this->maxlength);
phpsu

    }

    
//ELEGIMOS EL EVENTO Y LE APLICAMOS EL METODO
    
function actsJs(){
        
$this->actions = array(
        
'load'=>'onLoad="'.$this->method.'"',
        
'uload'=>'onUnload="'.$this->method.'"',

phpsu.com


        
'click'=>'onClick="'.$this->method.'"',
        
'change'=>'onChange="'.$this->method.'"',
        
'submit'=>'onSubmit="'.$this->method.'"', www.phpsu.com
        
'reset'=>'onReset="'.$this->method.'"',
        
'select'=>'onSelect="'.$this->method.'"',
        
'blur'=>'onBlur="'.$this->method.'"', www.phpsu.com
        
'focus'=>'onFocus="'.$this->method.'"',
        
'kd'=>'onKeyDown="'.$this->method.'"',
        
'kp'=>'onKeyPress="'.$this->method.'"', phpsu is a phpschool
        
'ku'=>'onKeyUp="'.$this->method.'"',
        
'dclick'=>'ondblClick="'.$this->method.'"',
        
'md'=>'onMouseDown="'.$this->method.'"', phpsu提供的php教程
        
'mm'=>'onMouseMove="'.$this->method.'"',
        
'mo'=>'onMouseOut="'.$this->method.'"',
        
'mov'=>'onMouseOver="'.$this->method.'"', http://www.phpsu.com
        
'mu'=>'onMouseUp="'.$this->method.'"');
        return
$this->actions[$this->event];
    }
    
    
//CREAMOS SELECT Y OPTIONS
    
function genList($values, $textos, $name, $id="", $class=""){ phpsu.com is a free phpscool
        
$this->clear();
        
$this->name=$name;
        
$this->id=$id;
        
$this->class=$class;
        
        
$this->object('select'); phpsu.com
        while(
$value = current($values)){
            
$texto = current($textos);
            
$this->clear();
            
$this->value = $value; phpsu.com
            
$this->texto = $texto;
            
$value==$values[sizeof($values)-1] ? $this->fin=true:$this->fin=false; phpsu提供的php教程
            
$this->object('option');
            
next($values);
            
next($textos);
        }
        
        
$this->clear();
    } phpsu
    
    
    
//OTROS HTML USADOS CONSTANTE
    
function jsAlert($pMensaje){
        echo
"<script language='javascript'>alert('$pMensaje')</script>";
}

function
jsRedirect($pURL){
    echo
"<script language='javascript'>window.location.href='$pURL'</script>";
}

function
popUp($pURL, $pHeight, $pWidth){ http://www.phpsu.com
    echo
"<script language='javascript'>window.open(URL,'','left=300,top=200,height=".$pHeight.",width=".$pWidth.",toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0');</script>";
}

function
jsBack(){
    echo
"<script language='javascript'>history.back(-1)</script>";    
}

function
jsReload(){
    echo
"<script language='javascript'>window.reload()</script>";    
phpsu.com

}
}
?>

TITLE:Class getHTML.php
Copyright 2008 The PHPsu All rights reserved. This mirror generously provided by: .Hp Inc.
Last updated: Fri Jun 6 22:58:02 GMT-8 2008