Mister Spy Say ="Hello Kids ... :D"
___ ____ _ _____
| \/ (_) | | / ___|
| . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _
| |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | |
| | | | \__ \ || __/ | /\__/ / |_) | |_| |
\_| |_/_|___/\__\___|_| \____/| .__/ \__, |
| | __/ |
|_| |___/
Bot Mister Spy V3
Mister Spy
Mister Spy
<?php
require_once('PHPExcel/Classes/PHPExcel.php');
require_once('class.catalogos.php');
require_once('class.eventos.php');
require_once('class.eventosmorfologicosautoridades.php');
require_once('class.jurados.php');
require_once('class.premiosmorfologicos.php');
require_once('class.premiotipos.php');
require_once('class.misc.php');
require_once('class.rechazotipos.php');
require_once('class.rechazocondiciones.php');
class ExcelHelper {
public $boxPerPage;
public $templatePath;
public $template;
public $evento;
public $animales;
public $categoria;
public $jurado;
public $filename;
public $infoCells;
public function __construct($idEvento, $boxPerPage = 15) {
$oEventos = new Eventos();
if (!$this->evento = $oEventos->GetById($idEvento)) {
throw new Exception("Error evento no encontrado", 404);
}
$this->boxPerPage = $boxPerPage;
}
protected function getAnimales() {
return array();
}
public function validate() {
return true;
}
protected function loadTemplate() {
$this->template = PHPExcel_IOFactory::load($this->templatePath);
}
protected function getStyles() {
return array();
}
protected function setSheetHeader($activeSheet) {}
protected function setSheetStyles($activeSheet) {
foreach ($this->getStyles() as $key => $style) {
$activeSheet->getStyle($key)->applyFromArray($style);
}
}
protected function setSelectCell($cell, $options) {
$objValidation = $cell->getDataValidation();
$objValidation->setType(PHPExcel_Cell_DataValidation::TYPE_LIST);
$objValidation->setErrorStyle(PHPExcel_Cell_DataValidation::STYLE_STOP);
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setShowDropDown(true);
$objValidation->setErrorTitle('Error de entrada');
$objValidation->setError('El valor no está en la lista.');
$objValidation->setPromptTitle('Elija de la lista');
$objValidation->setPrompt('Por favor elija un valor de la lista desplegable.');
$objValidation->setFormula1('"' . implode(',', $options) . '"');
}
protected function setSheetValues($activeSheet, $cellIndex, $oAnimal, $count) {}
public function generateExcel() {
$this->loadTemplate();
$objPHPExcel = new PHPExcel();
$objPHPExcel->removeSheetByIndex(0);
$sheet = $this->template->getSheet(0);
$sheet->rebindParent($objPHPExcel);
$count = 0;
$sheetIndex = 0;
if ($this->validate()) {
$activeSheet = null;
foreach ($this->animales as $oAnimal) {
if ($count % $this->boxPerPage == 0) {
$objPHPExcel->addSheet($sheet->copy());
$objPHPExcel->setActiveSheetIndex($sheetIndex);
$activeSheet = $objPHPExcel->getActiveSheet();
$this->setSheetHeader($activeSheet);
$limit = ($sheetIndex * $this->boxPerPage + $this->boxPerPage);
if ($limit > count($this->animales)) {
$limit = count($this->animales);
}
$activeSheet->setTitle('Box ' . ($sheetIndex * $this->boxPerPage + 1) . ' - ' . $limit);
$this->setSheetStyles($activeSheet);
$sheetIndex++;
}
$cellIndex = ($count % $this->boxPerPage) + 10;
$this->setSheetValues($activeSheet, $cellIndex, $oAnimal, $count);
$count++;
}
}
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="' . $this->filename . '"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');
}
public function parseInfo($value, $reference) {
if (!$reference) {
return utf8_decode($value);
}
if ($value === '') {
return '';
}
if ($value == $reference) {
return '1';
}
return '0';
}
public function getInfo($filename) {
$objPHPExcel = PHPExcel_IOFactory::load($filename);
$data = array();
foreach ($objPHPExcel->getSheetNames() as $sheetIndex => $sheetName) {
$sheet = $objPHPExcel->getSheet($sheetIndex);
// Obtener el rango de celdas A10:O24
$range = $sheet->rangeToArray($this->infoCells, NULL, TRUE, TRUE, TRUE);
foreach ($range as $value) {
$data[] = $value;
}
}
return $data;
}
protected function columnIndexToLetter($index) {
$letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
return $letters[$index];
}
}
?>
Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat