Exemplo n.º 1
0
        <section class="content container">
            <?php 
//            ini_set('display_errors', 'Off');
//            error_reporting(E_ALL & ~E_DEPRECATED);
include 'vendor/autoload.php';
use App\Phonebook;
use App\Requered;
$obj = new Phonebook();
//            if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
////
//                $info = $obj->index($_POST);
////
//            } else if (strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
//                $info = $obj->index(null, $_GET);
//            } else {
$info = $obj->index();
//            }
$num = $obj->pagination();
//            $search = $obj->search();
$success = Requered::success_message();
$unsuccess = Requered::unsuccess_message();
if (isset($success)) {
    ?>
                <div class = "alert alert-success">
                    <button type = "button" class = "close" data-dismiss = "alert">
                        <i class = " fa fa-times"></i>
                    </button>
                    <p>
                        <strong>
                            <i class = "ace-icon fa fa-check"></i>
                            <!--                        Well done!-->
<?php

ini_set("display_errors", "On");
error_reporting(E_ALL & ~E_DEPRECATED);
include 'vendor/autoload.php';
use App\Phonebook;
use App\Requered;
$phonebook = new Phonebook();
$phonebooks = $phonebook->index();
/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('Europe/London');
if (PHP_SAPI == 'cli') {
    die('This example should only be run from a Web Browser');
}
/** Include PHPExcel */
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'Phonebook' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'phpoffice' . DIRECTORY_SEPARATOR . 'phpexcel' . DIRECTORY_SEPARATOR . 'Classes' . DIRECTORY_SEPARATOR . 'PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set document properties
$objPHPExcel->getProperties()->setCreator("BITM")->setLastModifiedBy("BITM")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', 'Full Name')->setCellValue('C1', 'Mobile Number')->setCellValue('D1', 'Gender')->setCellValue('E1', 'Home Phone')->setCellValue('F1', 'Work Phone');
$counter = 2;
//Requered::debug($phonebooks);
foreach ($phonebooks as $phonebook) {
    $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $counter, $phonebook->fname . " " . $phonebook->lname)->setCellValue('C' . $counter, $phonebook->mobile)->setCellValue('D' . $counter, $phonebook->gender)->setCellValue('E' . $counter, $phonebook->home_phone)->setCellValue('F' . $counter, $phonebook->work_phone);
    $counter++;
}
//// Miscellaneous glyphs, UTF-8