Exemplo n.º 1
0
 public static function editar($base)
 {
     $idioma = "";
     $pode_img = true;
     $id = addslashes($_GET['id']);
     $where = array('ID' => $id);
     $tabela = self::$tabela;
     $db_serv = $base->seleciona(self::$tabela, $where, null);
     $where = json_encode($where);
     $ln = $db_serv[0];
     $img_atual = !empty($ln->foto) ? "../uploads/" . self::$tabela . "/" . $ln->foto : "";
     $form = new WGform();
     $form::$nome = 'formulario';
     $form::$action = 'io/update.php';
     $form::$method = "POST";
     $form::$html_botao = "<br>" . html_upload_foto(self::$largura, self::$altura, self::$tamnaho_k_bytes, $img_atual) . "<br><button type='submit' class='btn btn-primary'> SALVAR </button>";
     $form::$ajax = array('enviado_redireciona', 'erro', 'antes_enviar', 'completo');
     $paramtros_obj = array();
     /*CAMPOS*/
     /*campo 'tabela' obrigatorio */
     $paramtros_obj['tabela'] = $form::index(array('tipo' => 5, 'campo' => 'tabela', 'valor' => base64_encode($tabela)));
     $paramtros_obj['where'] = $form::index(array('tipo' => 5, 'campo' => 'where', 'valor' => base64_encode($where)));
     /* capos relativos ao metodo cria_tebelas */
     html_botao_add_refresh_lista(self::$tabela, adiciona_ao_get(array('op' => "novo")));
     echo $form::formulario($paramtros_obj);
 }
Exemplo n.º 2
0
 public static function editar($base)
 {
     $idioma = "";
     $pode_img = true;
     if (!empty($_GET['lang'])) {
         $pode_img = false;
         $id = addslashes($_GET['id']);
         $lang = addslashes($_GET['lang']);
         $tabela = self::$tabela . "_traducao";
         $where = array('sigla_idioma' => $lang, 'id_' . self::$tabela => $id);
         $db_serv = $base->seleciona($tabela, $where, null);
         if ($db_serv) {
             $ln = $db_serv[0];
         } else {
             $db_idiom = $base->seleciona('idiomas', array('sigla' => $lang, 'status' => 1), null);
             if ($db_idiom) {
                 $base->inserir($tabela, $where);
                 $db_serv = $base->seleciona($tabela, $where, null);
             } else {
                 $db_serv = $base->seleciona($tabela, $where, null);
             }
             $ln = $db_serv[0];
         }
         $where = json_encode($where);
     } else {
         $id = addslashes($_GET['id']);
         $where = array('ID' => $id);
         $tabela = self::$tabela;
         $db_serv = $base->seleciona(self::$tabela, $where, null);
         $where = json_encode($where);
         $ln = $db_serv[0];
     }
     $img_atual = !empty($ln->foto) ? "../uploads/" . self::$tabela . "/" . $ln->foto : "";
     $form = new WGform();
     $form::$nome = 'formulario';
     $form::$action = 'io/update.php';
     $form::$method = "POST";
     if ($pode_img) {
         $form::$html_botao = html_upload_foto(self::$largura, self::$altura, self::$tamnaho_k_bytes, $img_atual) . "<br><button type='submit' class='btn btn-primary'> SALVAR </button>";
     } else {
         $form::$html_botao = "<br><button type='submit' class='btn btn-primary'> SALVAR </button>";
     }
     $form::$ajax = array('enviado_redireciona', 'erro', 'antes_enviar', 'completo');
     $paramtros_obj = array();
     /*CAMPOS*/
     /*campo 'tabela' obrigatorio */
     $paramtros_obj['tabela'] = $form::index(array('tipo' => 5, 'campo' => 'tabela', 'valor' => base64_encode($tabela)));
     $paramtros_obj['where'] = $form::index(array('tipo' => 5, 'campo' => 'where', 'valor' => base64_encode($where)));
     /* capos relativos ao metodo cria_tebelas */
     $paramtros_obj['nome_treinameto'] = $form::index(array('tipo' => 0, 'campo' => 'nome_treinameto', 'label' => true, 'titulo' => 'Nome do Treinamento', 'html_depois' => '<br>', 'valor' => $ln->nome_treinameto));
     $paramtros_obj['descricao'] = $form::index(array('tipo' => 1, 'campo' => 'descricao', 'label' => true, 'titulo' => 'Descricao', 'css_class' => 'form-control', 'id' => 'editor_area', 'valor' => $ln->descricao));
     html_botao_add_refresh_lista(self::$tabela, adiciona_ao_get(array('op' => "novo")));
     echo $form::formulario($paramtros_obj);
 }
Exemplo n.º 3
0
            $ln = $db_tex[0];
        }
    }
} else {
    $tipo = false;
}
if (!empty($ln)) {
    html_lista_idiomas();
    html_topo_pagina('Texto:' . ucfirst($ln->tipo));
    $form = new WGform();
    $img_atual = !empty($ln->foto) ? "../uploads/textos/" . $ln->foto : "";
    $form::$nome = 'formulario';
    $form::$action = 'io/update.php';
    $form::$method = "POST";
    if ($img_atual) {
        $form::$html_botao = html_upload_foto($largura, $altura, $tamnaho_k_bytes, $img_atual) . "<br><button type='submit' class='btn btn-primary'> SALVAR </button>";
    } else {
        $form::$html_botao = "<br><button type='submit' class='btn btn-primary'> SALVAR </button>";
    }
    $form::$ajax = array('enviado_redireciona', 'erro', 'antes_enviar', 'completo');
    $paramtros_obj = array();
    /*CAMPOS*/
    /*campo 'tabela' obrigatorio */
    $paramtros_obj['tabela'] = $form::index(array('tipo' => 5, 'campo' => 'tabela', 'valor' => base64_encode('textos')));
    $paramtros_obj['where'] = $form::index(array('tipo' => 5, 'campo' => 'where', 'valor' => base64_encode($up_where)));
    /* capos relativos ao metodo cria_tebelas */
    $paramtros_obj['titulo'] = $form::index(array('tipo' => 0, 'campo' => 'titulo', 'label' => true, 'titulo' => 'Titulo', 'html_depois' => '<br>', 'valor' => $ln->titulo));
    $paramtros_obj['texto'] = $form::index(array('tipo' => 1, 'campo' => 'texto', 'label' => true, 'titulo' => 'Descricao', 'css_class' => 'form-control', 'id' => 'editor_area', 'valor' => $ln->texto));
    echo $form::formulario($paramtros_obj);
} else {
    if (NIVEL_USUARIO == 5) {
Exemplo n.º 4
0
 public static function editar_produto($base)
 {
     $id = addslashes($_GET['id']);
     $where = array('ID' => $id);
     $tabela = self::$tabela;
     $db_serv = $base->seleciona(self::$tabela, $where, null);
     $where = json_encode($where);
     $ln = $db_serv[0];
     $img_atual = !empty($ln->foto) ? "../uploads/" . self::$tabela . "/" . $ln->foto : "";
     $categorias = $base->seleciona(self::$tabela_categorias, null, array('ID', 'nome'));
     $lista_categorias = array();
     foreach ($categorias as $v) {
         if ($ln->id_categoria) {
             $lista_categorias['@' . $v->ID] = $v->nome;
         } else {
             $lista_categorias[$v->ID] = $v->nome;
         }
     }
     $form = new WGform();
     $form::$nome = 'formulario';
     $form::$action = 'io/update.php';
     $form::$method = "POST";
     $form::$html_botao = "<br>" . html_upload_foto(self::$largura, self::$altura, self::$tamnaho_k_bytes, $img_atual) . "<br><button type='submit' class='btn btn-primary'> EDITAR </button>";
     $form::$ajax = array('enviado_redireciona', 'erro', 'antes_enviar', 'completo');
     $paramtros_obj = array();
     /*CAMPOS*/
     /*campo 'tabela' obrigatorio */
     $paramtros_obj['tabela'] = $form::index(array('tipo' => 5, 'campo' => 'tabela', 'valor' => base64_encode($tabela)));
     $paramtros_obj['where'] = $form::index(array('tipo' => 5, 'campo' => 'where', 'valor' => base64_encode($where)));
     /* capos relativos ao metodo cria_tebelas */
     $paramtros_obj['nome'] = $form::index(array('tipo' => 0, 'campo' => 'nome', 'label' => true, 'html_depois' => '<br>', 'titulo' => 'Nome', 'obrigatorio' => true, 'valor' => $ln->nome));
     $paramtros_obj['preco'] = $form::index(array('tipo' => 0, 'campo' => 'preco', 'label' => true, 'html_depois' => '<br>', 'titulo' => 'Preco', 'valor' => $ln->preco));
     $paramtros_obj['peso'] = $form::index(array('tipo' => 0, 'campo' => 'peso', 'label' => true, 'html_depois' => '<br>', 'titulo' => 'Peso gramas.', 'valor' => $ln->peso));
     $paramtros_obj['descricao'] = $form::index(array('tipo' => 1, 'campo' => 'descricao', 'label' => true, 'html_depois' => '<br>', 'titulo' => 'Descricao', 'valor' => $ln->descricao));
     $paramtros_obj['quantidade'] = $form::index(array('tipo' => 0, 'campo' => 'quantidade', 'label' => true, 'html_depois' => '<br>', 'titulo' => 'Quantidade', 'mascara' => '0000000', 'valor' => $ln->quantidade));
     $paramtros_obj['categoria'] = $form::index(array('tipo' => 2, 'opcoes' => array_merge(array('nao' => 'sem categoria'), $lista_categorias), 'campo' => 'id_categoria', 'label' => true, 'html_depois' => '<br>', 'titulo' => 'Categoria'));
     html_botao_add_refresh_lista(self::$tabela, adiciona_ao_get(array('op' => "novo")));
     echo $form::formulario($paramtros_obj);
 }