예제 #1
0
 function export()
 {
     $queryString = $this->CI->config->item('enable_query_strings');
     if ($queryString === false) {
         $arrFormat = $this->CI->uri->uri_to_assoc();
         if (isset($arrFormat['_exportto'])) {
             $format = $arrFormat['_exportto'];
         } else {
             return false;
         }
     } else {
         $format = $this->CI->input->get('_exportto', TRUE);
         if (empty($format)) {
             return false;
         }
     }
     $query = $this->CI->session->userdata('dtgQuery');
     $fields = $this->CI->session->userdata('dtgFields');
     $sql = $this->_cleanExportSql($query, $fields);
     if ($format == 'csv') {
         $this->CI->load->dbutil();
         $query = $this->CI->db->query($sql);
         $delimiter = ",";
         $newline = "\r\n";
         header("Content-disposition: attachment; filename=csvoutput_" . time() . ".csv");
         echo $this->CI->dbutil->csv_from_result($query, $delimiter, $newline);
         exit;
     } elseif ($format == 'xml') {
         $this->CI->load->dbutil();
         $query = $this->CI->db->query($sql);
         header("Content-disposition: attachment;content-type: text/xml; filename=xmloutput_" . time() . ".xml");
         $config = array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t");
         echo $this->CI->dbutil->xml_from_result($query, $config);
         exit;
     } elseif ($format == 'pdf') {
         $this->CI->load->plugin('to_pdf');
         $query = $this->CI->db->query($sql);
         $params = $this->_exportpdf['params'];
         $exclude = isset($params['exclude']) ? $params['exclude'] : array();
         $orientation = isset($params['orientation']) ? $params['orientation'] : 'portrait';
         $stream = isset($params['stream']) ? $params['stream'] : true;
         $html = '';
         $html .= isset($params['title']) ? '<h3><center>' . $params['title'] . '</center></h3>' : '';
         $html .= html_prepare($query, $exclude);
         //echo $html;
         pdf_create($html, "pdfoutput_" . time(), $stream, $orientation);
     }
     //echo "== {$query} ==";
 }
예제 #2
0
/**
* prepares a string for the use in html (forms, etc.)
*
* @param mixed $object the string or string containing array to be prepared
* @return string the prepared object
*/
function html_prepare($object)
{
    $return = $object;
    if (is_array($return)) {
        foreach ($return as $key => $value) {
            $return[$key] = html_prepare($value);
        }
    } else {
        $return = htmlspecialchars($return);
        $return = str_replace(array("\r", "\n", "\\l"), '', nl2br($return));
    }
    return $return;
}
예제 #3
0
// +++ make sure that the file was not loaded directly
if (!defined('CTRL_DIRECT_ACCESS')) {
    header('Location: index.php');
    exit;
}
// +++ make sure that the file was not loaded directly
// set charset to utf-8
header("Content-Type: text/html; charset=utf-8");
$application_name = !is_null($glb_connection) ? $lg['APPLICATION_NAME'] : CFG_APPLICATION_NAME;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title><?php 
echo html_prepare($application_name);
?>
</title>

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta http-equiv="Cache-Control" content="no-cache"/>

        <link rel="shortcut icon" type="image/x-icon" href="<?php 
echo GLOBAL_PATH;
?>
img/athletica.ico"/>

        <link rel="stylesheet" type="text/css" href="<?php 
echo GLOBAL_PATH;
?>
css/style.css" media="screen"/>