[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc/class.boXport.inc.php, 1.2
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/inc/class.boXport.inc.php, 1.2 |
Date: |
Wed, 2 Jun 2004 20:54:28 +0200 |
Update of /property/inc
Added Files:
Branch:
class.boXport.inc.php
date: 2004/06/02 18:54:28; author: sigurdne; state: Exp; lines: +269 -0
Log Message:
no message
=====================================================================
<?php
/**************************************************************************\
* phpGroupWare - property
*
* http://www.phpgroupware.org
*
*
*
* Facilities Management
*
* Written by Sigurd Nes [sigurdne at online.no]
*
*
------------------------------------------------------------------------ *
* Copyright 2000 - 2003 Free Software Foundation, Inc
*
* This program is part of the GNU project, see http://www.gnu.org/
*
*
------------------------------------------------------------------------ *
* This program is free software; you can redistribute it and/or modify
it *
* under the terms of the GNU General Public License as published by the
*
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
\**************************************************************************/
/* $Id: class.boXport.inc.php,v 1.2 2004/06/02 18:54:28 sigurdne Exp $ */
class boXport
{
var $public_functions = array(
'import' => True,
'export' => True
);
var $start;
var $query;
var $sort;
var $order;
var $filter;
var $cat_id;
var $use_session = False;
function boXport ($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->config =
CreateObject('phpgwapi.config',$this->currentapp);
if($session)
{
$this->read_sessiondata();
$this->use_session = True;
}
$start = get_var('start',array('POST','GET'));
$query = get_var('query',array('POST','GET'));
$sort = get_var('sort',array('POST','GET'));
$order = get_var('order',array('POST','GET'));
$filter = get_var('filter',array('POST','GET'));
$cat_id = get_var('cat_id',array('POST','GET'));
if($start || $start == 0) { $this->start = $start; }
if($query) { $this->query = $query; }
if($sort) { $this->sort = $sort; }
if($order) { $this->order = $order; }
if($filter) { $this->filter = $filter; }
$this->cat_id = $cat_id;
}
function save_sessiondata()
{
if ($this->use_session)
{
$data = array(
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
'filter' => $this->filter,
'cat_id' => $this->cat_id
);
if($this->debug) { echo '<br>Save:';
_debug_array($data); }
$GLOBALS['phpgw']->session->appsession('session_data','export',$data);
}
}
function read_sessiondata()
{
$data =
$GLOBALS['phpgw']->session->appsession('session_data','export');
if($this->debug) { echo '<br>Read:';
_debug_array($data); }
$this->start = $data['start'];
$this->query = $data['query'];
$this->sort = $data['sort'];
$this->order = $data['order'];
$this->filter = $data['filter'];
$this->cat_id = $data['cat_id'];
}
function select_import_conv($selected='')
{
$dir_handle = opendir(PHPGW_APP_INC . SEP . 'import');
$i=0; $myfilearray = '';
while ($file = readdir($dir_handle))
{
if ((substr($file, 0, 1) != '.') &&
is_file(PHPGW_APP_INC . SEP . 'import' . SEP . $file) )
{
$myfilearray[$i] = $file;
$i++;
}
}
closedir($dir_handle);
sort($myfilearray);
for ($i=0;$i<count($myfilearray);$i++)
{
$fname = ereg_replace('_',' ',$myfilearray[$i]);
$sel_file = '';
if ($myfilearray[$i]==$selected)
{
$sel_file = 'selected';
}
$conv_list[] = array
(
'id' => $myfilearray[$i],
'name' => $fname,
'selected' => $sel_file
);
}
for ($i=0;$i<count($conv_list);$i++)
{
if ($conv_list[$i]['selected'] != 'selected')
{
unset($conv_list[$i]['selected']);
}
}
return $conv_list;
}
function select_export_conv($selected='')
{
$dir_handle = opendir(PHPGW_APP_INC . SEP . 'export');
$i=0; $myfilearray = '';
while ($file = readdir($dir_handle))
{
if ((substr($file, 0, 1) != '.') &&
is_file(PHPGW_APP_INC . SEP . 'export' . SEP . $file) )
{
$myfilearray[$i] = $file;
$i++;
}
}
closedir($dir_handle);
sort($myfilearray);
for ($i=0;$i<count($myfilearray);$i++)
{
$fname = ereg_replace('_',' ',$myfilearray[$i]);
$sel_file = '';
if ($myfilearray[$i]==$selected)
{
$sel_file = 'selected';
}
$conv_list[] = array
(
'id' => $myfilearray[$i],
'name' => $fname,
'selected' => $sel_file
);
}
for ($i=0;$i<count($conv_list);$i++)
{
if ($conv_list[$i]['selected'] != 'selected')
{
unset($conv_list[$i]['selected']);
}
}
return $conv_list;
}
function select_rollback_file($selected='')
{
$this->config->read_repository();
$file_catalog =
$this->config->config_data['export_path'];
$dir_handle = opendir($file_catalog);
$i=0; $myfilearray = '';
while ($file = readdir($dir_handle))
{
if ((substr($file, 0, 1) != '.') &&
is_file($file_catalog . SEP . $file) )
{
$myfilearray[$i] = $file;
$i++;
}
}
closedir($dir_handle);
@sort($myfilearray);
for ($i=0;$i<count($myfilearray);$i++)
{
$fname = ereg_replace('_',' ',$myfilearray[$i]);
$sel_file = '';
if ($myfilearray[$i]==$selected)
{
$sel_file = 'selected';
}
$rollback_list[] = array
(
'id' => $myfilearray[$i],
'name' => $fname,
'selected' => $sel_file
);
}
for ($i=0;$i<count($rollback_list);$i++)
{
if ($rollback_list[$i]['selected'] !=
'selected')
{
unset($rollback_list[$i]['selected']);
}
}
return $rollback_list;
}
function import($invoice_common,$download)
{
include (PHPGW_APP_INC . '/import/' .
$invoice_common['conv_type']);
$invoice = new import_conv;
$buffer = $invoice->import($invoice_common,$download);
if ($download)
{
$header = $invoice->header;
$import = $invoice->import;
$buffer= array(
'table' => $buffer,
'header' => $header,
'import' => $import
);
}
return $buffer;
}
function export($conv_type,$download)
{
include (PHPGW_APP_INC . '/export/' . $conv_type);
$invoice = new export_conv;
$buffer = $invoice->overfor($download);
$tsvfilename =
$GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $tsvfilename;
return $buffer;
}
function rollback($conv_type,$role_back_date,$rollback_file)
{
include (PHPGW_APP_INC . '/export/' . $conv_type);
$invoice = new export_conv;
$buffer =
$invoice->RullTilbake($role_back_date,$rollback_file);
return $buffer;
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc/class.boXport.inc.php, 1.2,
nomail <=