Example #1
0
    function process($cp)
    {
        global $dd, $acao, $ged, $http;
        /* Caixa Alta */
        $i = UpperCaseSql(substr($cp[0], 1, 5));
        if (strpos($i, ' ') > 0) {
            $i = substr($i, 0, strpos($i, ' '));
        }
        /* Transfere parametros */
        $this->required = $cp[3];
        $this->caption = $cp[2];
        $this->caption_original = $cp[2];
        $placeholder = troca($cp[2], '"', '');
        if (strpos($placeholder, '<') > 0) {
            $placeholder = substr($placeholder, 0, strpos($placeholder, '<'));
        }
        $this->caption_placeholder = $placeholder;
        $this->fieldset = $cp[1];
        $size = sonumero($cp[0]);
        $this->maxlength = $size;
        $this->caption = $cp[2];
        $ro = UpperCaseSql($cp[4]);
        /* Read Only */
        if ($ro == 'FALSE' or $ro == '0' or strlen($ro) == '0') {
            $this->readonly = ' READONLY ';
        } else {
            $this->readonly = '';
        }
        if (strlen(trim($acao)) > 0 and $this->required == 1 and strlen(trim($this->value)) == 0) {
            $this->caption = '<font color="red">' . $this->caption . '</font>';
        }
        if ($size > 80) {
            $size = 80;
        }
        $this->size = $size;
        $i = troca($i, '&', '');
        $i = troca($i, ':', '');
        $sn = sonumero($i);
        $i = troca($i, $sn, '');
        //echo '['.$i.']';
        if (substr($i, 0, 1) == 'T' and $i != 'TOKEN') {
            $i = 'T';
        }
        if (substr($i, 0, 1) == '[') {
            $i = '[';
        }
        if (empty($sx)) {
            $sx = '';
        }
        $sx .= chr(13) . '<TR valign="top">';
        $sh = '<TD align="right" width="10%">' . $this->caption . '<TD>';
        if (strlen(trim($this->caption_original)) == 0) {
            $sh = '<TD colspan=2 align="left">';
        }
        if (substr($i, 0, 1) == 'T') {
            //$sh = '<TD colspan=2 align="right">';
            $sh .= $this->caption;
        }
        switch ($i) {
            /* Field Sets */
            case '{':
                $sx .= $this->type_open_field();
                break;
            case '}':
                $sx .= $this->type_close_field();
                break;
                /* Sequencial */
            /* Sequencial */
            case '[':
                $this->par = substr($cp[0], 2, strlen($cp[0]));
                $sx .= $sh . $this->type_seq();
                break;
            case 'AJAX':
                $sx .= '<TR><TD colspan=2>' . $this->type_ajax();
                break;
            case 'AUTOR':
                $sx .= '<TR><TD colspan=2>' . $this->type_Autor();
                break;
                /* Caption */
            /* Caption */
            case 'A':
                $sx .= '<TR><TD colspan=2>' . $this->type_A();
                break;
                /* Alert */
            /* Alert */
            case 'ALERT':
                $sx .= '<TR><TD><TD colspan=1>' . $this->type_ALERT();
                break;
                /* Button */
            /* Button */
            case 'B':
                $sx .= '<TD colspan=2 >' . $this->type_B();
                break;
                /* City, State, Country */
            /* City, State, Country */
            case 'CITY':
                $sx .= $sh . $this->type_City();
                break;
                /* Declaracao */
            /* Declaracao */
            case 'DECLA':
                $sx .= $this->type_DECLA();
                break;
                /* Checkbox */
            /* Checkbox */
            case 'C':
                $sx .= '<TR><TD colspan=2>' . $this->type_C() . $this->caption;
                break;
                /* Checkbox */
            /* Checkbox */
            case 'CAPTC':
                $sx .= '<TR><TD><TD colspan=1>' . $this->caption . '<BR>' . $this->type_captcha() . '<BR>';
                $sx .= '
									<input 
										type="text" name="' . $this->name . '" 
										value = ""
										maxlength="8" 
										class="' . $this->class_captcha . '" 
										id="' . $this->name . '"
										placeholder="' . $this->caption_placeholder . '"
										' . $this->readonly . ' ' . $style . '
					 					/>' . chr(13);
                $sx .= $this->requerido();
                break;
                /* Date */
            /* Date */
            case 'D':
                $sx .= $sh . $this->type_D();
                break;
                /* EAN13 */
            /* EAN13 */
            case 'EAN':
                $sx .= $sh . $this->type_EAN(0);
                break;
                /* EMAIL */
            /* EMAIL */
            case 'EMAIL':
                $sx .= $sh . $this->type_EMAIL(0);
                break;
            case 'EMAIL_UNIQUE':
                $sx .= $sh . $this->type_EMAIL(1);
                break;
                /* Funcoes adicionais */
            /* Funcoes adicionais */
            case 'FC':
                $this->par = substr($cp[0], 3, strlen($cp[0]));
                if ($this->par == '001') {
                    $sx .= function_001();
                }
                if ($this->par == '002') {
                    $sx .= function_002();
                }
                if ($this->par == '003') {
                    $sx .= function_003();
                }
                if ($this->par == '004') {
                    $sx .= function_004();
                }
                if ($this->par == '005') {
                    $sx .= function_005();
                }
                if ($this->par == '006') {
                    $sx .= function_006();
                }
                if ($this->par == '007') {
                    $sx .= function_007();
                }
                if ($this->par == '008') {
                    $sx .= function_008();
                }
                if ($this->par == '009') {
                    $sx .= function_009();
                }
                if ($this->par == '010') {
                    $sx .= function_010();
                }
                if ($this->par == '011') {
                    $sx .= function_011();
                }
                break;
                /* Files */
            /* Files */
            case 'FILES':
                $sx .= '<TD>';
                $sx .= $ged->file_list();
                $sx .= $ged->upload_botton_with_type($ged->protocolo, '', '');
                break;
                /* KeyWord */
            /* KeyWord */
            case 'KEYWO':
                $sx .= $sh . $this->type_KEYWORDS();
                break;
                /* Hidden */
            /* Hidden */
            case 'H':
                $sx .= $this->type_H();
                break;
                /* Hidden with value */
            /* Hidden with value */
            case 'HV':
                $sx .= $this->type_HV();
                break;
                /* Inteiro */
            /* Inteiro */
            case 'I':
                $sx .= $sh . $this->type_I();
                break;
                /* MEnsagens */
            /* MEnsagens */
            case 'M':
                $sx .= $this->type_M();
                break;
                /* Valor com dias casas */
            /* Valor com dias casas */
            case 'N':
                $sx .= $sh . $this->type_N();
                break;
                /* Options */
            /* Options */
            case 'O':
                $this->par = substr($cp[0], 2, strlen($cp[0]));
                $sx .= $sh . $this->type_O();
                break;
                /* String Simple */
            /* String Simple */
            case 'P':
                $sx .= $sh . $this->type_P();
                break;
                /* Query */
            /* Query */
            case 'Q':
                $this->par = splitx(':', substr($cp[0], 2, strlen($cp[0])));
                $sx .= $sh . $this->type_Q();
                break;
                /* Radio box */
            /* Radio box */
            case 'R':
                $this->par = substr($cp[0], 2, strlen($cp[0]));
                $sx .= '<TD colspan=2 >' . $this->caption . ': ' . $this->type_R();
                break;
                /* String Simple */
            /* String Simple */
            case 'S':
                $sx .= $sh . $this->type_S();
                break;
                /* Text area */
            /* Text area */
            case 'T':
                $this->cols = sonumero(substr($cp[0], 0, strpos($cp[0], ':')));
                $this->rows = sonumero(substr($cp[0], strpos($cp[0], ':'), 100));
                $sx .= '<TD align="right">' . $this->caption . '<TD>' . $this->type_T();
                break;
                /* String Simple */
            /* String Simple */
            case 'TOKEN':
                $sx .= $this->type_TOKEN();
                break;
                /* String Ajax */
            /* String Ajax */
            case 'SA':
                $sx .= $sh . $this->type_SA();
                break;
                /* Update */
            /* Update */
            case 'U':
                $sx .= $sh . $this->type_U();
                break;
                /* Estados */
            /* Estados */
            case 'UF':
                $sx .= $sh . $this->type_UF();
                break;
            case 'RT':
                /* Editor de texto rico (Rich Text) */
            /* Editor de texto rico (Rich Text) */
            case 'ARV':
                /* Arvore com checkboxes */
            /* Arvore com checkboxes */
            case 'ATAGS':
                /* Textarea com autocomplete de tags */
                $params = $this->_cp_get_params($cp);
                $sx .= $sh . call_user_func_array(array(&$this, 'type_' . $i), $params);
                break;
        }
        return $sx;
    }
Example #2
0
 function search_by_word($field, $words)
 {
     $wd = UpperCaseSql($words);
     $wd = troca($wd, ' ', ';') . ';';
     $wd = splitx(';', $wd);
     $wh = '';
     for ($r = 0; $r < count($wd); $r++) {
         /* recupera word do termo */
         $term = $wd[$r];
         if ($r > 0) {
             $wh .= ' and ';
         }
         $wh .= " ({$field}  like '%{$term}%') ";
     }
     return $wh;
 }
Example #3
0
function LowerCaseSQL($term)
{
    $term = UpperCaseSql($term);
    $term = Strtolower($term);
    return $term;
}