Example #1
0
 function editar($cp, $tabela)
 {
     $ed = new form();
     $ed->id = $this->id;
     $ed->tabela = $tabela;
     /* Valida botao */
     $bt = 0;
     for ($r = 0; $r < count($cp); $r++) {
         if (UpperCaseSQL(substr($cp[$r][0], 0, 2)) == '$B') {
             $bt = 1;
         }
     }
     if ($bt == 0) {
         array_push($cp, array('$B8', '', msg('submit'), False, False));
     }
     /* Monta forumário */
     $ed->cp = $cp;
     $result = form_edit($ed);
     $t = $result['tela'];
     $this->saved = $result['saved'];
     return $t;
 }
Example #2
0
/**
* @author Rene F. Gabriel Junior <*****@*****.**>
* @copyright © Pan American Health Organization, 2013. All rights reserved.
* @version 0.15.03
* @access public
* @package INCLUDEs
* @subpackage Autor
*/
function nbr_autor($xa, $tp)
{
    if (strpos($xa, ',') > 0) {
        $xb = trim(substr($xa, strpos($xa, ',') + 1, 100));
        $xa = trim(substr($xa, 0, strpos($xa, ',')));
        $xa = trim(trim($xb) . ' ' . $xa);
    }
    $xa = $xa . ' ';
    $xp = array();
    $xx = "";
    for ($qk = 0; $qk < strlen($xa); $qk++) {
        if (substr($xa, $qk, 1) == ' ') {
            if (strlen(trim($xx)) > 0) {
                array_push($xp, trim($xx));
                $xx = '';
            }
        } else {
            $xx = $xx . substr($xa, $qk, 1);
        }
    }
    $xa = "";
    /////////////////////////////
    $xp1 = "";
    $xp2 = "";
    $er1 = array("JUNIOR", "JÚNIOR", "JúNIOR", "NETTO", "NETO", "SOBRINHO", "FILHO", "JR.");
    $xop = 0;
    for ($qk = count($xp) - 1; $qk >= 0; $qk--) {
        $xa = trim($xa . ' - ' . $xp[$qk]);
        if ($xop == 0) {
            $xp1 = trim($xp[$qk] . ' ' . $xp1);
            $xop = -1;
        } else {
            $xp2 = trim($xp[$qk] . ' ' . $xp2);
        }
        if ($xop == -1) {
            $xop = 1;
            for ($kr = 0; $kr < count($er1); $kr++) {
                if (trim(UpperCaseSQL($xp[$qk])) == trim($er1[$kr])) {
                    $xop = 0;
                }
            }
        }
    }
    ////////// 1 e 2
    $xp2a = strtolower($xp2);
    $xa = trim(trim($xp2) . ' ' . trim($xp1));
    if ($tp == 1 or $tp == 2) {
        if ($tp == 1) {
            $xp1 = UpperCase($xp1);
        }
        $xa = trim(trim($xp1) . ', ' . trim($xp2));
        if ($tp == 2) {
            $xa = UpperCaseSQL(trim(trim($xp1) . ', ' . trim($xp2)));
        }
    }
    if ($tp == 3 or $tp == 4) {
        if ($tp == 4) {
            $xa = UpperCaseSQL($xa);
        }
    }
    if ($tp >= 5 or $tp <= 6) {
        $xp2a = str_word_count(lowerCaseSQL($xp2), 1);
        $xp2 = '';
        for ($k = 0; $k < count($xp2a); $k++) {
            if ($xp2a[$k] == 'do') {
                $xp2a[$k] = '';
            }
            if ($xp2a[$k] == 'da') {
                $xp2a[$k] = '';
            }
            if ($xp2a[$k] == 'de') {
                $xp2a[$k] = '';
            }
            if (strlen($xp2a[$k]) > 0) {
                $xp2 = $xp2 . substr($xp2a[$k], 0, 1) . '. ';
            }
        }
        $xp2 = trim($xp2);
        if ($tp == 6) {
            $xa = UpperCaseSQL(trim(trim($xp2) . ' ' . trim($xp1)));
        }
        if ($tp == 5) {
            $xa = UpperCaseSQL(trim(trim($xp1) . ', ' . trim($xp2)));
        }
    }
    ////////////////////////////////////////////////////////////////////////////////////
    if ($tp == 7 or $tp == 8) {
        $mai = 1;
        $xa = strtolower($xa);
        for ($r = 0; $r < strlen($xa); $r++) {
            if ($mai == 1) {
                $xa = substr($xa, 0, $r) . UpperCase(substr($xa, $r, 1)) . substr($xa, $r + 1, strlen($xa));
                $mai = 0;
            } else {
                if (substr($xa, $r, 1) == ' ') {
                    $mai = 1;
                }
            }
        }
        $xa = troca($xa, 'De ', 'de ');
        $xa = troca($xa, 'Da ', 'da ');
        $xa = troca($xa, 'Do ', 'do ');
    }
    return $xa;
}
Example #3
0
 /*  alterado SN no display em 08/10/2007 */
 $bb1 = " busca ";
 global $dd, $base;
 /* T�tulo do Row se existir Label */
 if (strlen($label) > 0) {
     echo '<TABLE width="' . $tab_max . '" cellpadding="2" cellspacing="0">';
     echo '<TR><TD>';
     echo '<font class=lt5>' . $label . '</font>';
     echo '</TD></TR>';
     echo '</TABLE>';
 }
 if (strlen($dd[1]) > 0) {
     if ($base == 'mysql') {
         $where = "upper(" . $dd[2] . ") like '%" . UpperCaseSQL(trim($dd[1])) . "%'";
     } else {
         $where = "upper((" . $dd[2] . ")) like '%" . UpperCaseSQL(trim($dd[1])) . "%'";
     }
 }
 if (strlen($pre_where) > 0) {
     if (strlen($where) > 0) {
         $where = "(" . $pre_where . ") and (" . $where . ") ";
     } else {
         $where = $pre_where;
     }
 }
 /* Calcula total de registro */
 $total = 0;
 $xsql = "select count(*) as total from " . $tabela . " ";
 if (strlen($where) > 0) {
     $xsql = $xsql . ' where ' . $where;
 }