[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.boadmin_location.inc.php,NON
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.boadmin_location.inc.php,NONE,1.1 class.soadmin_location.inc.php,NONE,1.1 class.uiadmin_location.inc.php,NONE,1.1 |
Date: |
Thu, 29 May 2003 03:42:54 -0400 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv18025/inc
Added Files:
class.boadmin_location.inc.php class.soadmin_location.inc.php
class.uiadmin_location.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 boadmin_location
{
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 boadmin_location($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.soadmin_location');
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
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)
{
$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;
}
}
function save_sessiondata($data)
{
if ($this->use_session)
{
$GLOBALS['phpgw']->session->appsession('session_data','standard_e',$data);
}
}
function read_sessiondata()
{
$data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_e');
$this->start = $data['start'];
$this->query = $data['query'];
$this->filter = $data['filter'];
$this->sort = $data['sort'];
$this->order = $data['order'];
$this->cat_id = $data['cat_id'];
}
function read()
{
$standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
$this->total_records = $this->so->total_records;
return $standard;
}
function read_config()
{
$standard = $this->so->read_config(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
$this->total_records = $this->so->total_records;
return $standard;
}
function read_single($id)
{
return $this->so->read_single($id);
}
function save($standard,$action='')
{
if ($action=='edit')
{
if ($standard['id'] != '')
{
$receipt = $this->so->edit($standard);
}
}
else
{
$receipt = $this->so->add($standard);
}
return $receipt;
}
function delete($id,$attrib)
{
$this->so->delete($id,$attrib);
}
function read_attrib($type_id='')
{
$attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'type_id' => $type_id));
$this->total_records = $this->so->total_records;
for ($i=0; $i<count($attrib); $i++)
{
// $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype_attributes($attrib[$i]['datatype']);
}
return $attrib;
}
function read_single_attrib($id)
{
return $this->so->read_single_attrib($id);
}
function save_attrib($attrib,$action='')
{
if ($action=='edit')
{
if ($attrib['id'] != '')
{
$receipt =
$this->so->edit_attrib($attrib);
}
}
else
{
$receipt = $this->so->add_attrib($attrib);
}
return $receipt;
}
function select_entity_type($selected='')
{
$entity_types= $this->so->select_entity_type();
while (is_array($entity_types) && list(,$type) =
each($entity_types))
{
$sel_type = '';
if ($type['id']==$selected)
{
$sel_type = 'selected';
}
$entity_type_list[] = array
(
'id' => $type['id'],
'name' => $type['name'],
'selected' => $sel_type
);
}
for ($i=0;$i<count($entity_type_list);$i++)
{
if ($entity_type_list[$i]['selected'] !=
'selected')
{
unset($entity_type_list[$i]['selected']);
}
}
return $entity_type_list;
}
function select_datatype($selected='')
{
$datatypes[0]['id']= 'varchar';
$datatypes[0]['name']= lang('varchar');
$datatypes[1]['id']= 'char';
$datatypes[1]['name']= lang('char');
$datatypes[2]['id']= 'int';
$datatypes[2]['name']= lang('integer');
$datatypes[3]['id']= 'text';
$datatypes[3]['name']= lang('text');
$datatypes[4]['id']= 'decimal';
$datatypes[4]['name']= lang('decimal');
while (is_array($datatypes) && list(,$type) =
each($datatypes))
{
$sel_type = '';
if ($type['id']==$selected)
{
$sel_type = 'selected';
}
$datatype_list[] = array
(
'id' => $type['id'],
'name' => $type['name'],
'selected' => $sel_type
);
}
for ($i=0;$i<count($datatype_list);$i++)
{
if ($datatype_list[$i]['selected'] !=
'selected')
{
unset($datatype_list[$i]['selected']);
}
}
return $datatype_list;
}
function select_nullable($selected='')
{
$nullable[0]['id']= 'True';
$nullable[0]['name']= lang('True');
$nullable[1]['id']= 'False';
$nullable[1]['name']= lang('False');
while (is_array($nullable) && list(,$type) =
each($nullable))
{
$sel_type = '';
if ($type['id']==$selected)
{
$sel_type = 'selected';
}
$nullable_list[] = array
(
'id' => $type['id'],
'name' => $type['name'],
'selected' => $sel_type
);
}
for ($i=0;$i<count($nullable_list);$i++)
{
if ($nullable_list[$i]['selected'] !=
'selected')
{
unset($nullable_list[$i]['selected']);
}
}
return $nullable_list;
}
}
?>
--- 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 soadmin_location
{
var $grants;
function soadmin_location()
{
$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'];
if
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
{
$this->join = " JOIN ";
}
else
{
$this->join = " LEFT JOIN ";
}
}
function read($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by id asc';
}
$table = 'fm_location_type';
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " where name LIKE '%$query%' or
descr LIKE '%$query%'";
}
$sql = "SELECT * FROM $table $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())
{
$standard[] = array
(
'id' => $this->db->f('id'),
'name' => $this->db->f('name'),
'prefix'=> $this->db->f('prefix'),
'descr' => $this->db->f('descr')
);
}
return $standard;
}
function read_config($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by column_name asc';
}
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " where name LIKE '%$query%' or
column_name LIKE '%$query%'";
}
$sql = "SELECT fm_location_config.*
,fm_location_type.name as name FROM fm_location_config $this->join
fm_location_type on fm_location_config.location_type=fm_location_type.id
$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())
{
$standard[] = array
(
'column_name' =>
$this->db->f('column_name'),
'location_name' => $this->db->f('name'),
'location_type' =>
$this->db->f('location_type')
);
}
//_debug_array($standard);
return $standard;
}
function read_single($id)
{
$table = 'fm_location_type';
$sql = "SELECT * FROM $table where id='$id'";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$standard['id'] =
$this->db->f('id');
$standard['name'] =
$this->db->f('name');
$standard['descr'] =
$this->db->f('descr');
$standard['prefix'] =
$this->db->f('prefix');
return $standard;
}
}
function next_id($table='')
{
$this->db->query("SELECT max(id) as maximum FROM $table
",__LINE__,__FILE__);
$this->db->next_record();
$next_id = $this->db->f('maximum')+1;
return "$next_id";
}
function add($standard)
{
$standard['name'] =
$this->db->db_addslashes($standard['name']);
$standard['descr'] =
$this->db->db_addslashes($standard['descr']);
$standard['id'] = $this->next_id('fm_location_type');
$this->db->transaction_begin();
$this->db->query("INSERT INTO fm_location_type
(id,name, descr, prefix) "
. "VALUES ('" . $standard['id'] . "','" .
$standard['name'] . "','" . $standard['descr'] . "','" . $standard['prefix'].
"')",__LINE__,__FILE__);
$receipt['id']= $standard['id'];
$this->init_process();
$fd=array();
$fd['location_code'] = array('type' => 'varchar',
'precision' => 25, 'nullable' => False);
for ($i=1; $i<$standard['id']+1; $i++)
{
$fd['loc' . $i] = array('type' => 'varchar',
'precision' => 4, 'nullable' => False);
$pk[$i-1]= 'loc' . $i;
}
$fk_table='fm_location'. ($standard['id']-1);
for ($i=1; $i<$standard['id']; $i++)
{
$fk['loc' . $i] = $fk_table . '.loc' . $i;
}
if($standard['id']==1)
{
$fd['part_of_town_id'] = array('type' => 'int',
'precision' => 2, 'nullable' => True);
}
$fd['name'] = array('type' => 'varchar', 'precision' =>
25, 'nullable' => True);
$fd['entry_date'] = array('type' => 'int', 'precision'
=> 4, 'nullable' => True);
$fd['category'] = array('type' => 'int', 'precision' =>
4, 'nullable' => True);
$fd['user'] = array('type' => 'int', 'precision' => 4,
'nullable' => True);
$fd['remark'] = array('type' => 'text', 'nullable' =>
True);
if($this->oProc->CreateTable('fm_location'.
$standard['id'],array('fd' => $fd,'pk' => $pk,'fk' => $fk,'ix' =>
array('location_code'),'uc' => array())))
{
$receipt['message'][] = array('msg' =>
lang('table %1 has been saved','fm_location'. $receipt['id']) );
$this->db->transaction_commit();
}
else
{
$receipt['error'][] = array('msg' =>
lang('table could not be added') );
if($this->db->Transaction)
{
$this->db->transaction_abort();
}
else
{
$this->db->query("DELETE FROM
fm_location_type WHERE id='" . $standard['id'] . "'",__LINE__,__FILE__);
unset($receipt['id']);
}
}
return $receipt;
}
function edit($standard)
{
if (!$standard['name'])
{
$receipt['error'][] = array('msg'=>lang('Name
not entered!'));
}
if (!$receipt['error'])
{
$table = 'fm_location_type';
$standard['name'] =
$this->db->db_addslashes($standard['name']);
$standard['descr'] =
$this->db->db_addslashes($standard['descr']);
$this->db->query("UPDATE $table set descr='" .
$standard['descr'] . "', name='". $standard['name'] . "', prefix='".
$standard['prefix']
. "' WHERE id='" . $standard['id'].
"'",__LINE__,__FILE__);
$receipt['message'][] = array('msg'=>
lang('Standard has been edited'));
}
else
{
$receipt['error'][] = array('msg' =>
lang('Standard has NOT been edited'));
}
return $receipt;
}
function delete($id,$attrib)
{
$this->init_process();
if($attrib)
{
$table = 'fm_location_type_column';
$this->db->query("SELECT column_name,type_id
FROM fm_location_type_column WHERE id='" . $id . "'",__LINE__,__FILE__);
$this->db->next_record();
$ColumnName =
$this->db->f('column_name');
$type_id =
$this->db->f('type_id');
$this->oProc->DropColumn('fm_location'
.$type_id ,'', $ColumnName);
}
else
{
$this->oProc->DropTable('fm_location' . $id);
$table = 'fm_location_type';
$attrib_table = 'fm_location_type_column';
$this->db->query("DELETE FROM $attrib_table
WHERE type_id='" . $id . "'",__LINE__,__FILE__);
}
$this->db->query("DELETE FROM $table WHERE id='" . $id
. "'",__LINE__,__FILE__);
}
function read_attrib($data)
{
//_debug_array($data);
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$type_id =
(isset($data['type_id'])?$data['type_id']:0);
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by id asc';
}
$table = 'fm_location_type_column';
$type_table = 'fm_location_type';
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " and ($table.name LIKE
'%$query%' or $table.descr LIKE '%$query%')";
}
$sql = "SELECT $table.id ,$table.column_name
,$table.input_name, $table.datatype ,$type_table.name as type FROM $type_table
$this->join $table on $table.type_id = $type_table.id where $table.type_id=
'$type_id' $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())
{
$attrib[] = array
(
'id' => $this->db->f('id'),
'name' => $this->db->f('column_name'),
'descr' => $this->db->f('input_name'),
'type_name' => $this->db->f('type'),
'datatype' =>
$this->db->f('datatype')
);
}
return $attrib;
}
function read_single_attrib($id)
{
$table = 'fm_location_type_column';
$type_table = 'fm_location_type';
$sql = "SELECT $table.*,$type_table.id as type_id
,$type_table.name as type_name FROM $type_table $this->join $table on
$table.type_id = $type_table.id where $table.id= '$id' $querymethod";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$attrib['id']
= $this->db->f('id');
$attrib['column_name']
= $this->db->f('column_name');
$attrib['input_name']
= $this->db->f('input_name');
$attrib['statustext']
= $this->db->f('statustext');
$attrib['column_info']['precision'] =
$this->db->f('precision_');
$attrib['column_info']['scale'] =
$this->db->f('scale');
$attrib['column_info']['default'] =
$this->db->f('default_value');
$attrib['column_info']['nullable'] =
$this->db->f('nullable');
$attrib['column_info']['type'] =
$this->db->f('datatype');
$attrib['type_id']
= $this->db->f('type_id');
$attrib['type_name']
= $this->db->f('type_name');
return $attrib;
}
}
function add_attrib($attrib)
{
$attrib['column_name'] =
$this->db->db_addslashes($attrib['column_name']);
$attrib['input_name'] =
$this->db->db_addslashes($attrib['input_name']);
$attrib['statustext'] =
$this->db->db_addslashes($attrib['statustext']);
$attrib['default'] =
$this->db->db_addslashes($attrib['default']);
$attrib['id'] =
$this->next_id('fm_location_type_column');
$this->db->transaction_begin();
$this->db->query("INSERT INTO fm_location_type_column
(id,column_name, input_name, statustext, type_id,
datatype,precision_,scale,default_value,nullable) "
. "VALUES ('" .
$attrib['id'] . "','" .
$attrib['column_name'] . "','" .
$attrib['input_name'] . "','" .
$attrib['statustext'] . "','" .
$attrib['type_id'] . "','" .
$attrib['column_info']['type'] . "','" .
$attrib['column_info']['precision'] . "','" .
$attrib['column_info']['scale'] . "','" .
$attrib['column_info']['default'] . "','" .
$attrib['column_info']['nullable'].
"')",__LINE__,__FILE__);
$receipt['id']= $attrib['id'];
$this->init_process();
if($this->oProc->AddColumn('fm_location'.$attrib['type_id'],$attrib['column_name'],
$attrib['column_info']))
{
$receipt['message'][] = array('msg' =>
lang('Attribute has been saved') );
$this->db->transaction_commit();
}
else
{
$receipt['error'][] = array('msg' =>
lang('column could not be added') );
if($this->db->Transaction)
{
$this->db->transaction_abort();
}
else
{
$this->db->query("DELETE FROM
fm_location_type_column WHERE id='" . $receipt['id'] . "'",__LINE__,__FILE__);
unset($receipt['id']);
}
}
//_debug_array($attrib);
return $receipt;
}
function init_process()
{
$this->oProc
=
CreateObject('phpgwapi.schema_proc',$GLOBALS['phpgw_info']['server']['db_type']);
$this->oProc->m_odb
= $this->db;
$this->oProc->m_odb->Halt_On_Error = 'report';
}
function edit_attrib($attrib)
{
$attrib['column_name'] =
$this->db->db_addslashes($attrib['column_name']);
$attrib['input_name'] =
$this->db->db_addslashes($attrib['input_name']);
$attrib['statustext'] =
$this->db->db_addslashes($attrib['statustext']);
$attrib['default'] =
$this->db->db_addslashes($attrib['default']);
$this->db->query("SELECT column_name FROM
fm_location_type_column WHERE id='" . $attrib['id']. "'",__LINE__,__FILE__);
$this->db->next_record();
$OldColumnName = $this->db->f('column_name');
$this->db->query("UPDATE fm_location_type_column set
column_name = '".
$attrib['column_name'] . "',
input_name = '".
$attrib['input_name'] . "',
statustext = '".
$attrib['statustext'] . "',
type_id = '".
$attrib['type_id'] . "',
datatype = '".
$attrib['column_info']['type'] . "',
precision_ = '".
$attrib['column_info']['precision'] . "',
scale = '".
$attrib['column_info']['scale'] . "',
default_value = '".
$attrib['column_info']['default'] . "',
nullable = '".
$attrib['column_info']['nullable']
. "' WHERE id='" . $attrib['id'].
"'",__LINE__,__FILE__);
$this->init_process();
$this->oProc->RenameColumn('fm_location'.$attrib['type_id'], $OldColumnName,
$attrib['column_name']);
$this->oProc->AlterColumn('fm_location'.$attrib['type_id'],$attrib['column_name'],$attrib['column_info']);
$receipt['message'][] = array('msg' =>
lang('Attribute has been edited'));
return $receipt;
}
function select_entity_type()
{
$this->db->query("SELECT * FROM fm_location_type ORDER
BY name ");
$i = 0;
while ($this->db->next_record())
{
$entity_type[$i]['id'] =
$this->db->f('id');
$entity_type[$i]['name'] =
stripslashes($this->db->f('name'));
$entity_type[$i]['descr'] =
stripslashes($this->db->f('descr'));
$i++;
}
//_debug_array($entity_type);
return $entity_type;
}
}
?>
--- 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 uiadmin_location
{
var $grants;
var $start;
var $query;
var $sort;
var $order;
var $sub;
var $currentapp;
var $public_functions = array
(
'index' => True,
'config' => True,
'view' => True,
'edit' => True,
'delete' => True,
'list_attribute' => True,
'edit_attrib' => True,
);
function uiadmin_location()
{
$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.'.boadmin_location',True);
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$this->start =
$this->bo->start;
$this->query =
$this->bo->query;
$this->sort =
$this->bo->sort;
$this->order =
$this->bo->order;
$GLOBALS['phpgw']->session->appsession('sub',$this->currentapp,'admin_location');
}
function save_sessiondata()
{
$data = array
(
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
);
$this->bo->save_sessiondata($data);
}
function index()
{
$GLOBALS['phpgw']->xslttpl->add_file(array(
'admin_location',
'nextmatchs',
'menu',
'search_field'));
$links = $this->bocommon->menu();
$standard_list = $this->bo->read();
while (is_array($standard_list) && list(,$standard) =
each($standard_list))
{
$words = split(' ',$standard['descr']);
$first = "$words[0] $words[1] $words[2]
$words[3]";
$content[] = array
(
'id'
=> $standard['id'],
'name'
=> $standard['name'],
'prefix'
=> $standard['prefix'],
'first'
=> $first,
'link_attribute'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&type_id='
. $standard['id']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit&id='
. $standard['id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.delete&id='
. $standard['id']),
'lang_view_standardtext' =>
lang('view the standard'),
'lang_attribute_standardtext' =>
lang('attributes for the standard'). ' ' . lang('location'),
'lang_edit_standardtext' =>
lang('edit the standard'),
'lang_delete_standardtext' =>
lang('delete the standard'),
'text_attribute'
=> lang('Attributes'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
}
//_debug_array($content);
$table_header[] = array
(
'lang_descr' => lang('Descr'),
'lang_prefix' => lang('prefix'),
'lang_attribute' => lang('Attributes'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
'sort_id' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.index')
)),
'lang_id' => lang('standard id'),
'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.index')
)),
'lang_name' => lang('Name'),
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_standardtext' => lang('add a
standard'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit'),
'lang_done' =>
lang('done'),
'lang_done_standardtext' => lang('back
to admin'),
'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
);
$data = array
(
'links'
=> $links,
'allow_allrows'
=> False,
'start_record'
=> $this->start,
'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
'num_records'
=> count($standard_list),
'all_records'
=> $this->bo->total_records,
'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header'
=> $table_header,
'values'
=> $content,
'table_add'
=> $table_add
);
$appname
= lang('location');
$function_msg =
lang('list location standard');
$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 edit()
{
$id = get_var('id',array('POST','GET'));
$values =
get_var('values',array('POST'));
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_location'));
if ($values['save'])
{
if (!$values['name'])
{
$receipt['error'][] =
array('msg'=>lang('Name not entered!'));
}
if($id)
{
$values['id']=$id;
$action='edit';
}
if (!$receipt['error'])
{
$receipt =
$this->bo->save($values,$action);
if(!$id)
{
$id=$receipt['id'];
}
}
else
{
$receipt['error'][] = array('msg'=>
lang('Table has NOT been saved'));
}
}
if ($id)
{
$values = $this->bo->read_single($id);
$function_msg = lang('edit standard');
$action='edit';
}
else
{
$function_msg = lang('add standard');
$action='add';
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_location.edit',
'id' => $id
);
//_debug_array($link_data);
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
'lang_prefix'
=> lang('Standard prefix'),
'lang_prefix_standardtext' =>
lang('Enter a standard prefix for the id of the equipments'),
'lang_name_standardtext' =>
lang('Enter a name of the standard'),
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
'lang_id'
=> lang('standard ID'),
'lang_name'
=> lang('Name'),
'lang_descr'
=> lang('Descr'),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'value_id'
=> $id,
'value_name'
=> $values['name'],
'value_prefix'
=> $values['prefix'],
'lang_id_standardtext' =>
lang('Enter the standard ID'),
'lang_descr_standardtext' =>
lang('Enter a description of the standard'),
'lang_done_standardtext' =>
lang('Back to the list'),
'lang_save_standardtext' =>
lang('Save the standard'),
'type_id'
=> $values['type_id'],
'value_descr'
=> $values['descr']
);
$appname
= lang('location');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
}
function delete()
{
$attrib = get_var('attrib',array('POST','GET'));
$type_id =
get_var('type_id',array('POST','GET'));
$id =
get_var('id',array('POST','GET'));
$confirm = get_var('confirm',array('POST'));
if($attrib)
{
$function='list_attribute';
}
else
{
$function='index';
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_location.'.$function,
'type_id' => $type_id
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete($id,$attrib);
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.'.uiadmin_location.delete&id='
. $id.'&attrib='.$attrib.'&type_id='.$type_id),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
'lang_yes_standardtext' => lang('Delete the
entry'),
'lang_no_standardtext' => lang('Back to the
list'),
'lang_no' =>
lang('no')
);
$appname
= lang('location');
$function_msg =
lang('delete location standard');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
function list_attribute()
{
$type_id =
get_var('type_id',array('POST','GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array(
'admin_location',
'nextmatchs',
'search_field'));
$attrib_list = $this->bo->read_attrib($type_id);
while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
{
$words = split(' ',$attrib['descr']);
$first = "$words[0] $words[1] $words[2]
$words[3]";
$content[] = array
(
'name'
=> $attrib['name'],
'type_name'
=> $attrib['type_name'],
'datatype'
=> $attrib['datatype'],
'first'
=> $first,
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit_attrib&id='
. $attrib['id'].'&type_id='.$type_id),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.delete&id='
. $attrib['id'].'&type_id='.$type_id.'&attrib=true'),
'lang_view_attribtext' =>
lang('view the attrib'),
'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang('location'),
'lang_edit_attribtext' =>
lang('edit the attrib'),
'lang_delete_attribtext' =>
lang('delete the attrib'),
'text_attribute'
=> lang('Attributes'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
}
//_debug_array($content);
$table_header[] = array
(
'lang_type_name' => lang('Type'),
'lang_descr' => lang('Descr'),
'lang_datatype' => lang('Datatype'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'column_name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.list_attribute',
'type_id'
=>$type_id)
)),
'lang_name' => lang('Name'),
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_attribtext' => lang('add a attrib'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit_attrib&type_id='.$type_id),
'lang_done' =>
lang('done'),
'lang_done_attribtext' => lang('back to
admin'),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
);
$data = array
(
'allow_allrows'
=> False,
'start_record'
=> $this->start,
'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
'num_records'
=> count($attrib_list),
'all_records'
=> $this->bo->total_records,
'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_attribtext' => lang('Submit
the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header_attrib' =>
$table_header,
'values_attrib'
=> $content,
'table_add'
=> $table_add
);
$appname
= lang('attribute');
$function_msg =
lang('list location attribute');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
$this->save_sessiondata();
}
function edit_attrib()
{
$type_id =
get_var('type_id',array('POST','GET'));
$id =
get_var('id',array('POST','GET'));
$values = get_var('values',array('POST'));
//_debug_array($values);
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_location'));
if ($values['save'])
{
if($id)
{
$values['id']=$id;
$action='edit';
}
$type_id =
$values['type_id'];
if (!$values['column_name'])
{
$receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
}
if (!$values['input_name'])
{
$receipt['error'][] =
array('msg'=>lang('Input name not entered!'));
}
if (!$values['statustext'])
{
$receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
}
if (!$values['type_id'])
{
$receipt['error'][] =
array('msg'=>lang('Location type not choosen!'));
}
if (!$values['column_info']['type'])
{
$receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
}
if (!$values['column_info']['precision'])
{
$receipt['error'][] =
array('msg'=>lang('Please enter Precision !'));
}
if(!ctype_digit($values['column_info']['precision']))
{
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
unset($values['column_info']['precision']);
}
if(!ctype_digit($values['column_info']['scale']))
{
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
unset($values['column_info']['scale']);
}
if (!$values['column_info']['nullable'])
{
$receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
}
if (!$receipt['error'])
{
$receipt =
$this->bo->save_attrib($values,$action);
if(!$id)
{
$id=$receipt['id'];
}
}
else
{
$receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
}
}
if ($id)
{
$values = $this->bo->read_single_attrib($id);
$type_name=$attrib['type_name'];
$function_msg = lang('edit attribute'). ' ' .
lang($type_name);
$action='edit';
}
else
{
$function_msg = lang('add attribute');
$action='add';
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiadmin_location.edit_attrib',
'id' => $id
);
//_debug_array($link_data);
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&type_id='.$type_id),
'lang_id'
=> lang('Attribute ID'),
'lang_entity_type' =>
lang('Type'),
'lang_no_entity_type' => lang('No
entity type'),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'value_id'
=> $id,
'lang_column_name'
=> lang('Column name'),
'value_column_name'
=> $values['column_name'],
'lang_column_name_statustext' => lang('enter
the name for the column'),
'lang_input_name'
=> lang('input_name'),
'value_input_name'
=> $values['input_name'],
'lang_input_name_statustext' => lang('enter
the input name for records'),
'lang_id_attribtext' => lang('Enter
the attribute ID'),
'lang_entity_statustext' => lang('Select
a entity type'),
'lang_statustext' =>
lang('Statustext'),
'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
'value_statustext' =>
$values['statustext'],
'lang_done_attribtext' => lang('Back
to the list'),
'lang_save_attribtext' => lang('Save
the attribute'),
'type_id'
=> $values['type_id'],
'entity_list' =>
$this->bo->select_entity_type($type_id),
'select_entity_type' =>
'values[type_id]',
'lang_datatype' =>
lang('Datatype'),
'lang_datatype_statustext' => lang('Select
a datatype'),
'lang_no_datatype' =>
lang('No datatype'),
'datatype_list' =>
$this->bo->select_datatype($values['column_info']['type']),
'lang_precision' =>
lang('Precision'),
'lang_precision_statustext' => lang('enter
the record lenght'),
'value_precision' =>
$values['column_info']['precision'],
'lang_scale' =>
lang('scale'),
'lang_scale_statustext' => lang('enter
the scale if type is decinmal'),
'value_scale' =>
$values['column_info']['scale'],
'lang_default' =>
lang('default'),
'lang_default_statustext' => lang('enter
the default value'),
'value_default' =>
$values['column_info']['default'],
'lang_nullable' =>
lang('Nullable'),
'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
'lang_select_nullable' => lang('Select
nullable'),
'nullable_list' =>
$this->bo->select_nullable($values['column_info']['nullable']),
);
//_debug_array($data);
$appname
= lang('location');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
}
function config()
{
$GLOBALS['phpgw']->xslttpl->add_file(array(
'admin_location',
'nextmatchs',
'menu',
'search_field'));
$links = $this->bocommon->menu();
$standard_list = $this->bo->read_config();
while (is_array($standard_list) && list(,$standard) =
each($standard_list))
{
$content[] = array
(
'column_name'
=> $standard['column_name'],
'name'
=> $standard['location_name'],
'prefix'
=> $standard['prefix'],
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit_config&column_name='
. $standard['column_name']),
'lang_edit_standardtext' =>
lang('edit the column relation'),
'text_edit'
=> lang('edit')
);
}
//_debug_array($content);
$table_header[] = array
(
'lang_attribute' => lang('Attributes'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
'sort_column_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'column_name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.config')
)),
'lang_column_name' => lang('column name'),
'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.config')
)),
'lang_name' => lang('Table Name'),
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_standardtext' => lang('add a
standard'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit'),
'lang_done' =>
lang('done'),
'lang_done_standardtext' => lang('back
to admin'),
'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
);
$data = array
(
'links'
=> $links,
'allow_allrows'
=> False,
'start_record'
=> $this->start,
'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
'num_records'
=> count($standard_list),
'all_records'
=> $this->bo->total_records,
'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header_list_config' =>
$table_header,
'values_list_config' =>
$content,
'table_add'
=> $table_add
);
$appname
= lang('location');
$function_msg =
lang('list location standard');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_config' => $data));
$this->save_sessiondata();
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.boadmin_location.inc.php,NONE,1.1 class.soadmin_location.inc.php,NONE,1.1 class.uiadmin_location.inc.php,NONE,1.1,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/templates/default admin_location.xsl,NONE,1.1 menu.xsl,1.9,1.10
- Next by Date:
[Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.48,1.49 class.botenant.inc.php,1.1,1.2class.sostandard_entity.inc.php,1.9,1.10 class.sotenant.inc.php,1.1,1.2 class.uiowner.inc.php,1.6,1.7 hook_admin.inc.php,1.33,1.34
- Previous by thread:
[Phpgroupware-cvs] CVS: property/templates/default admin_location.xsl,NONE,1.1 menu.xsl,1.9,1.10
- Next by thread:
[Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.48,1.49 class.botenant.inc.php,1.1,1.2class.sostandard_entity.inc.php,1.9,1.10 class.sotenant.inc.php,1.1,1.2 class.uiowner.inc.php,1.6,1.7 hook_admin.inc.php,1.33,1.34
- Index(es):