public function gerarStringArquivo($lang) { $stringRetorno = '<?php '; $stringRetorno .= '$lang = array('; $array = self::listar(" lang='" . $lang . "'"); foreach ($array as $key => $a) { $item = new ItemTraducao(); $item->selecionarPorId($a->fkItemTraducao); $itemTraducao = $stringRetorno .= '"' . $item->nome . '"=>"' . $a->valor . '"'; $stringRetorno .= ','; } $stringRetorno = substr($stringRetorno, 0, -1); $stringRetorno .= '); '; $stringRetorno .= 'return $lang;'; $stringRetorno .= '?>'; return $stringRetorno; }
public static function editar() { $traducao = new Traducao(); $traducao->selecionarPorId($_GET['id']); $itemTraducao = new ItemTraducao(); $itens = $itemTraducao->listar(); if (!empty($_POST)) { $traducao->fkItemTraducao = $_POST['tipotraducao']; $traducao->lang = $_POST['lang']; $traducao->valor = $_POST['valor']; $traducao->salvar(); self::redirecionar(Configuracao::$baseUrl . self::$viewController . '/listar' . Configuracao::$extensaoPadrao); } self::$variaveis = array('traducao' => $traducao, 'itens' => $itens); self::$corpo = "editar"; self::renderizar(self::$viewController); }
if (!empty($listaNL)) { ?> <table class="table table-striped table-bordered"> <thead> <tr> <th width="1%" >ID</th> <th width="1%" >Lingua</th> <th width="1%" >Tipo</th> <th width="80%" >Nome</th> <th width="20%" class="td-actions"></th> </tr> </thead> <tbody> <?php foreach ($listaNL as $i) { $item = new ItemTraducao(); $item->selecionarPorId($i->fkItemTraducao); ?> <tr> <td><?php echo $i->id; ?> </td> <td><?php echo $i->lang; ?> </td> <td><?php echo $item->nome; ?> </td>
public static function excluir() { $item = new ItemTraducao(); $item->selecionarPorId($_POST['id']); $item->excluir(); }