Created
July 3, 2015 16:42
-
-
Save marcelovieiratecnologia/347f55da00ba59e0c7ea to your computer and use it in GitHub Desktop.
Salvar dados em uma tabela através de um evento OnClick de um Link, e mostrar de forma organizada na administração de um artigo com ABAS e grid para impressão.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PARA SALVAR OS DADOS DE UMA FORMA BACANA EM TABELA SEPARADOS LINHA A LINHA PESSOA A PESSOA NA ABA DADOS PARA IMPRESSÃO QUE FICA NA ADMINISTRAÇÃO DO ARTIGO | |
<?php | |
define( '_JEXEC', 1 ); | |
define( 'DS', DIRECTORY_SEPARATOR ); | |
define('JPATH_BASE', 'C:/xampp/htdocs/licitacoes'); | |
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); | |
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); | |
$mainframe =& JFactory::getApplication('site'); | |
$mainframe->initialise(); | |
$con = & JFactory::getDBO(); //Objeto de conex�o | |
$idart = $_GET['idart']; | |
$email = $_GET['email']; | |
$cpf_cnpj = $_GET['cpf_cnpj']; | |
$razaosocial = $_GET['razaosocial']; | |
$telefone = $_GET['telefone']; | |
$espaco = ' '; | |
$abre = '<tr><td>'; | |
$meio = '</td><td>'; | |
$fecha = '</td></tr>'; | |
//echo $idart." - ".$email." - ".$cnpj. " - ".$razaosocial." - ".$telefone; | |
$sql = "UPDATE `#__cck_store_form_abrir_licitacoes` SET `dadosimpressao`=concat(dadosimpressao,'$abre','$cpf_cnpj','$meio','$razaosocial','$meio','$telefone','$meio','$email','$fecha') WHERE (`id`='$idart') and (dadosimpressao not like '%$email%');"; | |
$con->setQuery($sql); | |
$con->query(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OVERRIDE DA MINHA TELA ADMINISTRATIVA DOS ARTIGOS .... JÁ COM O CSS QUE IMPRIMI MINHA LISTA | |
<!DOCTYPE html> | |
<html> | |
<header> | |
<style type="text/css"> | |
@media print { | |
body * { | |
background: none !important; | |
visibility: hidden !important; | |
position: static !important; | |
} | |
.area_print, .area_print * { | |
visibility: visible !important; | |
} | |
.area_print { | |
position: absolute !important; | |
left: 0 !important; | |
top: 0 !important; | |
width: auto !important; | |
height: auto !important; | |
margin: 0 !important; | |
padding: 0 !important; | |
} | |
} | |
table { | |
width:100%; | |
} | |
table, th, td { | |
border: 1px solid black; | |
border-collapse: collapse; | |
} | |
th, td { | |
padding: 5px; | |
text-align: left; | |
} | |
table#t01 tr:nth-child(even) { | |
background-color: #fff; | |
} | |
table#t01 tr:nth-child(odd) { | |
background-color:#ffff; | |
} | |
table#t01 th { | |
background-color: #0088cc; | |
color: white; | |
} | |
</style> | |
</header> | |
<body> | |
<?php | |
// No Direct Access | |
defined( '_JEXEC' ) or die; | |
jimport('joomla.html.html.bootstrap'); // usei para que funcionasse o tabs | |
?> | |
<ul class="nav nav-tabs" id="myTab"> | |
<li class="active"><a data-toggle="tab" href="#home">DADOS DA LICITAÇÃO</a></li> | |
<li><a data-toggle="tab" href="#profile">ANEXOS/RELAÇÃO DE EMAILS</a></li> | |
<li><a data-toggle="tab" href="#profile1">DADOS EMPRESAS PARA IMPRESSÃO</a></li> | |
</ul> | |
<?php | |
// Example tab usage | |
echo JHtml::_('bootstrap.startPane', 'myTab', array('active' => 'home')); | |
echo JHtml::_('bootstrap.addPanel', 'myTab', 'home'); | |
//echo "DADOS DA LICITAÇÃO"; | |
?> | |
<?php echo $cck->renderField('categorialicitacao'); ?> | |
<?php echo $cck->renderField('titulolicitacao'); ?> | |
<?php echo $cck->renderField('objetolicitacao');?> | |
<?php echo $cck->renderField('situacaolicitacao'); ?> | |
<?php echo $cck->renderField('numero'); ?> | |
<?php echo $cck->renderField('processolicitacao'); ?> | |
<?php echo $cck->renderField('anolicitacao'); ?> | |
<?php echo $cck->renderField('modalidadelicitacao'); ?> | |
<?php echo $cck->renderField('tipolicitacao1'); ?> | |
<?php echo $cck->renderField('datasessalicitacao1'); ?> | |
<?php echo $cck->renderField('horarioiniciolicitacao'); ?> | |
<?php echo $cck->renderField('observacaolicitacao'); ?> | |
<?php echo $cck->renderField('atualizacaolicitacao'); ?> | |
<?php | |
echo JHtml::_('bootstrap.endPanel'); | |
echo JHtml::_('bootstrap.addPanel', 'myTab', 'profile'); | |
//echo "ANEXOS/RELAÇÃO DE EMAILS"; | |
?> | |
<div class="span6"> | |
<table id="t01"> | |
<tr> | |
<th> | |
<center><font size=3><i class="icon-file-add"></i> ARQUIVOS ANEXADOS</font></center> | |
</th> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar');?></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar2');?></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar3');?></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar4');?></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar5');?></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar6');?></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar7');?></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar8');?></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar9');?></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><?php echo $cck->renderField('anexar10');?></p> | |
</td> | |
</tr> | |
</table> | |
</div> | |
<div class="span6" align="center"> | |
<table id="t01"> | |
<tr> | |
<th> | |
<center><font size=3><i class="icon-mail-2"></i> RELAÇÃO DE EMAILS</font></center> | |
</th> | |
</tr> | |
<tr> | |
<td> | |
<div align="center"> | |
<?php echo $cck->renderField('relacaoemails');?> | |
</div> | |
</td> | |
</tr> | |
</table> | |
</div> | |
<?php | |
echo JHtml::_('bootstrap.endPanel'); | |
echo JHtml::_('bootstrap.addPanel', 'myTab', 'profile1'); | |
//echo "DADOS DAS EMPRESAS PARA IMPRESSÃO"; | |
?> | |
<div class="area_print"> | |
<table id="t01"> | |
<tr> | |
<th> | |
CNPJ | |
</th> | |
<th> | |
RAZÃO SOCIAL | |
</th> | |
<th> | |
TELEFONE | |
</th> | |
<th> | |
EMAILS | |
</th> | |
</tr> | |
<?php echo $cck->renderField('dadosimpressao');?> | |
</table> | |
</div> | |
<br> | |
<div class="btn-toolbar" align="center"> | |
<button type ="button" onClick="window.print();" class="btn btn-large btn btn-success"> | |
<i class="icon-printer"></i> IMPRIMIR LISTA | |
</button> | |
</div> | |
<?php | |
echo JHtml::_('bootstrap.endPanel'); | |
echo JHtml::_('bootstrap.endPane', 'myTab'); | |
?> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OVERRIDE DA MINHA PAGINA INCIAL ONDE TUDO COMEÇA .... RESUMINDO A HISTORIA , OS ARQUIVOS ANEXADOS SÓ VÃO APARECER SE A PESSOA ESTIVER LOGADO PORTANTO É SÓ PARA AQUELES QUE FOREM CADASTRADOS NO SITE, NO MOMENTO DO CADASTRO É EXIGIDO ALGUNS CAMPOS QUE É JUSTAMENTE AQUELES QUE VOU USAR PARA COMPOR MEU UPDATE DO CAMPOS ACIMA, TANTO O EMAIL PARA RELAÇÃO DE EMAIS (ARQUIVO salvaremail.php ) COMO O OUTRO CAMPOS QUE PEGAR MAIS DADOS DO LOGADO NO SITE PARA CRIAR MINHA LISTA PARA IMPRESSÃO (ARQUIVO dadosimpressaoempresas.php ) A TELA INICIAL É ISSO, LEMBRANDO QUE PRECISO DO OVERRIDE DA TELA ADMINISTRATIVA QUE ESTÁ ACIMA ONDE TEM OS CODIGOS PARA QUE FIQUE CERTINHO A APRESETAÇÃO DOS DADOS PARA INSERÇÃO SEPARADOS POR ABAS E DO CSS PARA APARECER O GRID COM OS dadosimpressaoemepresas E a lista de emails, ASSIM COMO TODO RESTANTE. | |
<?php | |
// No Direct Access | |
defined( '_JEXEC' ) or die; | |
$document = JFactory::getDocument(); | |
$document->addScript('/licitacoes/media/system/js/jquery-1.11.3.min.js'); | |
?> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
$('a').click(function(evt){ | |
var idartigo = $($(this).parents()[1]).find('.artigoid').text(); //document.getElementById('artigoid').innerHTML; | |
var email = $('.email'); | |
email = $(email[0]).find('a').text(); // usei assim no email pq ele é protegido pelo joomla e preciso desse find para pegar o email. | |
var cpf_cnpj = document.getElementById('cpf_cnpj').innerHTML; | |
var razaosocial = document.getElementById('razaosocial').innerHTML; | |
var telefone = document.getElementById('telefone').innerHTML; | |
$.ajax({ | |
url: '/licitacoes/templates/seb_one/positions/salvaremail.php?idart=' + idartigo + '&email=' + email + ',', | |
dataType: 'html' | |
}); | |
$.ajax({ | |
url: '/licitacoes/templates/seb_one/positions/dadosimpressaoempresas.php?idart=' + idartigo +'&cpf_cnpj=' + cpf_cnpj +'&razaosocial=' + razaosocial +'&telefone=' + telefone +'&email=' + email, | |
dataType: 'html' | |
}); | |
}); | |
}); | |
</script> | |
<div class="email" hidden="false"><?php echo $user->email; ?></div> <!-- Uso CLASS no email pois foi no momento a melhor maneira de eu driblar o bloqueio que o Joomla faz no email --> | |
<div id="cpf_cnpj" hidden="false"><?php echo $user->cpf_cnpj; ?></div> | |
<div id="razaosocial" hidden="false"><?php echo $user->razaosocial; ?></div> | |
<div id="telefone" hidden="false"><?php echo $user->telefone; ?></div> | |
<?php echo $cck->renderField('objetolicitacao'); ?> | |
<div class="containerlicitacao"> | |
<div class="span5"> | |
<?php echo $cck->renderField('situacaolicitacao'); ?> | |
<?php echo $cck->renderField('numero'); ?> | |
<?php echo $cck->renderField('processolicitacao'); ?> | |
<?php echo $cck->renderField('modalidadelicitacao'); ?> | |
</div> | |
<div class="span5"> | |
<?php echo $cck->renderField('tipolicitacao1'); ?> | |
<?php echo $cck->renderField('datasessalicitacao1'); ?> | |
<?php echo $cck->renderField('horarioiniciolicitacao'); ?> | |
<?php echo $cck->renderField('atualizacaolicitacao'); ?> | |
</div> | |
<?php echo $cck->renderField('observacaolicitacao'); ?> | |
</div> | |
<?php | |
$user = & JFactory::getUser(); | |
//Fica visivel somente para 2(Registrados) ou 7(Administradores) e esse 0(liberado para qualquer .. obs .. depois tirar ele qdo estiver com os cadastro das Empresas corretamente cadastradas) | |
if(isset($user->groups[2]) || isset($user->groups[7])) // || isset($user->groups[0]) ) | |
{ ?> | |
</br> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<font size="2"><i class="icon-box-add"></i> ANEXOS:</font> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar'). " ";?> </div> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar2'). " ";?> </div> | |
</p> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar3'). " ";?></div> | |
</p> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar4'). " ";?></div> | |
</p> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar5'). " ";?></div> | |
</p> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar6'). " ";?></div> | |
</p> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar7'). " ";?></div> | |
</p> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar8'). " ";?></div> | |
</p> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar9'). " ";?></div> | |
</p> | |
</div> | |
<div style="min-height:10px; float: left; padding: 5px;"> | |
<div class="artigoid" hidden="false"><?php echo $cck->getValue('art_id'); ?></div> | |
<div><?php echo $cck->getHtml('anexar10'). " ";?></div> | |
</p> | |
</div> | |
<?php | |
} | |
else{ ?> | |
</br> | |
<class="row-fluid"> | |
<font size="3"><i class="icon-box-add"></i> ANEXOS:</font> | |
<font size="2" color="red"> Esteja Conectado para fazer o Download dos arquivos anexados.</font> | |
</div> | |
<?php } ?> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PARA SALVAR OS EMAILS EM UM CAMPO QUE TB ESTÁ CRIADO EM LICITAÇÕES , GRAVO ELES APENAS SEPARADOS POR VIRGULA, PQ ASSIM FICA DE UMA FORMA FÁCIL PARA O CLIENTE APENAS COPIAR E COLAR NO COMPONENTE DE ENVIO DE EMAILS EM MASSA.... UMA FORMA DELE AVISAR TODOS. | |
<?php | |
define( '_JEXEC', 1 ); | |
define( 'DS', DIRECTORY_SEPARATOR ); | |
define('JPATH_BASE', 'C:/xampp/htdocs/licitacoes'); | |
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); | |
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); | |
$mainframe =& JFactory::getApplication('site'); | |
$mainframe->initialise(); | |
$con = & JFactory::getDBO(); //Objeto de conex�o | |
$idart = $_GET['idart']; | |
$email = $_GET['email']; | |
echo $idart." - ".$email; | |
$sql = "UPDATE `#__cck_store_form_abrir_licitacoes` SET `relacaoemails`=concat(relacaoemails,'$email') WHERE (`id`='$idart') and (relacaoemails not like '%$email%');"; | |
$con->setQuery($sql); | |
$con->query(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment