phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property/inc/class.boadmin_entity.inc.php, 1.2


From: nomail
Subject: [Phpgroupware-cvs] property/inc/class.boadmin_entity.inc.php, 1.2
Date: Wed, 2 Jun 2004 20:54:27 +0200

Update of /property/inc
Added Files:
        Branch: 
          class.boadmin_entity.inc.php

date: 2004/06/02 18:54:27;  author: sigurdne;  state: Exp;  lines: +376 -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 boadmin_entity
        {
                var $start;
                var $query;
                var $filter;
                var $sort;
                var $order;
                var $cat_id;
                var $entity_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_entity($session=False)
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.soadmin_entity');
                        $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'));
                        $allrows        = 
get_var('allrows',array('POST','GET'));
                        $entity_id      = 
get_var('entity_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($entity_id))
                        {
                                $this->entity_id = $entity_id;
                        }
                        if(isset($allrows))
                        {
                                $this->allrows = $allrows;
                        }
                }


                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'];
                        $this->entity_id        = $data['entity_id'];
                        $this->allrows  = $data['allrows'];
                }

                function reset_fm_cache()
                {
                        $this->so->reset_fm_cache();
                }


                function get_location_level_list($selected='')
                {

                        $soadmin_location       = 
CreateObject($this->currentapp.'.soadmin_location');
                        $location_types         = 
$soadmin_location->select_location_type();
                        $max_location_type=count($location_types);

                        for ($i=1; $i<=$max_location_type; $i++)
                        {
                                $location[$i][id] = $i;
                                $location[$i][name] = $i . '-' . 
$location_types[($i-1)]['name'];
                        }

                        return 
$this->bocommon->select_list($selected,$location);

                }

                function get_entity_list($selected='')
                {
                        $list = $this->so->read(array('allrows'=>True));
                        return 
$this->bocommon->select_multi_list($selected,$list);
                }

                function get_entity_list_2($selected='')
                {
                        $list[0]['id']='project';
                        $list[0]['name']='project';
                        $list[1]['id']='ticket';
                        $list[1]['name']='ticket';
                        $list[2]['id']='document';
                        $list[2]['name']='document';
                        $list[3]['id']='drawing';
                        $list[3]['name']='drawing';
                        $list[4]['id']='meter';
                        $list[4]['name']='meter';
                        $list[5]['id']='request';
                        $list[5]['name']='request';
                        $list[6]['id']='investment';
                        $list[6]['name']='investment';
                        return 
$this->bocommon->select_multi_list($selected,$list);
                }

                function get_entity_list_3($selected='')
                {
                        $list[0]['id']='ticket';
                        $list[0]['name']='ticket';
                        $list[1]['id']='request';
                        $list[1]['name']='request';
                        return 
$this->bocommon->select_multi_list($selected,$list);
                }

                function read()
                {
                        $entity = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,'allrows'=>$this->allrows));

                        $this->total_records = $this->so->total_records;
                        return $entity;
                }

                function read_category($entity_id)
                {
                        $category = $this->so->read_category(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,
                                'order' => 
$this->order,'allrows'=>$this->allrows,'entity_id'=>$entity_id));

                        $this->total_records = $this->so->total_records;

                        return $category;
                }

                function read_status()
                {
                        $status = $this->so->read_status(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,
                                'order' => 
$this->order,'allrows'=>$this->allrows,'entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id));

                        $this->total_records = $this->so->total_records;

                        return $status;
                }

                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_config_single($column_name)
                {
                        return $this->so->read_config_single($column_name);
                }

                function read_single($id)
                {
                        return $this->so->read_single($id);
                }

                function read_single_category($entity_id,$cat_id)
                {
                        return 
$this->so->read_single_category($entity_id,$cat_id);
                }

                function read_single_status($id)
                {
                        return 
$this->so->read_single_status($this->entity_id,$this->cat_id,$id);
                }

                function save($values,$action='')
                {
                        if ($action=='edit')
                        {
                                if ($values['id'] != '')
                                {
                                        $receipt = 
$this->so->edit_entity($values);
                                }
                        }
                        else
                        {
                                $receipt = $this->so->add_entity($values);
                        }
                        return $receipt;
                }

                function save_category($values,$action='')
                {
                        if ($action=='edit')
                        {
                                if ($values['id'] != '')
                                {
                                        $receipt = 
$this->so->edit_category($values);
                                }
                        }
                        else
                        {
                                $receipt = $this->so->add_category($values);
                        }
                        return $receipt;
                }

                function save_status($values,$action='')
                {
                        if ($action=='edit')
                        {
                                if ($values['id'] != '')
                                {
                                        $receipt = 
$this->so->edit_status($values,$this->entity_id,$this->cat_id);
                                }
                        }
                        else
                        {
                                $receipt = 
$this->so->add_status($values,$this->entity_id,$this->cat_id);
                        }
                        return $receipt;
                }

                function 
delete($cat_id='',$entity_id='',$attrib_id='',$status_id='')
                {
                        if(!$status_id && !$attrib_id && !$cat_id && 
$entity_id):
                        {
                                $this->so->delete_entity($entity_id);
                        }
                        elseif(!$status_id && !$attrib_id && $cat_id && 
$entity_id):
                        {
                                $this->so->delete_category($cat_id,$entity_id);
                        }
                        elseif(!$status_id && $attrib_id && $cat_id && 
$entity_id):
                        {
                                
$this->so->delete_attrib($cat_id,$entity_id,$attrib_id);
                        }
                        elseif($status_id && !$attrib_id && $cat_id && 
$entity_id):
                        {
                                
$this->so->delete_status($cat_id,$entity_id,$status_id);
                        }
                        endif;
                }

                function read_attrib($entity_id='',$cat_id='',$allrows='')
                {
                        if($allrows)
                        {
                                $this->allrows = $allrows;
                        }

                        $attrib = $this->so->read_attrib(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'cat_id' => $cat_id,'entity_id' => 
$entity_id,'allrows'=>$this->allrows));

                        for ($i=0; $i<count($attrib); $i++)
                        {
                                $attrib[$i]['datatype'] = 
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
                        }

                        $this->total_records = $this->so->total_records;

                        return $attrib;
                }

                function read_single_attrib($entity_id,$cat_id,$id)
                {
                        return 
$this->so->read_single_attrib($entity_id,$cat_id,$id);
                }

                function resort_attrib($id,$resort)
                {
                        
$this->so->resort_attrib(array('resort'=>$resort,'entity_id' => 
$this->entity_id,'cat_id' => $this->cat_id,'id'=>$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 save_config($values='',$column_name='')
                {
                                return 
$this->so->save_config($values,$column_name);
                }
        }
?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]