/**
  * Constructor
  * @param adminDb $db
  * @param bool $showTypeID
  */
 public function __construct(adminDb $db, $showTypeID = false)
 {
     $this->db = $db;
     $this->servKey = $db->getServKey();
     $query = "SELECT a.*,d.id_doc,d.basename,d.dirname,t.nom type FROM acces a\n\t\t\t LEFT JOIN documents d USING(id_doc)\n\t\t\t LEFT JOIN types t USING (id_type)";
     if ($showTypeID !== false) {
         $query .= " WHERE t.id_type = {$showTypeID}";
     }
     $query .= " ORDER BY a.id_type, a.name";
     $stmt = $db->query($query);
     $stmt->setFetchMode(PDO::FETCH_CLASS, 'AdminDocumentAccess', array($this->servKey, $db));
     $this->access = $stmt->fetchAll();
     unset($stmt);
 }
 /**
  * Constructor
  * @param adminDb $db
  * @param bool $showTypeID
  */
 public function __construct(adminDb $db, $showTypeID = false)
 {
     $this->db = $db;
     $this->servKey = $db->getServKey();
     $query = "\n          SELECT\n            aa.*,\n            a.*,\n            t.nom type\n          FROM archives_acces aa\n            LEFT JOIN archives a USING (id_archive)\n            LEFT JOIN types t USING (id_type)";
     if ($showTypeID !== false) {
         $query .= " WHERE t.id_type = {$showTypeID}";
     }
     $query .= " ORDER BY aa.id_type, aa.rank";
     $stmt = $db->query($query);
     $stmt->setFetchMode(PDO::FETCH_CLASS, 'AdminArchiveAccess', array($this->servKey, $db));
     $this->access = $stmt->fetchAll();
     unset($stmt);
 }
Example #3
0
<?php

require 'falcon.php';
require 'functions/adminFunctions.php';
require 'classes/FirePHP.class.php';
require 'classes/FB.class.php';
require 'classes/adminDb.class.php';
require 'classes/AdminImageAccessList.class.php';
require 'classes/AdminImageAccess.class.php';
$id_avion = $_GET['id_avion'];
// Supprimer tous les fichiers zip présent dans le répertoire en premier lieu
foreach (glob('*.zip') as $filename) {
    unlink($filename);
}
try {
    $db = new adminDb(DSN, USER, PASSW);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
} catch (PDOException $e) {
    die("Erreur PDO : <br />" . $e->getMessage() . "<br />Trace : " . $e->getTraceAsString());
}
$avion = $db->query(sprintf('SELECT nom FROM produits WHERE id_avion=%d', $id_avion))->fetchColumn();
// Images activées
$allMediasAccess = new AdminImageAccessList($db, $id_avion);
$filename = $avion . '_' . date('mdY') . '.zip';
$zip = new ZipArchive();
if (file_exists($filename)) {
    unlink($filename);
}
$open = $zip->open($filename, ZipArchive::CREATE);
// Création d'une nouvelle archive
/* -------------------------------------------------------------------- */
$default_style = array('font' => array('name' => 'Arial', 'size' => 12, 'bold' => true), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_DASHDOT)));
$style_titre = array('font' => array('bold' => true, 'size' => 14, 'name' => 'Arial', 'color' => array('argb' => PHPExcel_Style_Color::COLOR_BLACK)), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '000000'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => '55BB55')), 'alignment' => array('shrinkToFit' => true, 'wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT));
$style_thead = array('font' => array('bold' => true, 'size' => 12, 'name' => 'Arial', 'color' => array('argb' => PHPExcel_Style_Color::COLOR_BLACK)), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '000000'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'BBBBBB')), 'alignment' => array('shrinkToFit' => true, 'wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER));
$style_thead_technical_brochures = array('font' => array('bold' => true, 'size' => 12, 'name' => 'Arial', 'color' => array('rgb' => '333333')), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '333333')), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => '333333'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFF601')), 'alignment' => array('shrinkToFit' => true, 'wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT));
$style_thead_technico_commercial_brochures = array('font' => array('bold' => true, 'size' => 12, 'name' => 'Arial', 'color' => array('rgb' => '333333')), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '000000')), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => '333333'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'FFAD00')), 'alignment' => array('shrinkToFit' => true, 'wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT));
$style_thead_commercial_brochures = $style_thead_technical_brochures;
$style_thead_subcategory = array('font' => array('bold' => true, 'size' => 12, 'name' => 'Arial', 'color' => array('rgb' => 'FFFFFF')), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => '000000')), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => 'FFFFFF'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => '000000')), 'alignment' => array('shrinkToFit' => true, 'wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT));
$style_access_line = array('font' => array('bold' => true, 'size' => 11, 'name' => 'Arial', 'color' => array('rgb' => '000000')), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => '000000'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'FFFFFF')), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT));
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
/* -------------- Récupération  & exportation des données ------------- */
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
try {
    $db = new adminDb(DSN, USER, PASSW);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
} catch (PDOException $e) {
    die("Erreur PDO : <br />" . $e->getMessage() . "<br />Trace : " . $e->getTraceAsString());
}
$servKey = $db->getServKey();
/* Catégories */
$theads = array('Name', 'Document Name', 'Ref', 'Size');
$theads_cnt = count($theads);
$title_line = 3;
$thead_line = 5;
$first = true;
$current_type = 'new';
$current_cat = 'new';
$current_product = 'new';
Example #5
0
require 'classes/adminDb.class.php';
require 'classes/AdminDocumentAccessList.class.php';
require 'classes/AdminDocumentAccessListByType.class.php';
require 'classes/AdminArchiveAccessListByType.class.php';
require 'classes/AdminDocumentAccess.class.php';
require 'classes/AdminMediaAccessList.class.php';
require 'classes/AdminMediaAccess.class.php';
require 'classes/AdminImageAccessList.class.php';
require 'classes/AdminImageAccess.class.php';
require 'classes/AdminArchiveAccessList.class.php';
require 'classes/AdminArchiveAccess.class.php';
require 'classes/image.class.php';
require 'classes/httpQueryStr.class.php';
require 'classes/locale.class.php';
try {
    $db = new adminDb(DSN, USER, PASSW);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
} catch (PDOException $e) {
    die("Erreur PDO : <br />" . $e->getMessage() . "<br />Trace : " . $e->getTraceAsString());
}
$httpQuery = new httpQueryStr();
$httpQuery->setIndexDefVal('p', 'inactiveDocs');
//$httpQuery->setIndexDefVal('productID', $db->query('SELECT id_avion FROM produits ORDER BY menu LIMIT 1')->fetchColumn());
try {
    // Contrôleur
    require_once 'adminCtrl/' . $httpQuery->p . '.php';
    if (!$httpQuery->has('productID')) {
        $httpQuery->productID = $db->query('SELECT id_avion FROM produits ORDER BY menu LIMIT 1')->fetchColumn();
    }
} catch (PDOException $e) {
/* -------------------------------------------------------------------- */
/* -------------------------- MISE EN FORME --------------------------- */
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
$default_style = array('font' => array('name' => 'Arial', 'size' => 12, 'bold' => true), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_DASHDOT)));
$style_titre = array('font' => array('bold' => true, 'size' => 14, 'name' => 'Arial', 'color' => array('argb' => PHPExcel_Style_Color::COLOR_BLACK)), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '000000'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => '55BB55')), 'alignment' => array('shrinkToFit' => true, 'wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT));
$style_thead = array('font' => array('bold' => true, 'size' => 12, 'name' => 'Arial', 'color' => array('argb' => PHPExcel_Style_Color::COLOR_BLACK)), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '000000'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'BBBBBB')), 'alignment' => array('shrinkToFit' => true, 'wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER));
$style_thead_subcategory = array('font' => array('bold' => true, 'size' => 12, 'name' => 'Arial', 'color' => array('rgb' => 'FFFFFF')), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => '000000')), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => 'FFFFFF'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => '000000')), 'alignment' => array('shrinkToFit' => true, 'wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT));
$style_user_line = array('font' => array('bold' => false, 'size' => 11, 'name' => 'Arial', 'color' => array('rgb' => '000000')), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => '000000'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'FFFFFF')), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT));
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
/* -------------- Récupération  & exportation des données ------------- */
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
try {
    $db = new adminDb(DSN, USER, PASSW);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
} catch (PDOException $e) {
    die("Erreur PDO : <br />" . $e->getMessage() . "<br />Trace : " . $e->getTraceAsString());
}
$servKey = $db->getServKey();
/* Catégories */
$theads = array('ID', 'Login', 'Description');
$theads_cnt = count($theads);
$title_line = 3;
$thead_line = 5;
$i = 1;
$sheet_cnt = 0;
$row_cnt = $thead_line + 1;
$workbook = new PHPExcel();