Skip to content

Instantly share code, notes, and snippets.

@Uriel29
Forked from jsfernando/form_mainbody.php
Created March 10, 2016 18:12
Show Gist options
  • Save Uriel29/607a099ce3b684d2d5ee to your computer and use it in GitHub Desktop.
Save Uriel29/607a099ce3b684d2d5ee to your computer and use it in GitHub Desktop.
Formulário de Acompanhamento de Protocolo - j!3.4.8 + Seblod 3.7.2 override
/* arquivo mainbody.php */
/* templates/seb_one/positions/protocolo_acompanhamento/site/mainbody.php */
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#protoca_num").change(function(){
var idnum = jQuery(this).val();
jQuery.ajax({
type: 'POST',
dataType: "json",
url: '../../templates/seb_one/positions/protocolo_acompanhamento/site/procura_servico.php',
data: { protoca_num:idnum },
success: function(data){
jQuery('#protoca_servico').html(data["html"]+"<br/>"+'<div style="display: none;"><input id="protoca_email" name="protoca_email" value="'+data["protoc_email"]+'"class="inputbox text" size="50" maxlength="255" type="text"></div>');
//alert("resposta... "+data["protoca"]);
}
});
});
});
</script>
<?php
defined( '_JEXEC' ) or die;
$user = &JFactory::getUser();
$userid = $user->id;
$username = $user->name;
$db = &JFactory::getDBO();
echo $cck->renderField('protoca_id');
echo $cck->renderField('protoca_num');
echo "<div id='protoca_servico'></div>";
echo $cck->renderField('protoca_local');
echo $cck->renderField('protoca_descricao');
echo $cck->renderField('protoca_data');
echo $cck->renderField('protoca_statu');
echo $cck->renderField('protoca_user');
?>
<div style="display: none;">
<input id="protoca_atendente" name="protoca_atendente" value="<?php echo $username; ?>" class="inputbox text" size="50" maxlength="255" type="text">
</div>
/* arquivo procura_servico.php */
/* templates/seb_one/positions/protocolo_acompanhamento/site/procura_servico.php */
<?php
// No Direct Access
//defined( '_JEXEC' ) or die;
// Set flag that this is a parent file.
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
$path = "/var/www/html/portal/"; //caminho absoluto do site
define('JPATH_BASE', $path);
require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php';
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$db = &JFactory::getDBO();
$protoca_num = $_POST["protoca_num"];
if ($protoca_num != ''){
$query = "Select p.protoc_num, p.protoc_nome, p.protoc_email, p.protoc_data, p.protoc_servico, s.descricao, p.protoc_descricao
From #__protocolo p
INNER JOIN #__solicitacaotipo s ON p.protoc_servico = s.id
Where protoc_num = $protoca_num ";
$db->setQuery($query); $protoc = $db->loadObject();
$protoca = "";
$protoca .= "<strong>";
$protoca .= $protoc->protoc_num;
$protoca .= "<br/>";
$protoca .= date('d-m-Y',strtotime($protoc->protoc_data));
$protoca .= "<br/>";
$protoca .= $protoc->protoc_nome;
$protoca .= "<br/>";
$protoca .= $protoc->descricao;
$protoca .= "<br/>";
$protoca .= $protoc->protoc_descricao;
$protoca .= "</strong>";
$protoca .= "<br/>";
$protocaac = array();
$protocaac['protoc_email'] = $protoc->protoc_email;
$protocaac['protoc_nome'] = $protoc->protoc_nome;
$protocaac['html'] = $protoca;
//$protocaac['protoca'] = $query;
echo json_encode($protocaac);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment