예제 #1
4
<?php 
if (!isset($_SESSION)) {
    session_start();
}
$_SERVER["DOCUMENT_ROOT"] = $_SERVER["DOCUMENT_ROOT"] . '/turnos';
include_once $_SERVER["DOCUMENT_ROOT"] . '/common/Includes.php';
use admin\SecurityAdmin;
use lib\ExportDataExcel;
use security\SecurityManager;
SecurityManager::authorize(array('admin'));
$multicolumnSearchText = isset($_POST['multicolumnSearchText']) && $_POST['multicolumnSearchText'] ? $_POST['multicolumnSearchText'] : '';
$inactivos = isset($_POST['inactivos']) && $_POST['inactivos'] ? $_POST['inactivos'] : false;
$data = SecurityAdmin::getUsersByFilter($multicolumnSearchText, $inactivos);
$exporter = new ExportDataExcel('browser', 'Usuarios.xls');
$exporter->initialize();
$exporter->addRow(array("Id", "Nick", "Nombre", "Mail", "Tipo", "Activo", "FechaAlta"));
foreach ($data as $user) {
    $exporter->addRow(array($user->id, $user->nick, $user->firstName, $user->mail, $user->type, $user->enabled ? 'Si' : 'No', $user->createDate));
}
$exporter->finalize();
exit;
<?php 
if (!isset($_SESSION)) {
    session_start();
}
$_SERVER["DOCUMENT_ROOT"] = $_SERVER["DOCUMENT_ROOT"] . '/turnos';
include_once $_SERVER["DOCUMENT_ROOT"] . '/common/Includes.php';
use admin\SolicitudesEntregaAdmin;
use lib\ExportDataExcel;
use security\SecurityManager;
//SecurityManager::authorize(array('admin'));
$data = SolicitudesEntregaAdmin::getSolicitudesEntregaConfirmadas();
$exporter = new ExportDataExcel('browser', 'SolicitudesConfirmadas.xls');
$exporter->initialize();
$exporter->addRow(array("Id", "Fecha", "sucursal", "Ocs"));
foreach ($data as $solicitud) {
    $exporter->addRow(array($solicitud->id, $solicitud->startsAt, $solicitud->sucursalNombre, $solicitud->ordenesDeCompra));
}
$exporter->finalize();
exit;
예제 #3
0
<?php

require_once "vendor/autoload.php";
use lib\ExportDataExcel;
$excel = new ExportDataExcel('browser', '/Users/Mike/Downloads/');
$excel->filename = rand(1, 100) . ".xls";
$excel->initialize();
for ($i = 1; $i < 50000; $i++) {
    $row = array($i, genRandomString(), genRandomString());
    $excel->addRow($row);
}
/*foreach($data as $row)
{
    $excel->addRow($row);
}*/
$excel->finalize();
function genRandomString($length = 100)
{
    $characters = "0123456789abcdefghijklmnopqrstuvwxyz _";
    $string = "";
    for ($p = 0; $p < $length; $p++) {
        $string .= $characters[mt_rand(0, strlen($characters) - 1)];
    }
    return $string;
}