Example #1
0
 function mostra_page($id)
 {
     $sx = '';
     $sql = "select * from " . $this->tabela . " where id_msg = " . sonumero($id);
     $rlt = db_query($sql);
     $line = db_read($rlt);
     $pag = $line['msg_pag'];
     $pag_array = unserialize($pag);
     for ($r = 0; $r < count($pag_array); $r++) {
         $sx .= $pag_array[$r] . '<br>';
     }
     return $sx;
 }
Example #2
0
function dv($nrv)
{
    $to = 0;
    $nrv = trim(sonumero($nrv));
    $trv = round(strlen($nrv));
    for ($tr = 0; $tr < $trv; $tr++) {
        $ttr1 = $tr / 2;
        $ttr2 = round($tr / 2);
        if ($ttr1 == $ttr2) {
            $to = $to + round(substr($nrv, $tr, 1));
        } else {
            $to = $to + round(substr($nrv, $tr, 1)) * 7;
        }
    }
    while ($to > 10) {
        $to = $to - 10;
    }
    return $to;
}
Example #3
0
 function le($id = '')
 {
     if (strlen($id) > 0) {
         $this->id_cep = $id;
     }
     $sql = "select * from " . $this->tabela . " ";
     $sql .= " left join usuario on us_codigo = cep_pesquisador ";
     $sql .= " left join ajax_pais on us_country = pais_codigo ";
     $sql .= " left join cep_status on cep_status = ess_status ";
     $sql .= " where id_cep = " . sonumero("0" . $this->id_cep);
     $rlt = db_query($sql);
     $line = db_read($rlt);
     $this->line = $line;
     $this->protocolo = trim($this->line['cep_protocol']);
     $this->codigo = $this->line['cep_codigo'];
     $this->status = $this->line['cep_status'];
     $this->cep_dictamen = $this->line['cep_dictamen'];
     $this->protocolo_submission = $this->line['cep_fr'];
     $this->caae = trim($line['cep_caae']);
     return 1;
 }
Example #4
0
File: ici.php Project: GCPUCPR/CsF
 function index()
 {
     $this->load->database();
     $this->load->library('session');
     $this->lang->load("app", "portuguese");
     $this->load->model('geds');
     $this->load->helper('form_sisdoc');
     $this->load->model('projects_ici');
     $this->geds->tabela = 'ici_geds';
     /* Dados Post */
     $dd1 = $this->input->post('dd1');
     $dd11 = $this->input->post('dd11');
     $dd2 = $this->input->post('dd2');
     $dd21 = $this->input->post('dd21');
     $dd22 = $this->input->post('dd22');
     $dd23 = $this->input->post('dd23');
     $dd24 = $this->input->post('dd24');
     $dd25 = $this->input->post('dd25');
     $dd3 = $this->input->post('dd3');
     $dd4 = $this->input->post('dd4');
     $data['title_page'] = 'IC Internacional';
     $data['menu'] = 0;
     $this->load->view('header/header');
     $this->load->view('header/cab', $data);
     $this->load->view('header/content_open');
     $data['logo'] = base_url('img/logo/logo_ici.png');
     $this->load->view('header/logo', $data);
     $ok = $this->projects_ici->valida_e_salva();
     $dd21 = $this->input->post('dd21');
     $dd4 = $this->input->post('dd4');
     $sql = "select * from pibic_aluno where pa_cracha = '" . $dd21 . "' ";
     $rlt = $this->db->query($sql);
     $rlt = $rlt->result_array($rlt);
     if (count($rlt) > 0) {
         $line = $rlt[0];
         $data['nome_aluno'] = $line['pa_nome'];
     } else {
         $data['nome_aluno'] = '';
     }
     $autor = $this->session->userdata('cracha');
     $protocolo = sonumero($this->projects_ici->recupera_codigo_em_submissao($autor));
     $post = array('protocolo' => $protocolo, 'dd1' => $dd1, 'dd11' => $dd11, 'dd2' => $dd2, 'dd21' => $dd21, 'dd22' => $dd22, 'dd23' => $dd23, 'dd24' => $dd24, 'dd25' => $dd25, 'dd3' => $dd3);
     $data = array_merge($data, $post);
     if ($ok == 1) {
         $autor = $this->session->userdata('cracha');
         $this->projects_ici->insere_novo_projeto();
         if ($dd4 == 'OK') {
             $this->load->view('ici/submit_03', $data);
         } else {
             $this->load->view('ici/submit_02', $data);
         }
     } else {
         $this->load->view('ici/submit_01', $data);
     }
 }
Example #5
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 #6
0
    function form_field($cp, $vlr)
    {
        global $dd, $ddi;
        /* Zera tela */
        $tela = '';
        $table = 1;
        if (!isset($dd)) {
            $dd = array();
            $ddi = 0;
        }
        $type = $cp[0];
        $label = $cp[2];
        $required = $cp[3];
        $placeholder = $label;
        $readonly = $cp[4];
        $tt = substr($type, 1, 1);
        /* exessoes */
        if (substr($type, 0, 4) == '$MES') {
            $tt = 'MES';
        }
        if (substr($type, 0, 3) == '$SW') {
            $tt = 'SW';
        }
        if (substr($type, 0, 3) == '$HV') {
            $tt = 'HV';
        }
        if (substr($type, 0, 5) == '$LINK') {
            $tt = 'LINK';
        }
        if (substr($type, 0, 3) == '$AA') {
            $tt = 'AA';
        }
        /* form */
        $max = 100;
        $size = 100;
        $dados = array();
        $dn = 'dd' . $ddi;
        if ($table == 1) {
            $td = '<td>';
            $tdl = '<td align="right">';
            $tdn = '</td>';
            $tr = '<tr valign="top">';
            $trn = '</tr>';
        } else {
            $td = '';
            $tdl = '';
            $tdn = '';
            $tr = '';
            $trn = '';
        }
        //$dados = array('name'=>'dd'.$ddi, 'id'=>'dd'.$ddi,'value='.$dd[$ddi],'maxlenght'=>$max,'size'=>$size,$class=>'');
        switch ($tt) {
            case '{':
                $tela .= $tr;
                $tela .= '<td colspan=2>';
                $tela .= '<fieldset class="border1"><legend class="lt3 bold">' . $label . '</legend>';
                $tela .= '<table width="100%" class="tabela00">';
                break;
            case '}':
                $tela .= '</table>';
                $tela .= '</fieldset>';
                $tela .= '</td></tr>';
                $tela .= '<table width="100%" id="row">';
                $tela .= '</td></tr>';
                break;
                /* Select Box */
            /* Select Box */
            case '[':
                $ntype = trim(substr($type, 2, strlen($type)));
                $n1 = substr($ntype, 0, strpos($ntype, '-'));
                $n2 = sonumero(substr($ntype, strpos($ntype, '-'), strlen($ntype)));
                $n3 = substr($ntype, strlen($ntype) - 1, 1);
                $options = array('' => '::select an option::');
                if ($n3 != 'D') {
                    /* Crescente */
                    for ($r = $n1; $r <= $n2; $r++) {
                        $options[$r] = $r;
                    }
                } else {
                    /* Descrecente */
                    for ($r = $n2; $r >= $n1; $r--) {
                        $options[$r] = $r;
                    }
                }
                /* recupera dados */
                $dados = array('name' => $dn, 'id' => $dn, 'size' => 1, 'class' => 'form_select');
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $tela .= '<TD>';
                $tela .= form_dropdown($dados, $options, $vlr);
                break;
                /* Select Box - Autocomplete*/
            /* Select Box - Autocomplete*/
            case 'AA':
                $ntype = trim(substr($type, 2, strlen($type)));
                $ntype = troca($ntype, ':', ';') . ';';
                $param = splitx(';', $ntype);
                /* TR da tabela */
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                /* **/
                $dados = array('name' => $dn . 'a', 'id' => $dn . 'a', 'value' => $vlr, 'maxlenght' => $max, 'size' => $size, 'placeholder' => $label, 'class' => 'form_string', 'autocomplete' => 'on');
                $tela .= $td . form_input($dados);
                $dados = array('name' => $dn, 'id' => $dn, 'value' => $vlr, 'maxlenght' => $max, 'size' => 10, 'placeholder' => $label, 'class' => 'form_string', 'autocomplete' => 'on');
                if ($readonly == false) {
                    $dados['readonly'] = 'readonly';
                }
                $tela .= form_input($dados);
                $tela .= $tdn . $trn;
                $tela .= '
				<script>
					$(function(){
						var $sfield = $("#' . $dn . 'a").autocomplete({
							source: function(request, response){
								var url = "' . base_url("index.php/instituicao/autocomplete?term=") . '" + $("#' . $dn . 'a").val();
								$.get(url, {}, 
									function(data)
									{
									response($.map(data, function(rlt) 
										{
											return { label: rlt.nome, value: rlt.id };
										}));
									}, "json");
								}, 
                        select: function( event, ui ) {
                            $( "#' . $dn . 'a" ).val( ui.item.label );
                            $( "#' . $dn . '" ).val( ui.item.value );
                            return false;
							} ,	minLength: 4, autofocus: true });
						});
				</script>
				';
                break;
                /* Button */
            /* Button */
            case 'B':
                $tela .= $tr . $tdl . $td;
                $dados = array('name' => 'acao', 'id' => 'acao', 'value' => $label, 'class' => 'form_submit');
                $tela .= form_submit($dados);
                $tela .= $tdn . $trn;
                break;
            case 'C':
                /* TR da tabela */
                $tela .= $tr;
                $dados = array('name' => $dn, 'id' => $dn, 'value' => '1', 'class' => 'onoffswitch-checkbox');
                if ($readonly == false) {
                    $dados['readonly'] = 'readonly';
                }
                $tela .= '<td align="right">' . form_checkbox($dados, 'accept', $vlr);
                /* label */
                if (strlen($label) > 0) {
                    $tela .= '<td>' . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $tela .= $tdn . $trn;
                break;
                /* Oculto */
            /* Oculto */
            case 'H':
                $dados = array($dn => $vlr);
                $tela .= form_hidden($dados);
                break;
            case 'HV':
                $vlr = $cp[2];
                $dados = array($dn => $vlr);
                $tela .= '<input type="hidden" name="' . $dn . '" id="' . $dn . '" value="' . $vlr . '">' . cr();
                break;
                /* Select Box - Mes */
            /* Select Box - Mes */
            case 'MES':
                $options = array('' => '::select an option::');
                /* recupera dados */
                for ($r = date("Y") + 4; $r > 1990; $r--) {
                    $vlra = $r;
                    $options[$vlra] = '===' . $r . '===';
                    //array_push($options,array('2019'));
                    $ar = array();
                    for ($y = 12; $y > 0; $y--) {
                        $vlrs = $r . strzero($y, 2) . '01';
                        $cpt = $r . '/' . msg('mes_' . strzero($y, 2));
                        $op = array($vlr => $cpt);
                        $ar[$vlrs] = $cpt;
                        //array_push($options,$op);
                    }
                    $options[$vlra] = $ar;
                }
                $dados = array('name' => $dn, 'id' => $dn, 'size' => 1, 'class' => 'form_select');
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                if (strlen($vlr) == 0) {
                    $vlr = date("Ym") . '01';
                } else {
                    $vlr = sonumero($vlr);
                }
                $tela .= '<TD>';
                $tela .= form_dropdown($dados, $options, $vlr);
                break;
                /* Select Box */
            /* Select Box */
            case 'O':
                $ntype = trim(substr($type, 2, strlen($type)));
                $ntype = troca($ntype, '&', ';') . ';';
                $param = splitx(';', $ntype);
                $options = array('' => '::select an option::');
                for ($r = 0; $r < count($param); $r++) {
                    if (count(trim($param[$r])) > 0) {
                        $nterm = splitx(':', $param[$r] . ':');
                        $key = $nterm[0];
                        $valor = $nterm[1];
                        $options[$key] = $valor;
                    }
                }
                /* recupera dados */
                $dados = array('name' => $dn, 'id' => $dn, 'size' => 1, 'class' => 'form_select');
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $tela .= '<TD>';
                $tela .= form_dropdown($dados, $options, $vlr);
                break;
                /* Select Box */
            /* Select Box */
            case 'Q':
                $ntype = trim(substr($type, 2, strlen($type)));
                $ntype = troca($ntype, ':', ';') . ';';
                $param = splitx(';', $ntype);
                $options = array('' => '::select an option::');
                /* recupera dados */
                $sql = "select * from (" . $param[2] . ") as tabela order by " . $param[1];
                $CI =& get_instance();
                $query = $CI->db->query($sql);
                foreach ($query->result_array() as $row) {
                    /* recupera ID */
                    $flds = trim($param[0]);
                    $vlrs = trim($param[1]);
                    $flds = $row[$flds];
                    $vlrs = $row[$vlrs];
                    $options[$flds] = $vlrs;
                }
                $dados = array('name' => $dn, 'id' => $dn, 'size' => 1, 'class' => 'form_select');
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $tela .= '<TD>';
                $tela .= form_dropdown($dados, $options, $vlr);
                break;
                /* String */
            /* String */
            case 'R':
                $ntype = trim(substr($type, 2, strlen($type)));
                $ntype = troca($ntype, '&', ';') . ';';
                $param = splitx(';', $ntype);
                $form = '<table width="100%" border=0>';
                for ($r = 0; $r < count($param); $r++) {
                    if (count(trim($param[$r])) > 0) {
                        $nterm = splitx(':', $param[$r] . ':');
                        $key = $nterm[0];
                        $valor = $nterm[1];
                        $options[$key] = $valor;
                        $checked = false;
                        if ($key == $vlr) {
                            $checked = true;
                        }
                        $dados = array('name' => $dn, 'id' => $dn, 'value' => $key, 'class' => 'form_select', 'checked' => $checked);
                        $form .= '<tr valign="top"><td>' . form_radio($dados) . '</td>';
                        $form .= '<td class="form_radio">' . $valor . '</td>';
                        $form .= '</tr>';
                    }
                }
                $form .= '</table>';
                /* recupera dados */
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $tela .= '<TD>';
                //$tela .= form_radio($dados, $options, $vlr);
                $tela .= $form;
                break;
                /* String */
            /* String */
            case 'D':
                /* TR da tabela */
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $dados = array('name' => $dn, 'id' => $dn, 'value' => $vlr, 'maxlenght' => 12, 'size' => 12, 'placeholder' => $label, 'class' => 'form_string date');
                if ($readonly == false) {
                    $dados['readonly'] = 'readonly';
                }
                $tela .= $td . form_input($dados) . ' (dd/mm/yyyy)';
                $tela .= $tdn . $trn;
                $tela .= '
				  <script>
				  $(function() {
				    $( "#' . $dn . '" ).datepicker();
				  });
				  </script>
				';
                break;
                /* String */
            /* String */
            case 'LINK':
                /* TR da tabela */
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $dados = array('name' => $dn, 'id' => $dn, 'value' => $vlr, 'maxlenght' => $max, 'size' => $size, 'placeholder' => $label, 'class' => 'form_string');
                if ($readonly == false) {
                    $dados['readonly'] = 'readonly';
                }
                $tela .= $td . form_input($dados);
                $tela .= $tdn . $trn;
                break;
            case 'M':
                /* TR da tabela */
                $tela .= $tr;
                /* label */
                $tela .= '<td colspan=2>' . '<span class="lt1">' . $label . '</span>';
                $tela .= $tdn . $trn;
                break;
                /* form_number */
            /* form_number */
            case 'N':
                /* TR da tabela */
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $dados = array('name' => $dn, 'id' => $dn, 'value' => $vlr, 'maxlenght' => 15, 'size' => 15, 'placeholder' => $label, 'class' => 'form_string money');
                if ($readonly == false) {
                    $dados['readonly'] = 'readonly';
                }
                $tela .= $td . form_input($dados);
                $tela .= $tdn . $trn;
                break;
                /* String */
            /* String */
            case 'S':
                /* TR da tabela */
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $size = sonumero($type);
                $dados = array('name' => $dn, 'id' => $dn, 'value' => $vlr, 'maxlenght' => $max, 'size' => $size, 'placeholder' => $label, 'class' => 'form_string');
                if ($readonly == false) {
                    $dados['readonly'] = 'readonly';
                }
                $tela .= $td . form_input($dados);
                $tela .= $tdn . $trn;
                break;
            case 'SW':
                /* TR da tabela */
                $tela .= $tr;
                $checked = False;
                /* label */
                $tela .= ' <td class="lt4" colspan=2>
						<table>
							<tr>
								<td>
								<div class="onoffswitch">
									';
                /* cehcked */
                if (trim($vlr) == '1') {
                    $checked = True;
                }
                /* Monta lista */
                $data = array('name' => $dn, 'checked' => $checked, 'class' => 'onoffswitch-checkbox', 'id' => $dn, 'value' => '1');
                $tela .= form_checkbox($data);
                $tela .= ' <label class="onoffswitch-label" for="' . $dn . '"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label>
								</div></td><td class="lt2"> ' . $label . ' </td>
							</tr>
						</table></td></tr>';
                break;
                /* Update */
            /* Update */
            case 'U':
                if (round($vlr) == 0) {
                    $vlr = date("Y-m-d");
                }
                $dados = array($dn => $vlr);
                $tela .= form_hidden($dados);
                break;
                /* Textarea */
            /* Textarea */
            case 'T':
                $ntype = trim(substr($type, 2, strlen($type)));
                $ntype = troca($ntype, ':', ';') . ';';
                $param = splitx(';', $ntype);
                /* TR da tabela */
                $tela .= $tr;
                /* label */
                if (strlen($label) > 0) {
                    $tela .= $tdl . $label . ' ';
                }
                if ($required == 1) {
                    $tela .= ' <font color="red">*</font> ';
                }
                $data = array('name' => $dn, 'id' => $dn, 'value' => $vlr, 'rows' => $param[1], 'cols' => $param[0], 'class' => 'form_textarea');
                $tela .= $td . form_textarea($data);
                $tela .= $tdn . $trn;
                break;
                /* Password */
            /* Password */
            case 'P':
                if (strlen($label) > 0) {
                    $tela .= $label . ' ';
                }
                $dados = array('name' => $dn, 'id' => $dn, 'value' => $vlr, 'maxlenght' => $max, 'size' => $size);
                $tela .= form_password($dados);
                break;
        }
        $ddi++;
        return $tela;
    }
Example #7
0
function stodbr($data = 0)
{
    $data = sonumero($data);
    if ($data < 19100101) {
        return '';
    } else {
        $dt = substr($data, 6, 2) . '/' . substr($data, 4, 2) . '/' . substr($data, 0, 4);
        return $dt;
    }
}