Last active
August 29, 2015 14:09
-
-
Save jsfernando/4f222ee7ba4cafa189d6 to your computer and use it in GitHub Desktop.
Arquivo index.php ..., copia do Template seb_table - cck Seblod
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
<?php | |
/** | |
* @version SEBLOD 3.x Core | |
* @package SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder) | |
* @url http://www.seblod.com | |
* @editor Octopoos - www.octopoos.com | |
* @editor2 JSFernando - jsfernando.com | |
* @copyright Copyright (C) 2013 SEBLOD. All Rights Reserved. | |
* @license GNU General Public License version 2.1 or later; see _LICENSE.php | |
**/ | |
defined( '_JEXEC' ) or die; | |
// -- Initialize | |
require_once dirname(__FILE__).'/config.php'; | |
$cck = CCK_Rendering::getInstance( $this->template ); | |
if ( $cck->initialize() === false ) { return; } | |
$table_layout = $cck->getStyleParam( 'table_layout', '' ); | |
$isFixed = ( $table_layout == 'fixed' ) ? 1 : 0; | |
$class_table = ( $isFixed ) ? $class_table.' fixed' : $class_table; | |
$class_table = trim( $cck->getStyleParam( 'class_table', 'category zebra table' ) ); | |
$class_table = $class_table ? ' class="'.$class_table.'"' : ''; | |
$class_row0 = trim( $cck->getStyleParam( 'class_table_tr_even', 'cat-list-row%i' ) ); | |
$class_row0 = $class_row0 ? ' class="'.str_replace( '%i', '0', $class_row0 ).'"' : ''; | |
$class_row1 = trim( $cck->getStyleParam( 'class_table_tr_odd', 'cat-list-row%i' ) ); | |
$class_row1 = $class_row1 ? ' class="'.str_replace( '%i', '1', $class_row1 ).'"' : ''; | |
$doc = JFactory::getDocument(); | |
//$doc->addStyleSheet( JURI::root( true ).'/templates/'.$cck->template. '/css/'.'base.css' ); | |
$doc->addStyleSheet( JURI::root( true ).'/templates/'.$cck->template. '/css/'.'style.css' ); | |
// -- Render | |
?> | |
<div id="<?php echo $cck->id; ?>" class="<?php echo $cck->id_class; ?>cck-f100 cck-pad-<?php echo $cck->getStyleParam( 'position_margin', '10' ); ?>"> | |
<div> | |
<?php | |
$css = array(); | |
$items = $cck->getItems(); | |
$positions = $cck->getPositions(); | |
unset( $positions['hidden'] ); | |
if ( count( $items ) ) { ?> | |
<table<?php echo $class_table; ?>> | |
<?php | |
$head = ''; | |
$thead = false; | |
foreach ( $positions as $name=>$position ) { | |
$class = $position->css; | |
$css[$name] = $class ? ' class="'.$class.'"' : ''; | |
$legend = ( $position->legend ) ? $position->legend : ( ( $position->legend2 ) ? $position->legend2 : '' ); | |
$width = $cck->w( $name ); | |
$width = ( $width ) ? ' width="'.$width.'"' : ''; | |
if ( $legend || $width ) { | |
if ( $legend ) { | |
$thead = true; | |
} | |
$head .= '<th'.$css[$name].$width.'>'.$legend.'</th>'; | |
} | |
} | |
?> | |
<?php if ( $head && $thead ) { ?> | |
<thead> | |
<tr><?php echo $head; ?></tr> | |
</thead> | |
<?php } ?> | |
<tbody> | |
<?php | |
$i = 0; | |
foreach ( $items as $item ) { | |
?> | |
<tr <?php echo ${'class_row'.($i % 2)}; ?>> | |
<?php | |
foreach ( $positions as $name=>$position ) { | |
$fieldnames = $cck->getFields( $name, '', false ); | |
echo '<td'.$css[$name].'>'; | |
foreach ( $fieldnames as $fieldname ) { | |
// Form de Reserva Sala Aula | |
if($fieldname == 'salaaula_horario' || $fieldname == 'reservalabin_horario'){ | |
$horarios = $item->renderField( $fieldname ); | |
$horario = explode(",",$horarios); | |
$n = count($horario); | |
$html = $horario[0]." até ".$horario[$n-1]; | |
// Form de Reserva do Labin | |
} elseif ($fieldname == 'reservalabin_dia_inicial') { | |
$html = 'De: '.date('d/m/Y',strtotime($item->renderField( $fieldname ))); | |
} elseif ($fieldname == 'reservalabin_data_final') { | |
$html = 'Até: '.date('d/m/Y',strtotime($item->renderField( $fieldname ))); | |
// Form de Transferência de Patrimônio | |
} elseif ($fieldname == 'patrimonio_m_data') { | |
$html = date('d/m/Y',strtotime($item->renderField( $fieldname ))); | |
} elseif ($fieldname == 're_dtaini') { | |
$html = date('d/m/Y',strtotime($item->renderField( $fieldname ))); | |
} elseif ($fieldname == 're_dtafim') { | |
$html = date('d/m/Y',strtotime($item->renderField( $fieldname ))); | |
// Impressão Declaração de Representações | |
} elseif ($fieldname == 're_id') { | |
$id = $item->renderField( $fieldname ); | |
$html = "<a href=\"/templates/simplesimon/includes/declaracao_representacao?re_id=$id\" target=\"_blank\"><button type=\"button\" class=\"btn btn-mini btn-success\"><i class=\"icon-print icon-white\"></i></button></a>"; | |
// Botão Excluir Reserva Sala de Aula | |
} elseif ($fieldname == 'salaaula_id') { | |
$salaaula_id = $item->renderField( $fieldname ); | |
$html = "<a href=\"$salaaula_id\" target=\"_blank\" class=\"salaaula_id\"><button type=\"button\" class=\"btn btn-mini btn-danger\"><i class=\"icon-trash icon-white\"></i></button></a>"; | |
// Botão Excluir Colegiados | |
} elseif ($fieldname == 'c_id') { | |
$c_id = $item->renderField( $fieldname ); | |
$html = "<a href=\"$c_id\" target=\"_blank\" class=\"c_id\"><button type=\"button\" class=\"btn btn-mini btn-danger\"><i class=\"icon-trash icon-white\"></i></button></a>"; | |
} else { | |
$html = $item->renderField( $fieldname ); | |
} | |
if ( $html != '' ) { | |
echo '<div style="clear:left;">'.$html.'</div>'; //todo: markup | |
} | |
} | |
echo '</td>'; | |
} | |
?> | |
</tr> | |
<?php $i++; } ?> | |
</tbody> | |
</table> | |
<?php } ?> | |
</div> | |
</div> | |
<?php | |
// -- Finalize | |
$cck->finalize(); | |
?> | |
<script type="text/javascript" src="/portal/templates/simplesimon/js/jquery-1.9.1.min.js"></script> | |
<script type="text/javascript"> | |
jQuery(document).ready(function(){ | |
jQuery('.salaaula_id').click(function(event){ | |
event.preventDefault(); | |
var id = jQuery(this).attr("href"); | |
if(confirm('Tem certeza de que deseja excluir a Reserva de Sala de Sala de Aula ?')){ | |
jQuery.ajax({ | |
type: "POST" , | |
url: "<?php echo JURI::base();?>templates/simplesimon/includes/delete_reservasalaaula.php", | |
data: { xid: id }, | |
dataType: "html", | |
success: function( data ) { | |
jQuery("#system").fadeOut(100).html(data).slideDown('slow'); | |
//jQuery("#system-message-container").fadeOut(100).html(data).slideDown('slow'); | |
} | |
}); | |
} | |
return false; | |
}); | |
jQuery('.c_id').click(function(event){ | |
event.preventDefault(); | |
var id = jQuery(this).attr("href"); | |
if(confirm('Tem certeza de que deseja excluir a Representação do Colegiado ?')){ | |
jQuery.ajax({ | |
type: "POST" , | |
url: "<?php echo JURI::base();?>templates/simplesimon/includes/delete_colegiados.php", | |
data: { xid: id }, | |
dataType: "html", | |
success: function( data ) { | |
jQuery("#system").fadeOut(100).html(data).slideDown('slow'); | |
//jQuery("#system-message-container").fadeOut(100).html(data).slideDown('slow'); | |
} | |
}); | |
} | |
return false; | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment