first commit
This commit is contained in:
109
libraries/grid/templates/print.php
Normal file
109
libraries/grid/templates/print.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?
|
||||
$this -> values['name'] ? $g_table = $this -> values['name'] : $g_table = $this -> values[ 'table' ];
|
||||
?>
|
||||
<? if ( is_array( $this -> values['results'] ) ):?>
|
||||
<table style="border-collapse: collapse; width: 100%; font-family: Verdana; font-size: 11px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<?
|
||||
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
|
||||
{
|
||||
if ( $column['autoincrement'] )
|
||||
echo '<td style="background: #000; color: #FFF; text-align: left; font-weight: normal; padding: 3px 5px; width: 30px; text-align: center;' . $column['th']['style'] . '">' . $column['name'] . '</td>';
|
||||
else if ( $column['action'] == null )
|
||||
echo '<td style="background: #000; color: #FFF; text-align: left; font-weight: normal; padding: 3px 5px;' . $column['th']['style'] . '">' . $column['name'] . '</td>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?
|
||||
$i = ( $this -> values['cp'] - 1 ) * $this -> values['limit'];
|
||||
$context = false;
|
||||
|
||||
if ( is_array( $this -> values['results'] ) ) foreach ( $this -> values['results'] as $row )
|
||||
{
|
||||
echo '<tr'; if ( $i%2 == 0 ) echo 'style="background: #E8E8E8;"'; echo '>';
|
||||
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
|
||||
{
|
||||
if ( $column['autoincrement'] )
|
||||
echo '<td style="padding: 3px 5px; border: 1px solid #DFDFDF; text-align: center;' . $column['td']['style'] . '">' . ++$i . '.</td>';
|
||||
else if ( $column['action'] == null )
|
||||
{
|
||||
echo '<td style="padding: 3px 5px; border: 1px solid #DFDFDF;' . $column['td']['style'] . '">';
|
||||
if ( $column['content'] )
|
||||
echo $_SESSION[ 'g' . $g_table ] -> convertString( $column['content'], $row );
|
||||
else
|
||||
{
|
||||
/* podmiana na wartości tablicy */
|
||||
if ( is_array( $column['replace']['array'] ) )
|
||||
echo $_SESSION[ 'g' . $g_table ] -> convertString( $column['replace']['array'][ $row[ $column['db'] ] ], $row );
|
||||
|
||||
else if ( $column['replace']['sql'] )
|
||||
{
|
||||
$sql = $_SESSION[ 'g' . $g_table ] -> convertString( $column['replace']['sql'], $row );
|
||||
$results = $_SESSION[ 'g' . $g_table ] -> connectToDb() -> query( $sql ) -> fetchAll();
|
||||
|
||||
if ( $results[0][0] )
|
||||
echo $results[0][0];
|
||||
else
|
||||
echo '-';
|
||||
}
|
||||
|
||||
/* modyfikacja wyświetlania daty */
|
||||
else if ( $column['date_mod'] )
|
||||
{
|
||||
if ( grid::validateDate( $row[ $column['db'] ] ) )
|
||||
echo date( $column['date_mod'], strtotime( $row[ $column['db'] ] ) );
|
||||
else
|
||||
echo '-';
|
||||
}
|
||||
|
||||
/* ucunianie długich wartości */
|
||||
else if ( $column['cut'] )
|
||||
{
|
||||
echo '<span class="tip" title="' . htmlspecialchars( $row[ $column['db'] ] ) . '">';
|
||||
echo mb_substr( $row[ $column['db'] ], 0, $column['cut'], 'UTF-8' );
|
||||
if ( mb_strlen( $row[ $column['db'] ], 'UTF-8' ) > $column['cut'] )
|
||||
echo '...';
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
else if ( $column['php'] )
|
||||
eval( $_SESSION[ 'g' . $g_table ] -> convertString( $column['php'], $row ) );
|
||||
|
||||
/* zwykla wartość */
|
||||
else
|
||||
echo $row[ $column['db'] ];
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
if ( is_array( $this -> values['summary'] ) )
|
||||
{
|
||||
echo '<tr>';
|
||||
if ( is_array( $this -> values['columns_view'] ) ) foreach ( $this -> values['columns_view'] as $column )
|
||||
{
|
||||
if ( $column['action'] == null )
|
||||
{
|
||||
echo '<td style="padding: 3px 5px; border: 1px solid #DFDFDF; text-align: center; font-weight: bold;">';
|
||||
if ( !empty( $this -> values['summary'][ $column['db'] ] ) )
|
||||
echo 'Σ: ' . $this -> values['summary'][ $column['db'] ];
|
||||
echo '</td>';
|
||||
}
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<? else:?>
|
||||
<div class="g-alert"><i class="fa fa-exclamation-circle fa-lg"></i><?= $this -> values['empty_txt'];?></div>
|
||||
<? endif;?>
|
||||
<link rel="stylesheet" type="text/css" href="<?= gdir;?>/css/grid.css" />
|
||||
<script type="text/javascript">
|
||||
window.print();
|
||||
</script>
|
||||
Reference in New Issue
Block a user