14,14 → 14,14 |
*/ |
|
/** |
* |
* |
* in=utf8 |
* out=iso3859 |
* |
* |
* Liste des Nouvelles observations par departement |
* A voir avec David mais ne devrait plus être utilisé |
* A voir avec David mais ne devrait plus être utilisé |
* ou fait autrement |
* |
* |
*/ |
|
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(realpath(__FILE__))) . '/lib'); |
33,25 → 33,25 |
class InventoryByDept extends Cel { |
|
var $extendSpreadsheetProductor; |
|
|
function InventoryByDept($config) { |
|
parent::__construct($config); |
|
|
// Pas d'heritage multiple en php :( |
$this->extendSpreadsheetProductor = new SpreadsheetProductor(); |
$this->extendSpreadsheetProductor->initSpreadsheet(); |
$this->extendSpreadsheetProductor->initSpreadsheet(); |
} |
|
|
//TODO : faire une fonction qui prend en paramètre un departement |
function getRessource(){ |
|
|
$requete_obs = "SELECT ce_zone_geo, ce_utilisateur, courriel_utilisateur, ordre, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, famille, zone_geo, date_observation," . |
" lieudit, station, milieu, commentaire, transmission FROM cel_obs ". |
" lieudit, station, milieu, commentaire, transmission FROM cel_obs ". |
"WHERE ce_zone_geo != '000null' AND ce_zone_geo != '' AND transmission = 1 AND nt!=0 ORDER BY ce_zone_geo, nom_ret LIMIT 50"; |
|
$resultat_obs = Cel::db()->executerRequete($requete_obs); |
|
$resultat_obs = Cel::db()->requeter($requete_obs); |
|
// Creating a workbook |
$workbook = new Spreadsheet_Excel_Writer(); |
$workbook->setVersion(8); |
75,7 → 75,7 |
$worksheet->write(0,13,'Observateur'); |
|
$i=1; |
|
|
$observations = array(); |
$chercheur_infos_taxon = null; |
if (is_array($resultat_obs)) { |
82,14 → 82,14 |
$observations = &$resultat_obs; |
$chercheur_infos_taxon = new RechercheInfosTaxonBeta($this->config); |
} |
|
|
foreach ($observations as $obs) { |
|
$code_departement = $this->convertirCodeZoneGeoVersDepartement($obs['ce_zone_geo']); |
$taxon_deja_vu = $chercheur_infos_taxon->taxonEstPresentDansDepartement($obs['nt'], $code_departement); |
|
if (!$taxon_deja_vu) { |
// Denullifiage |
|
if (!$taxon_deja_vu) { |
// Denullifiage |
foreach($obs as $k=>$v) { |
if (($v=="null") || ($v=="000null")) { |
$obs[$k]=""; |
97,7 → 97,7 |
else { |
$obs[$k]=utf8_decode($v); |
} |
} |
} |
|
if ($obs['date_observation']!="0000-00-00 00:00:00") { |
list($year,$month,$day)= explode('-',$obs['date_observation']); |
122,17 → 122,17 |
$worksheet->write($i,11,$obs['milieu']); |
$worksheet->write($i,12,$obs['commentaire']); |
$worksheet->write($i,13,$obs['courriel_utilisateur']); |
|
$i++; |
} |
|
$i++; |
} |
} |
|
|
// sending HTTP headers |
$workbook->send('liste.xls'); |
$workbook->close(); |
|
exit(); |
} |
|
exit(); |
} |
} |
|
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
150,6 → 150,6 |
* Securisation acces utilisateur |
* |
* |
* |
* |
*/ |
?> |