[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.boreport.inc.php,NONE,1.1 cla
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.boreport.inc.php,NONE,1.1 class.soreport.inc.php,NONE,1.1 class.uireport.inc.php,NONE,1.1 class.bodocument.inc.php,1.3,1.4 class.uidocument.inc.php,1.4,1.5 |
Date: |
Tue, 13 May 2003 17:12:54 -0400 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv31609/inc
Modified Files:
class.bodocument.inc.php class.uidocument.inc.php
Added Files:
class.boreport.inc.php class.soreport.inc.php
class.uireport.inc.php
Log Message:
no message
--- NEW FILE ---
<?php
/***************************************************************************\
* 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.
*
\***************************************************************************/
class boreport
{
var $start;
var $query;
var $filter;
var $sort;
var $order;
var $cat_id;
var $public_functions = array
(
'read' => True,
'read_single' => True,
'save' => True,
'delete' => True,
'check_perms' => True
);
var $soap_functions = array(
'list' => array(
'in' =>
array('int','int','struct','string','int'),
'out' => array('array')
),
'read' => array(
'in' => array('int','struct'),
'out' => array('array')
),
'save' => array(
'in' => array('int','struct'),
'out' => array()
),
'delete' => array(
'in' => array('int','struct'),
'out' => array()
)
);
function boreport($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.soreport');
$this->socommon =
CreateObject($this->currentapp.'.socommon');
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$this->vfs =
CreateObject('phpgwapi.vfs');
$this->rootdir = $this->vfs->basedir;
$this->fakebase = $this->vfs->fakebase;
$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'));
$district_id =
get_var('district_id',array('POST','GET'));
if ($start)
{
$this->start=$start;
}
else
{
$this->start=0;
}
if(isset($query))
{
$this->query = $query;
}
if(!empty($filter))
{
$this->filter = $filter;
}
if(isset($sort))
{
$this->sort = $sort;
}
if(isset($order))
{
$this->order = $order;
}
if(isset($cat_id))
{
$this->cat_id = $cat_id;
}
if(isset($district_id))
{
$this->district_id = $district_id;
}
}
function select_category_list($format='',$selected='')
{
switch($format)
{
case 'select':
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
break;
case 'filter':
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
break;
}
$categories= $this->so->select_category_list();
while (is_array($categories) && list(,$category) =
each($categories))
{
$sel_category = '';
if ($category['id']==$selected)
{
$sel_category = 'selected';
}
$category_list[] = array
(
'cat_id' => $category['id'],
'name' => $category['name'],
'selected' => $sel_category
);
}
for ($i=0;$i<count($category_list);$i++)
{
if ($category_list[$i]['selected'] !=
'selected')
{
unset($category_list[$i]['selected']);
}
}
return $category_list;
}
function select_status_list($format='',$selected='')
{
switch($format)
{
case 'select':
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
break;
case 'filter':
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
break;
}
$status_entries= $this->so->select_status_list();
while (is_array($status_entries) && list(,$status) =
each($status_entries))
{
$sel_status = '';
if ($status['id']==$selected)
{
$sel_status = 'selected';
}
$status_list[] = array
(
'id' => $status['id'],
'name' => $status['name'],
'selected' => $sel_status
);
}
for ($i=0;$i<count($status_list);$i++)
{
if ($status_list[$i]['selected'] != 'selected')
{
unset($status_list[$i]['selected']);
}
}
return $status_list;
}
function read()
{
$report = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' => $this->cat_id,'district_id' =>
$this->district_id));
$this->total_records = $this->so->total_records;
return $report;
}
function read_single($report_id)
{
$report = $this->so->read_single($report_id);
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
$report['date'] =
$GLOBALS['phpgw']->common->show_date($report['date'],$dateformat);
$location_data=$this->socommon->read_location_data($report['location_code']);
$report=$report + $location_data;
$report['files'] = $this->vfs->ls (array(
'string' => $this->fakebase. SEP .
'report' . SEP . $report['property_id'] . SEP . $report_id,
'relatives' => array(RELATIVE_NONE)));
//_debug_array($report['files']);
return $report;
}
function select_part_of_town($part_of_town_id)
{
return
$this->socommon->select_part_of_town($part_of_town_id);
}
function create_home_dir()
{
if(!$this->vfs->file_exists(array(
'string' => $this->fakebase. SEP .
'report',
'relatives' => Array(RELATIVE_NONE)
)))
{
$this->vfs->override_acl = 1;
if(!$this->vfs->mkdir (array(
'string' => $this->fakebase. SEP .
'report',
'relatives' => array(
RELATIVE_NONE
)
)))
{
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'report');
}
else
{
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'report');
}
$this->vfs->override_acl = 0;
}
return $receipt;
}
function create_document_dir($property_id='',$report_id='')
{
if(!$this->vfs->file_exists(array(
'string' => $this->fakebase. SEP .
'report' . SEP . $property_id,
'relatives' => Array(RELATIVE_NONE)
)))
{
$this->vfs->override_acl = 1;
if(!$this->vfs->mkdir (array(
'string' => $this->fakebase. SEP .
'report' . SEP . $property_id,
'relatives' => array(
RELATIVE_NONE
)
)))
{
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $property_id);
}
else
{
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $property_id);
}
$this->vfs->override_acl = 0;
}
if(!$this->vfs->file_exists(array(
'string' => $this->fakebase. SEP .
'report' . SEP . $property_id . SEP . $report_id,
'relatives' => Array(RELATIVE_NONE)
)))
{
$this->vfs->override_acl = 1;
if(!$this->vfs->mkdir (array(
'string' => $this->fakebase. SEP .
'report' . SEP . $property_id . SEP . $report_id,
'relatives' => array(
RELATIVE_NONE
)
)))
{
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $property_id . SEP . $report_id);
}
else
{
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'report' . SEP . $property_id . SEP . $report_id);
}
$this->vfs->override_acl = 0;
}
_debug_array($receipt);
return $receipt;
}
function save($report,$action='')
{
$report['location_code']=$this->bocommon->location_code($report['property_id'],$report['building_id'],$report['entrance_id'],$report['apartment_id']);
// $date = $this->bocommon->date_array($report['date']);
// $report['date'] = mktime
(2,0,0,$date['month'],$date['day'],$date['year']);
if($report['delete_file'])
{
for ($i=0;$i<count($report['delete_file']);$i++)
{
$file = $this->fakebase. SEP . 'report'
. SEP . $report['property_id'] . SEP . $report['report_id'] . SEP .
$report['delete_file'][$i];
if($this->vfs->file_exists(array(
'string' => $file,
'relatives' =>
Array(RELATIVE_NONE)
)))
{
$this->vfs->override_acl = 1;
if(!$this->vfs->rm (array(
'string' => $file,
'relatives' => array(
RELATIVE_NONE
)
)))
{
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'document'. SEP . $document_name);
}
else
{
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'document'. SEP . $document_name);
}
$this->vfs->override_acl = 0;
}
}
}
if ($action=='edit')
{
if
($this->so->check_report($report['report_id']))
{
$receipt = $this->so->edit($report);
}
else
{
$receipt['error'][]=array('msg'=>lang('This report ID does not exist!'));
}
}
else
{
if($this->so->check_report($report['report_id']))
{
$receipt['error'][]=array('msg'=>lang('This report ID already exists!'));
}
if(!$receipt['error'])
{
$receipt = $this->so->add($report);
}
}
return $receipt;
}
function read_single_report_type($report_type_id)
{
return
$this->so->read_single_report_type($report_type_id);
}
function delete($report_id)
{
$this->so->delete($report_id);
}
}
?>
--- NEW FILE ---
<?php
/***************************************************************************\
* 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.
*
\***************************************************************************/
class soreport
{
var $grants;
function soreport()
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
$this->grants =
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->bocommon =
CreateObject($this->currentapp.'.bocommon',True);
if
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
{
$this->join = " JOIN ";
}
else
{
$this->join = " LEFT JOIN ";
}
}
function select_category_list()
{
$this->db->query("SELECT id,name FROM fm_report_type
ORDER BY descr ");
$i = 0;
while ($this->db->next_record())
{
$categories[$i]['id']
= $this->db->f('id');
$categories[$i]['name']
= stripslashes($this->db->f('name'));
$i++;
}
return $categories;
}
function select_status_list()
{
$this->db->query("SELECT id, descr FROM
fm_report_status ORDER BY id ");
$i = 0;
while ($this->db->next_record())
{
$status_entries[$i]['id']
= $this->db->f('id');
$status_entries[$i]['name']
= stripslashes($this->db->f('descr'));
$i++;
}
return $status_entries;
}
function read($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$filter =
(isset($data['filter'])?$data['filter']:'');
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
$district_id =
(isset($data['district_id'])?$data['district_id']:0);
}
if ($order)
{
$ordermethod = " order by fm_report.$order
$sort";
}
else
{
$ordermethod = ' order by report_id ASC';
}
$filtermethod = ' ( fm_report.owner=' . $this->account;
if (is_array($this->grants))
{
$grants = $this->grants;
while (list($user) = each($grants))
{
$public_user_list[] = $user;
}
reset($public_user_list);
$filtermethod .= " OR
(fm_report.access='public' OR fm_report.owner IN(" .
implode(',',$public_user_list) . ")))";
}
else
{
$filtermethod .= ' )';
}
if ($cat_id > 0)
{
$filtermethod .= " AND
fm_report.report_type_id='$cat_id' ";
}
if ($district_id > 0)
{
$filtermethod .= " AND
district_id='$district_id' ";
}
if ($filter > 0)
{
$filtermethod .= " AND
fm_report.owner='$filter' ";
}
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " AND fm_report.property_id LIKE
'%$query%' or fm_report.title LIKE '%$query%' or fm_report.address LIKE
'%$query%'";
}
$sql = "SELECT
report_id,fm_report.location_code,fm_report.title,fm_report.address as address,
fm_report_type.name as category"
. " FROM fm_report $this->join"
. " fm_property ON fm_report.property_id =
fm_property.property_id $this->join"
. " fm_part_of_town ON fm_property.part_of_town_id =
fm_part_of_town.id $this->join"
. " fm_report_type ON fm_report.report_type_id =
fm_report_type.id "
. " WHERE $filtermethod $querymethod ";
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
while ($this->db->next_record())
{
$ngrants =
(int)$this->grants[$this->db->f('fm_report.owner')];
$report_list[] = array
(
'report_id' =>
$this->db->f('report_id'),
'location_code' =>
$this->db->f('location_code'),
'address' =>
$this->db->f('address'),
'category' =>
$this->db->f('category'),
'title' =>
$this->db->f('title'),
'grants' => $ngrants
);
}
//_debug_array($report_list);
return $report_list;
}
function read_single($report_id)
{
$sql = "SELECT
location_code,report_type_id,title,abstract,status,entry_date from "
. " fm_report WHERE report_id='$report_id'";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$report['report_id'] = $report_id;
$report['location_code'] =
$this->db->f('location_code');
$report['title'] =
$this->db->f('title');
$report['abstract'] =
$this->db->f('abstract');
$report['status'] =
$this->db->f('status');
$report['owner'] =
$this->db->f('owner');
$report['access'] =
$this->db->f('access');
$report['date'] =
$this->db->f('date');
$report['cat_id'] =
$this->db->f('report_type_id');
//_debug_array($report);
}
$sql = "SELECT * FROM fm_report_origin WHERE
report_id='$report_id'";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$report['origin_id'] =
$this->db->f('origin_id');
$report['origin'] =
$this->db->f('origin');
}
return $report;
}
function check_report($report_id='')
{
$this->db->query("SELECT count(*) FROM fm_report where
report_id='$report_id'");
$this->db->next_record();
if ( $this->db->f(0))
{
return True;
}
}
function read_single_report_type($report_type_id)
{
$this->db->query("SELECT name FROM fm_report_type
where id='$report_type_id'");
$this->db->next_record();
return $this->db->f('name');
}
function generate_id($report_type)
{
$year =
$GLOBALS['phpgw']->common->show_date(time(),'Y');
$this->db->query("select prefix from fm_report_type
where id='$report_type' ");
$this->db->next_record();
$prefix = $this->db->f('prefix');
//echo 'prefix ' .$prefix .'<br>' ;
// $prefix = $prefix . $year . '-';
$pos = strlen($prefix);
$this->db->query("select max(report_id) from fm_report
where report_id like ('$prefix%')");
$this->db->next_record();
$max =
$this->bocommon->add_leading_zero(substr($this->db->f(0),$pos));
return $prefix . $max;
}
function add($report)
{
if($report['street_number'])
{
$address= $report['street_name'] . ' ' .
$report['street_number'];
}
else
{
$address= $report['street_name'];
}
$report['descr'] =
$this->db->db_addslashes($report['descr']);
//_debug_array($report);
$this->db->query("INSERT INTO fm_report
(report_id,abstract,status,report_type_id,entry_date,title,location_code,property_id,address,owner)
"
. "VALUES ('"
. $report['report_id']. "','"
. $report['abstract']. "','"
. $report['status']. "','"
. $report['cat_id']. "','"
. time(). "','"
. $report['title']. "','"
. $report['location_code']. "','"
. $report['property_id']. "','"
. $address . "','"
. $this->account. "')",__LINE__,__FILE__);
if($report['origin'] && $report['origin_id'])
{
$this->db->query("INSERT INTO fm_report_origin
(origin,origin_id,report_id) "
. "VALUES ('"
. $report['origin']. "','"
. $report['origin_id']. "','"
. $report['report_id'].
"')",__LINE__,__FILE__);
}
$receipt['message'][] = array('msg'=>lang('report %1
has been saved',$report['report_id']));
return $receipt;
}
function edit($report)
{
//_debug_array($report);
if($report['street_number'])
{
$address= $report['street_name'] . ' ' .
$report['street_number'];
}
else
{
$address= $report['street_name'];
}
$report['descr'] =
$this->db->db_addslashes($report['descr']);
$this->db->query("UPDATE fm_report set
abstract='" . $report['abstract'] . "',
status='" . $report['status'] . "',
report_type_id='" . $report['cat_id'] .
"',
title='" . $report['title'] . "',
location_code='" . $report['location_code'] .
"',
property_id='" . $report['property_id'] . "',
address='" . $address
. "' WHERE report_id= '" . $report['report_id']
."'",__LINE__,__FILE__);
$receipt['message'][] = array('msg'=>lang('report %1
has been edited',$report['report_id']));
return $receipt;
}
function delete($report_id )
{
$this->db->query("DELETE FROM fm_report WHERE
report_id='" . $report_id . "'",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_report_attrib WHERE
entity_id='" . $report_id . "'",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_report_origin WHERE
report_id='" . $report_id . "'",__LINE__,__FILE__);
}
}
?>
--- NEW FILE ---
<?php
/***************************************************************************\
* -------------------------------------------------
*
* 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.
*
\***************************************************************************/
class uireport
{
var $grants;
var $cat_id;
var $start;
var $query;
var $sort;
var $order;
var $filter;
var $part_of_town_id;
var $sub;
var $currentapp;
var $public_functions = array
(
'index' => True,
'view' => True,
'edit' => True,
'view_file' => True,
'delete' => True
);
function uireport()
{
$GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->grants =
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
$this->grants[$this->account] = PHPGW_ACL_READ +
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
$this->bo =
CreateObject($this->currentapp.'.boreport',True);
$this->so =
CreateObject($this->currentapp.'.soreport',True);
$this->bocommon =
CreateObject($this->currentapp.'.bocommon',True);
$this->fakebase =
$this->bo->fakebase;
$this->start =
$this->bo->start;
$this->query =
$this->bo->query;
$this->sort =
$this->bo->sort;
$this->order =
$this->bo->order;
$this->filter =
$this->bo->filter;
$this->cat_id =
$this->bo->cat_id;
$this->part_of_town_id =
$this->bocommon->part_of_town_id;
$this->district_id =
$this->bocommon->district_id;
$GLOBALS['phpgw']->session->appsession('sub',$this->currentapp,'report');
}
function save_sessiondata()
{
$data = array
(
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
'filter' => $this->filter,
'cat_id' => $this->cat_id
);
$this->bocommon->save_sessiondata($data);
}
function index()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('report',
'menu',
'nextmatchs',
'search_field'));
$sub = get_var('sub',array('POST','GET'));
$links = $this->bocommon->menu($sub);
$report_list = $this->bo->read();
//_debug_array($report_list);
while (is_array($report_list) && list(,$report) =
each($report_list))
{
$value_attribute =
(isset($report['attribute'])?$report['attribute']:'');
$location = split("-",
$report['location_code']);
$content[] = array
(
'report_id'
=> $report['report_id'],
'title'
=> $report['title'],
'property_id'
=> $location[0],
'building_id'
=> $location[1],
'entrance_id'
=> $location[2],
'floor'
=> $report['floor'],
'apartment_id'
=> $location[3],
'address'
=> $report['address'],
'category'
=> $report['category'],
'date'
=> $report['date'],
'owner'
=> $report['owner'],
'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.view&id='
. $report['report_id']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.edit&id='
. $report['report_id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.delete&report_id='
. $report['report_id']),
'lang_view_statustext' =>
lang('view the report'),
'lang_edit_statustext' =>
lang('edit the report'),
'lang_delete_statustext' =>
lang('delete this report'),
'text_view'
=> lang('view'),
'value_attribute'
=> $value_attribute,
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
}
$table_header[] = array
(
'sort_report' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'report_id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uireport.index',
'cat_id'
=>$this->cat_id,
'district_id' =>
$this->district_id,
'filter'
=>$this->filter,
'query'
=>$this->query)
)),
'lang_report' => lang('report'),
'lang_title' => lang('Title'),
'sort_property' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'property_id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uireport.index',
'cat_id'
=>$this->cat_id,
'district_id' =>
$this->district_id,
'filter'
=>$this->filter,
'query'
=>$this->query)
)),
'lang_property' => lang('Property'),
'lang_building' => lang('Building'),
'lang_entrance' => lang('Entrance'),
'lang_floor' => lang('Floor'),
'lang_apartment' => lang('Apartment'),
'sort_address' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'address',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uireport.index',
'cat_id'
=>$this->cat_id,
'district_id' =>
$this->district_id,
'filter'
=>$this->filter,
'query'
=>$this->query)
)),
'lang_address' => lang('Address'),
'lang_category' => lang('Category'),
'attribute' =>
$value_attribute,
'lang_attribute' => lang('Attribute'),
'lang_view' => lang('view'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete')
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_statustext' => lang('add a report'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.edit')
);
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uireport.index',
'sort'
=>$this->sort,
'order'
=>$this->order,
'cat_id'
=>$this->cat_id,
'district_id'
=>$this->district_id,
'filter'
=>$this->filter,
'query'
=>$this->query
);
$data = array
(
'links'
=> $links,
'allow_allrows'
=> false,
'start_record'
=> $this->start,
'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
'num_records'
=> count($report_list),
'all_records'
=> $this->bo->total_records,
'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'lang_no_cat'
=> lang('no category'),
'lang_cat_statustext' =>
lang('Select the category the report belongs to. To do not use a category
select NO CATEGORY'),
'select_name'
=> 'cat_id',
'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
'lang_no_district'
=> lang('no district'),
'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
'select_district_name' =>
'district_id',
'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'lang_user_statustext' =>
lang('Select the user the project belongs to. To do not use a category select
NO USER'),
'select_user_name'
=> 'filter',
'lang_no_user'
=> lang('No user'),
'user_list'
=> $this->bocommon->get_user_list('filter',$this->filter),
'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_statustext' => lang('Submit
the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header'
=> $table_header,
'values'
=> $content,
'table_add'
=> $table_add
);
$appname
= lang('report');
$function_msg =
lang('list report');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
$this->save_sessiondata();
}
function view_file()
{
$GLOBALS['phpgw_info']['flags']['noframework'] = True;
$file_name =
get_var('file_name',array('POST','GET'));
$property_id =
get_var('property_id',array('POST','GET'));
$report_id =
get_var('report_id',array('POST','GET'));
$file = $this->fakebase. SEP . 'report' . SEP .
$property_id . SEP . $report_id . SEP . $file_name;
//echo 'file: ' . $file . '<br>';
if($this->bo->vfs->file_exists(array(
'string' => $file,
'relatives' => Array(RELATIVE_NONE)
)))
{
$filename = current(explode('.',
basename($file_name)));
$filetype =
$this->bo->vfs->file_type(array(
'string' => $file,
'relatives' =>
Array(RELATIVE_NONE)));
$size =
$this->bo->vfs->get_size(array(
'string' => $file,
'relatives' =>
Array(RELATIVE_NONE),
'checksubdirs' =>
True));
$browser = CreateObject('phpgwapi.browser');
$browser->content_header($filename,$filetype,$size);
$document= $this->bo->vfs->read(array(
'string' => $file,
'relatives' => Array(RELATIVE_NONE)));
echo $document;
flush();
}
}
function edit()
{
$id =
get_var('id',array('POST','GET'));
$values =
get_var('values',array('POST','GET'));
$values_attribute =
get_var('values_attribute',array('POST','GET'));
//_debug_array($values);
$GLOBALS['phpgw']->xslttpl->add_file(array('report'));
$bypass =
get_var('bypass',array('POST','GET'));
if($values && !$bypass)
{
$values = $values +
$this->bocommon->get_location();
}
else
{
$location_code =
get_var('location_code',array('POST','GET'));
$values['tenant_id'] =
get_var('tenant_id',array('POST','GET'));
$values['equipment_id'] =
get_var('equipment_id',array('POST','GET'));
$ticket_id
= get_var('ticket_id',array('POST','GET'));
if($ticket_id)
{
$values['origin']= 'ticket';
$values['origin_id']= $ticket_id;
}
if($values['tenant_id'])
{
$tenant_data=$this->bocommon->read_single_tenant($values['tenant_id']);
$values['tenant_phone']=
$tenant_data['tenant_phone'];
$values['tenant_name']=
$tenant_data['last_name'] . ', ' . $tenant_data['first_name'];
}
if($location_code)
{
$location_data=$this->bocommon->read_location_data($location_code);
$values=$values + $location_data;
}
}
$receipt = $this->bo->create_home_dir();
if ($values['save'])
{
if($id)
{
$values['file_name']=$_FILES['file']['name'];
$to_file = $this->fakebase. SEP .
'report' . SEP . $values['property_id'] . SEP . $id . SEP .
$values['file_name'];
if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
'string' => $to_file,
'relatives' =>
Array(RELATIVE_NONE)
)))
{
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
}
}
if(!$values['cat_id'])
{
$receipt['error'][]=array('msg'=>lang('Please select report type !'));
$error_id=true;
}
if(!$values['status'])
{
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
}
if($id)
{
$values['report_id']=$id;
$action='edit';
}
else
{
if (!$receipt['error'])
{
$values['report_id']=$this->so->generate_id($values['cat_id']);
}
}
if(!$receipt['error'])
{
$receipt =
$this->bo->save($values,$action);
$id = $values['report_id'];
$function_msg = lang('edit report');
if($values_attribute)
{
$this->bocommon->save_attributes($values_attribute,'report');
}
if($values['file_name'])
{
$this->bo->create_document_dir($values['property_id'], $values['report_id']);
$this->bo->vfs->cp (array (
'from' =>
$_FILES['file']['tmp_name'],
'to' => $to_file,
'relatives' =>
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)));
}
}
}
/* else
{
if ($id)
{
$values = $this->bo->read_single($id);
}
}
*/
$values = $this->bo->read_single($id);
$location_type='form';
if ($id)
{
$function_msg = lang('edit report');
}
else
{
$function_msg = lang('add report');
}
if ($values['cat_id'])
{
$this->cat_id = $values['cat_id'];
}
$location_data=$this->bocommon->initiate_ui_location(array(
'location_type' =>
$location_type,
'report' =>
false,
'apartment' => true,
'address' => true,
'property_id' =>
$values['property_id'],
'property_name' =>
$values['property_name'],
'building_id' =>
$values['building_id'],
'entrance_id' =>
$values['entrance_id'],
'floor' =>
$values['floor'],
'street_name' =>
$values['street_name'],
'street_number' =>
$values['street_number'],
'apartment_id' =>
$values['apartment_id']));
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
'vendor_id' =>
$values['vendor_id'],
'vendor_name' =>
$values['vendor_name']));
if($values['report_id'])
{
$cat_text =
$this->bo->read_single_report_type($values['cat_id']);
$attributes_values =
$this->bocommon->read_attibutes(array('form'=>true,'type'=>'report','type_id'=>$values['cat_id'],'id'=>$values['report_id']));
$attributes_header[] = array
(
'lang_name' => lang('Name'),
'lang_descr' => lang('Description'),
'lang_datatype' => lang('Datatype'),
'lang_value' => lang('Value')
);
}
if($error_id)
{
unset($values['report_id']);
unset($id);
}
if($values['origin']== 'ticket')
{
$origin_data = array
(
'menuaction' =>
$this->currentapp.'.uitts.view',
'id' =>
$values['origin_id']
);
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uireport.edit',
'id' => $id
);
$dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
$sep = '/';
$dlarr[strpos($dateformat,'y')] = 'yyyy';
$dlarr[strpos($dateformat,'m')] = 'MM';
$dlarr[strpos($dateformat,'d')] = 'DD';
ksort($dlarr);
$dateformat= (implode($sep,$dlarr));
switch(substr($dateformat,0,1))
{
case 'M':
$dateformat_validate=
"javascript:vDateType='1'";
$onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
$onBlur =
"DateFormat(this,this.value,event,true,'1')";
break;
case 'y':
$dateformat_validate="javascript:vDateType='2'";
$onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
$onBlur =
"DateFormat(this,this.value,event,true,'2')";
break;
case 'D':
$dateformat_validate="javascript:vDateType='3'";
$onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
$onBlur =
"DateFormat(this,this.value,event,true,'3')";
break;
}
$data = array
(
'property_id'
=> $values['property_id'],
'link_view_file'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.view_file&property_id='
. $values['property_id'] . '&report_id=' . $id),
'files'
=> $values['files'],
'lang_files'
=> lang('files'),
'lang_delete_file'
=> lang('Delete file'),
'lang_view_file_statustext' =>
lang('Klick to view file'),
'lang_delete_file_statustext' => lang('Check
to delete file'),
'lang_upload_file'
=> lang('Upload file'),
'lang_file_statustext' =>
lang('Select file to upload'),
'lang_dateformat'
=> lang(strtolower($dateformat)),
'dateformat_validate' =>
$dateformat_validate,
'onKeyUp'
=> $onKeyUp,
'onBlur'
=> $onBlur,
'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
'lang_attributes'
=> lang('Attributes'),
'attributes_header'
=> $attributes_header,
'attributes_values'
=> $attributes_values,
'lang_title'
=> lang('Title'),
'lang_title_statustext' =>
lang('Enter Report Title'),
'value_title'
=> $values['title'],
'lang_origin'
=> lang('origin'),
'lang_origin_statustext' =>
lang('Link to the origin for this report'),
'link_origin'
=> $GLOBALS['phpgw']->link('/index.php',$origin_data),
'value_origin'
=> $values['origin'],
'value_origin_id'
=> $values['origin_id'],
'location_data'
=> $location_data,
'location_type'
=> $location_type,
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.index'),
'lang_property_id'
=> lang('Property ID'),
'lang_category'
=> lang('category'),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'lang_report_id'
=> lang('report ID'),
'value_report_id' =>
$values['report_id'],
'lang_report_id_statustext' => lang('Enter
report ID'),
'cat_text'
=> $cat_text,
'error'
=> $receipt['error'],
'error_flag'
=> $error_id,
'message'
=> $receipt['message'],
'lang_abstract_statustext' =>
lang('Enter the abstract of the report'),
'lang_abstract'
=> lang('Abstract'),
'value_abstract'
=> $values['abstract'],
'lang_done_statustext' =>
lang('Back to the list'),
'lang_save_statustext' =>
lang('Save the report'),
'lang_no_cat'
=> lang('no category'),
'lang_cat_statustext' =>
lang('Select the category the report belongs to. To do not use a category
select NO CATEGORY'),
'select_name'
=> 'values[cat_id]',
'value_cat_id'
=> $values['cat_id'],
'cat_list'
=> $this->bo->select_category_list('select',$values['cat_id']),
'status_list'
=> $this->bo->select_status_list('select',$values['status']),
'select_status_name' =>
'values[status]',
'lang_no_status'
=> lang('Select status'),
'lang_status'
=> lang('Status'),
'lang_status_statustext' =>
lang('What is the current status of this report ?'),
'lang_cost'
=> lang('Purchase cost'),
'value_cost'
=> $values['cost'],
'lang_cost_statustext' =>
lang('Enter the purchase cost'),
'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
);
$appname
= lang('report');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
}
function delete()
{
$report_id = get_var('report_id',array('POST','GET'));
$confirm = get_var('confirm',array('POST'));
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uireport.index'
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete($report_id);
Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
}
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
$data = array
(
'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.delete&report_id='
. $report_id),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
'lang_yes_statustext' => lang('Delete the
entry'),
'lang_no_statustext' => lang('Back to the
list'),
'lang_no' =>
lang('no')
);
$appname
= lang('report');
$function_msg =
lang('delete report');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
function view()
{
$id = get_var('id',array('POST','GET'));
$values = $this->bo->read_single($id);
$GLOBALS['phpgw']->xslttpl->add_file(array('report'));
$location_data=$this->bocommon->initiate_ui_location(array(
'location_type' => 'view',
'apartment' => true,
'address' => true,
'property_id' =>
$values['property_id'],
'property_name' =>
$values['property_name'],
'building_id' =>
$values['building_id'],
'entrance_id' =>
$values['entrance_id'],
'floor' =>
$values['floor'],
'street_name' =>
$values['street_name'],
'street_number' =>
$values['street_number'],
'apartment_id' =>
$values['apartment_id']));
$cat_text =
$this->bo->read_single_report_type($values['cat_id']);
$attributes_values =
$this->bocommon->read_attibutes(array('form'=>false,'type'=>'report','type_id'=>$values['cat_id'],'id'=>$id));
$attributes_header[] = array(
'lang_name' => lang('Name'),
'lang_descr' => lang('Description'),
'lang_datatype' => lang('Datatype'),
'lang_value' => lang('Value')
);
if($values['origin']== 'ticket')
{
$origin_data = array
(
'menuaction' =>
$this->currentapp.'.uitts.view',
'id' =>
$values['origin_id']
);
}
$data = array
(
'lang_attributes' =>
lang('Attributes'),
'attributes_header' =>
$attributes_header,
'attributes_values' =>
$attributes_values,
'lang_date'
=> lang('date'),
'value_date' =>
$values['date'],
'location_data' =>
$location_data,
'lang_category' =>
lang('category'),
'lang_report_id' =>
lang('report ID'),
'value_report_id' =>
$values['report_id'],
'cat_text'
=> $cat_text,
'lang_origin'
=> lang('origin'),
'lang_origin_statustext' =>
lang('Link to the origin for this report'),
'link_origin'
=> $GLOBALS['phpgw']->link('/index.php',$origin_data),
'value_origin_id'
=> $values['origin_id'],
'lang_abstract' =>
lang('Abstract'),
'value_abstract' =>
$values['abstract'],
'lang_title' =>
lang('Title'),
'value_title' =>
$values['title'],
'lang_status' =>
lang('Status'),
'status_list' =>
$this->bo->select_status_list('select',$values['status']),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.index'),
'edit_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uireport.edit&id='
. $id),
'lang_done_statustext' => lang('Back
to the list'),
'lang_edit_statustext' => lang('Edit
this entry report'),
'lang_done'
=> lang('done'),
'lang_edit'
=> lang('Edit')
);
$appname
= lang('report');
$function_msg =
lang('view report');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
}
}
?>
Index: class.bodocument.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bodocument.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.bodocument.inc.php 29 Apr 2003 12:41:31 -0000 1.3
--- class.bodocument.inc.php 13 May 2003 21:12:50 -0000 1.4
***************
*** 399,404 ****
$this->vfs->override_acl = 0;
}
! //_debug_array($receipt);
!
}
--- 399,403 ----
$this->vfs->override_acl = 0;
}
! return $receipt;
}
Index: class.uidocument.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uidocument.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.uidocument.inc.php 8 May 2003 13:56:29 -0000 1.4
--- class.uidocument.inc.php 13 May 2003 21:12:50 -0000 1.5
***************
*** 465,469 ****
$GLOBALS['phpgw']->xslttpl->add_file(array('document'));
! $this->bo->create_home_dir();
if($values)
--- 465,469 ----
$GLOBALS['phpgw']->xslttpl->add_file(array('document'));
! $receipt = $this->bo->create_home_dir();
if($values)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.boreport.inc.php,NONE,1.1 class.soreport.inc.php,NONE,1.1 class.uireport.inc.php,NONE,1.1 class.bodocument.inc.php,1.3,1.4 class.uidocument.inc.php,1.4,1.5,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/setup setup.inc.php,1.48,1.49 tables_current.inc.php,1.75,1.76
- Next by Date:
[Phpgroupware-cvs] CVS: property/templates/default report.xsl,NONE,1.1
- Previous by thread:
[Phpgroupware-cvs] CVS: property/setup setup.inc.php,1.48,1.49 tables_current.inc.php,1.75,1.76
- Next by thread:
[Phpgroupware-cvs] CVS: property/templates/default report.xsl,NONE,1.1
- Index(es):