Ejemplo n.º 1
0
    $model->load();
}
$csv = new CsvIn();
/** FIXME: 
 * - set fields that should not be part of import
 * - set fields that must be part of import, and visually disable them in the list
 */
$fields = $model->getFields();
$defaults = $csv->getDefaultFields();
$defaults_loaded = false;
if ($fields === null) {
    $fields = $defaults;
    $defaults_loaded = true;
}
if (isset($_GET['generate'])) {
    $ocsv = new CsvOut();
    $res = $ocsv->export($fields, Csv::DEFAULT_SEPARATOR, Csv::DEFAULT_QUOTE, $fields);
    $filename = _T("galette_import_model.csv");
    header('Content-Type: text/csv');
    header('Content-Disposition: attachment; filename="' . $filename . '";');
    header('Pragma: no-cache');
    echo $res;
} else {
    $tpl->assign('success_detected', $success_detected);
    $tpl->assign('error_detected', $error_detected);
    $tpl->assign('fields', $fields);
    $tpl->assign('model', $model);
    $tpl->assign('defaults', $defaults);
    $import_fields = $members_fields;
    //we do not want to import id_adh. Never.
    unset($import_fields['id_adh']);
Ejemplo n.º 2
0
 */
use Analog\Analog;
use Galette\IO\Csv;
use Galette\IO\CsvOut;
use Galette\Filters\MembersList;
use Galette\Entity\FieldsConfig;
use Galette\Entity\Adherent;
use Galette\Entity\Status;
use Galette\Repository\Titles;
use Galette\Repository\Members;
/** @ignore */
require_once 'includes/galette.inc.php';
//Exports main contain user confidential data, they're accessible only for
//admins or staff members
if ($login->isAdmin() || $login->isStaff()) {
    $csv = new CsvOut();
    if (isset($session['filters']['members']) && !isset($_POST['mailing']) && !isset($_POST['mailing_new'])) {
        //CAUTION: this one may be simple or advanced, display must change
        $filters = unserialize($session['filters']['members']);
    } else {
        $filters = new MembersList();
    }
    $export_fields = null;
    if (file_exists(GALETTE_CONFIG_PATH . 'local_export_fields.inc.php')) {
        include_once GALETTE_CONFIG_PATH . 'local_export_fields.inc.php';
        $export_fields = $fields;
    }
    // fields visibility
    $fc = new FieldsConfig(Adherent::TABLE, $members_fields, $members_fields_cats);
    $visibles = $fc->getVisibilities();
    $fields = array();
Ejemplo n.º 3
0
 */
require_once 'includes/galette.inc.php';
if (!$login->isLogged()) {
    header('location: index.php');
    die;
}
if (!$login->isAdmin() && !$login->isStaff()) {
    header('location: voir_adherent.php');
    die;
}
use Galette\IO\Csv;
use Galette\IO\CsvOut;
use Galette\Entity\Adherent;
use Galette\Entity\FieldsConfig;
use Galette\Repository\Members;
$csv = new CsvOut();
$written = array();
$tables_list = $zdb->getTables();
if (isset($_GET['sup'])) {
    $res = $csv->remove($_GET['sup']);
    if ($res === true) {
        $success_detected[] = str_replace('%export', $_GET['sup'], _T("'%export' file has been removed from disk."));
    } else {
        $error_detected[] = str_replace('%export', $_GET['sup'], _T("Cannot remove '%export' from disk :/"));
    }
}
if (isset($_POST['export_tables']) && $_POST['export_tables'] != '') {
    foreach ($_POST['export_tables'] as $table) {
        $select = $zdb->sql->select($table);
        $results = $zdb->execute($select);
        if ($results->count() > 0) {