[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc/class.uib_account.inc.php, 1.2
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/inc/class.uib_account.inc.php, 1.2 |
Date: |
Wed, 2 Jun 2004 20:54:28 +0200 |
Update of /property/inc
Added Files:
Branch:
class.uib_account.inc.php
date: 2004/06/02 18:54:28; author: sigurdne; state: Exp; lines: +273 -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.
*
\**************************************************************************/
class uib_account
{
var $grants;
var $start;
var $query;
var $sort;
var $order;
var $sub;
var $currentapp;
var $public_functions = array
(
'index' => True,
'edit' => True,
'delete' => True
);
function uib_account()
{
$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->bo =
CreateObject($this->currentapp.'.bob_account',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;
$this->allrows =
$this->bo->allrows;
}
function save_sessiondata()
{
$data = array
(
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
'allrows' => $this->allrows
);
$this->bo->save_sessiondata($data);
}
function index()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account','nextmatchs',
'search_field'));
$b_account_list = $this->bo->read($type);
while (is_array($b_account_list) && list(,$b_account) =
each($b_account_list))
{
$words = split(' ',$b_account['descr']);
$first = "$words[0] $words[1] $words[2]
$words[3]";
$content[] = array
(
'id'
=> $b_account['id'],
'first'
=> $first,
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.edit&id='
. $b_account['id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.delete&id='
. $b_account['id']),
'lang_view_b_accounttext' =>
lang('view the budget account'),
'lang_edit_b_accounttext' =>
lang('edit the budget account'),
'lang_delete_b_accounttext' =>
lang('delete the budget account'),
'text_view'
=> lang('view'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
}
//_debug_array($content);
$table_header[] = array
(
'lang_descr' => lang('Descr'),
'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.'.uib_account.index')
)),
'lang_id' => lang('budget account'),
);
$table_add[] = array
(
'lang_add'
=> lang('add'),
'lang_add_b_accounttext' => lang('add a
budget account'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.edit'),
'lang_done'
=> lang('done'),
'lang_done_b_accounttext' => lang('back
to admin'),
'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$data = array
(
'allow_allrows'
=> True,
'allrows'
=> $this->allrows,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($b_account_list),
'all_records'
=> $this->bo->total_records,
'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.index&type='.$type),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
'lang_searchfield_b_accounttext' =>
lang('Enter the search string. To show all entries, empty this field and press
the SUBMIT button again'),
'lang_searchbutton_b_accounttext' =>
lang('Submit the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header'
=> $table_header,
'values'
=> $content,
'table_add'
=> $table_add
);
$appname
= lang('budget account');
$function_msg =
lang('list budget account');
$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('b_account'));
if ($values['save'])
{
if(!$id && !ctype_digit($values['id']))
{
$receipt['error'][]=array('msg'=>lang('Please enter an integer !'));
unset($values['id']);
}
if($id)
{
$values['id']=$id;
$action='edit';
}
else
{
$id = $values['id'];
}
if(!$receipt['error'])
{
$receipt =
$this->bo->save($values,$action);
}
}
if ($id)
{
$b_account = $this->bo->read_single($id);
$function_msg = lang('edit budget account');
$action='edit';
}
else
{
$function_msg = lang('add budget account');
$action='add';
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uib_account.edit',
'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.'.uib_account.index&type='.$type),
'lang_id'
=> lang('budget account'),
'lang_descr'
=> lang('Descr'),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'value_id'
=> $id,
'lang_group'
=> lang('group'),
'value_group'
=> $b_account['group'],
'lang_id_b_accounttext' =>
lang('Enter the budget account'),
'lang_descr_b_accounttext' =>
lang('Enter a description the budget account'),
'lang_done_b_accounttext' =>
lang('Back to the list'),
'lang_save_b_accounttext' =>
lang('Save the budget account'),
'value_descr'
=> $b_account['descr']
);
$appname
= lang('budget account');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
}
function delete()
{
$id = get_var('id',array('POST','GET'));
$confirm =
get_var('confirm',array('POST'));
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uib_account.index'
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete($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.'.uib_account.delete&id='
. $id),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
'lang_yes_b_accounttext' => lang('Delete
the entry'),
'lang_no_b_accounttext' => lang('Back to the
list'),
'lang_no' =>
lang('no')
);
$appname
= lang('budget account');
$function_msg =
lang('delete budget account');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
}
?>