コード例 #1
0
ファイル: seccion.php プロジェクト: vallejos/samples
 function Display()
 {
     //Chancho....
     global $db;
     global $ua;
     $html = $this->_loadTemplate();
     $html = str_replace("#CLASS#", $this->extra_class, $html);
     /**
     		  Constantes en el constantes.php de la carpeta wapComponents:
     		  ANCHO_PANTALLA_CHICA
     		  ANCHO_PANTALLA_MEDIANA
     		  ANCHO_PANTALLA_GRANDE
     Constantes en el archivo constantes.php de la carpeta de la WAP:
     		  TIT_SECCION_PADDING  -  Especifica el Padding que tendrá la imagen en ambos lados (especificado en px)
     		  TIT_SECCION_FONT_COLOR - El color de la fuente del titulo, especificado en formato HTML
     		  PREFIX_TITULO_SECCION - Nombre base que tendrán las imagenes para formar la imagen del titulo
     */
     if (GENERAR_IMAGEN_TITULO_SECCION == 1) {
         //Si el titulo lo vamos a generar como una imagen...
         if (miscFunctions::soportaAnchoChico($db, $ua)) {
             $nombre_tam = "chica";
             $tam = ANCHO_PANTALLA_CHICA;
         }
         if (miscFunctions::soportaAnchoMedio($db, $ua)) {
             $nombre_tam = "mediana";
             $tam = ANCHO_PANTALLA_MEDIANA;
         }
         if (miscFunctions::soportaAnchoMayor($db, $ua)) {
             $nombre_tam = "grande";
             $tam = ANCHO_PANTALLA_GRANDE;
         }
         // -- Creamos el titulo
         $width = $tam - TIT_SECCION_PADDING * 2;
         //Le restamos el padding de ambos lados de la imagen
         $nombre_img = str_replace(" ", "_", $this->titulo) . "_" . $nombre_tam . ".gif";
         $nombre_img = str_replace("<", "", $nombre_img);
         $nombre_img = str_replace(">", "", $nombre_img);
         $nombre_img = str_replace("\"", "", $nombre_img);
         $nombre_img = str_replace("\\", "", $nombre_img);
         $nombre_img = str_replace("/", "", $nombre_img);
         $nombre_img = str_replace("=", "", $nombre_img);
         $nombre_img = str_replace("&", "", $nombre_img);
         $nombre_img = str_replace(chr(241), "n", $nombre_img);
         $nombre_img = str_replace(chr(225), "a", $nombre_img);
         $nombre_img = str_replace(chr(233), "e", $nombre_img);
         $nombre_img = str_replace(chr(237), "i", $nombre_img);
         $nombre_img = str_replace(chr(243), "o", $nombre_img);
         $nombre_img = str_replace(chr(250), "u", $nombre_img);
         $nombre_img = str_replace(chr(209), "N", $nombre_img);
         $nombre_img = str_replace(chr(193), "A", $nombre_img);
         $nombre_img = str_replace(chr(201), "E", $nombre_img);
         $nombre_img = str_replace(chr(205), "I", $nombre_img);
         $nombre_img = str_replace(chr(211), "O", $nombre_img);
         $nombre_img = str_replace(chr(218), "U", $nombre_img);
         $nombre_img = str_replace(chr(191), "", $nombre_img);
         $nombre_img = str_replace(chr(63), "", $nombre_img);
         $this->titulo = strip_tags($this->titulo);
         $tit = new Titulo($this->titulo, $width, TIT_SECCION_FONT_COLOR, $nombre_img);
         if ($this->link_titulo !== false) {
             $tit->setUnderline(true);
         }
         $tit->setImages(PREFIX_TITULO_SECCION);
         $img_titulo_src = $tit->getPath();
         $this->img_header = new Imagen($img_titulo_src, $this->titulo);
         if ($this->link_titulo !== false) {
             //Si el titulo es un link, entonces metemos la imagen dentro de un link
             $titulo_seccion = new Link($this->link_titulo, "", $this->img_header->src);
         } else {
             $titulo_seccion = $this->img_header;
         }
         $html = str_replace("#TITULO#", $titulo_seccion->Display(), $html);
         // -- Fin creación del titulo
     } else {
         if ($this->link_titulo !== false) {
             $link = new Link($this->link_titulo, $this->titulo);
             $html = str_replace("#TITULO#", $link->Display(), $html);
         } else {
             $html = str_replace("#TITULO#", $this->titulo, $html);
         }
     }
     $html = str_replace("#ALIGN#", $this->align, $html);
     if ($this->font_size == NORMAL_FONT_SIZE) {
         $html = str_replace("<#SIZE#>", "", $html);
         $html = str_replace("</#SIZE#>", "", $html);
         $html = str_replace("#SIZE#", $this->font_size, $html);
     } else {
         $html = str_replace("#SIZE#", $this->font_size, $html);
     }
     $html_interior = parent::Display();
     $html = str_replace("#COMPONENTES#", $html_interior, $html);
     return $html;
 }
コード例 #2
0
<?php

spl_autoload_register(function ($class) {
    require_once "{$class}.php";
});
$strTitulo = filter_input(INPUT_POST, "txtTitulo");
$strVencimento = filter_input(INPUT_POST, "txtVencimento");
$fltValor = (double) filter_input(INPUT_POST, "txtValor");
$fltJuros = (double) filter_input(INPUT_POST, "txtJuros");
$objTitulo = new Titulo($strTitulo, $strVencimento, $fltValor, $fltJuros);
if (filter_input(INPUT_POST, "btnCalcular")) {
    $objTitulo->calculaParcela();
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Pagamento de Titulos</title>
    </head>
    <body>
        <h1>Pagamento de Titulos</h1>
        <hr>
        <form action="" method="post">
            <table width="267" border="1" cellspacing="1" cellpadding="1">
              <tr>
                <td width="112">Nº do Titulo:</td>
                <td width="144"><input name="txtTitulo" type="text" value="<?php 
echo $strTitulo;
?>
"></td>
コード例 #3
0
<?php

class Titulo
{
    public $codigo, $dt_vencimento, $valor, $juros, $multa;
    public function __call($method, $values)
    {
        print "Você executou o método {$method}, com os parametros: " . implode(',', $values) . "<br>\n";
    }
}
$titulo = new Titulo();
$titulo->codigo = 1;
$titulo->dt_vencimento = '2015-05-20';
$titulo->valor = 12345;
$titulo->juros = 0.1;
$titulo->multa = 2;
$titulo->teste1(1, 2, 3);
$titulo->teste2(4, 5, 6);
コード例 #4
0
<?php

class Titulo
{
    public $codigo, $dt_vencimento, $valor, $juros, $multa;
    public function __call($method, $values)
    {
        return call_user_func($method, get_object_vars($this));
    }
}
$titulo = new Titulo();
$titulo->codigo = 1;
$titulo->dt_vencimento = '2015-05-20';
$titulo->valor = 12345;
$titulo->juros = 0.1;
$titulo->multa = 2;
$titulo->print_r();
print 'A contagem é: ' . $titulo->count();