phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.botts.inc.php,NONE,1.1 class.


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.botts.inc.php,NONE,1.1 class.sotts.inc.php,NONE,1.1 class.uitts.inc.php,NONE,1.1 class.bocommon.inc.php,1.7,1.8 class.uibuilding.inc.php,1.2,1.3 class.uiinvestment.inc.php,1.5,1.6 class.uiproperty.inc.php,1.3,1.4
Date: Mon, 03 Feb 2003 16:50:24 -0500

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv15509/inc

Modified Files:
        class.bocommon.inc.php class.uibuilding.inc.php 
        class.uiinvestment.inc.php class.uiproperty.inc.php 
Added Files:
        class.botts.inc.php class.sotts.inc.php class.uitts.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 botts
        {
                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 botts($session=False)
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.sotts');
                        $this->socommon = 
CreateObject($this->currentapp.'.socommon');
                        $this->bocommon = 
CreateObject($this->currentapp.'.bocommon');
                        $this->historylog = 
createobject('phpgwapi.historylog',$this->currentapp);

                        $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 filter($data=0)
                {
                        if(is_array($data))
                        {
                                $format = 
(isset($data['format'])?$data['format']:'');
                                $selected = 
(isset($data['filter'])?$data['filter']:'');
                        }

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_filter'));

                        $filters[0][id]='closed';
                        $filters[0][name]=lang('Closed');
                        $filters[1][id]='open';
                        $filters[1][name]=lang('Open');

                        while (is_array($filters) && list(,$filter) = 
each($filters))
                        {
                                $sel_filter = '';
                                if ($filter['id']==$selected)
                                {
                                        $sel_filter = 'selected';
                                }

                                $filter_list[] = array
                                (
                                        'id'    => $filter['id'],
                                        'name'          => $filter['name'],
                                        'selected'      => $sel_filter
                                );
                        }

                        for ($i=0;$i<count($filter_list);$i++)
                        {
                                if ($filter_list[$i]['selected'] != 'selected')
                                {
                                        unset($filter_list[$i]['selected']);
                                }
                        }

                        return $filter_list;
                }


                function get_priority_list($selected='')
                {

                        if(!$selected)
                        {
                                $selected = 
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['prioritydefault'];
                        }

                        $priority_comment[1]=' - '.lang('Lowest');
                        $priority_comment[5]=' - '.lang('Medium');
                        $priority_comment[10]=' - '.lang('Highest');

                        for ($i=1; $i<=10; $i++)
                        {
                                $priorities[$i]['id'] =$i;
                                $priorities[$i]['name'] =$i . 
$priority_comment[$i];
                        }

                        while (is_array($priorities) && list(,$priority) = 
each($priorities))
                        {
                                $sel_priority = '';
                                if ($priority['id']==$selected)
                                {
                                        $sel_priority = 'selected';
                                }

                                $priority_list[] = array
                                (
                                        'id'    => $priority['id'],
                                        'name'          => $priority['name'],
                                        'selected'      => $sel_priority
                                );
                        }

                        for ($i=0;$i<count($priority_list);$i++)
                        {
                                if ($priority_list[$i]['selected'] != 
'selected')
                                {
                                        unset($priority_list[$i]['selected']);
                                }
                        }

//_debug_array($priority_list);
                        return $priority_list;
                }


                function read()
                {
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];

                        $tickets = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id));
                        $this->total_records = $this->so->total_records;

                        for ($i=0; $i<count($tickets); $i++)
                        {
                                $tickets[$i]['owner'] = 
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['owner']);
                                $tickets[$i]['assignedto'] = 
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['assignedto']);

                                $history_values = 
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$tickets[$i]['id']);
                                $tickets[$i]['timestampopened'] = 
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$dateformat);

                                if ($tickets[$i]['status'] == 'X')
                                {
                                        $history_values = 
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$tickets[$i]['id']);
                                        $tickets[$i]['timestampclosed'] = 
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$dateformat);
                                }
                                if ($tickets[$i]['new_ticket'])
                                {
                                        $tickets[$i]['new_ticket'] = 
lang('New');
                                }
                        }
//_debug_array($tickets);
                        return $tickets;
                }

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

                function save($ticket,$action='')
                {
                        if ($building['access'])
                        {
                                $building['access'] = 'private';
                        }
                        else
                        {
                                $building['access'] = 'public';
                        }

                        if ($action=='edit')
                        {
                                if ($building['building_id'] != 0)
                                {
                                        $message = $this->so->edit($ticket);
                                }
                        }
                        else
                        {

                                
$ticket['location_code']=$this->bocommon->location_code($building['property_id'],$building['building_id']);
                                $message = $this->so->add($ticket);
                        }
                        return $message;
                }

                function delete($ticket_id)
                {
                        $this->so->delete($ticket_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 sotts
        {
                var $grants;

                function sotts()
                {
                        $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;
                                }
                                $filter = 
(isset($data['filter'])?$data['filter']:'all');
                                $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);
                        }

//_debug_array($data);
                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
                        }
                        else
                        {
                                $ordermethod = ' order by objekt_id DESC';
                        }


                        if ($filter == 'open')
                        {
                                $filtermethod = " status='O'";
                                $where = 'AND';

                        }
                        elseif ($filter == 'closed')
                        {
                                $filtermethod = " status='X'";
                                $where = 'AND';
                        }

                        $filtermethod .= " $where ( 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 .= "  AND owner IN(" . 
implode(',',$public_user_list) . "))";
                        }
                        else
                        {
                                        $filtermethod .= ' )';
                        }

                        if ($cat_id > 0)
                        {
                                $filtermethod .= " AND cat_id='$cat_id' ";
                        }

                        if($query)
                        {
                                $query = ereg_replace("'",'',$query);
                                $query = ereg_replace('"','',$query);

                                $querymethod = " AND (subject LIKE '%$query%' 
or street LIKE '%$query%' or location_code LIKE '%$query%')";
                        }

                        $sql = "SELECT * FROM phpgw_fm_tts_tickets WHERE 
$filtermethod $querymethod";

//echo $sql;
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);

                        $i = 0;

                        while ($this->db->next_record())
                        {
                                $ngrants = 
(int)$this->grants[$this->db->f('owner')];

                                $tickets[$i]['id']                              
= $this->db->f('id');
                                $tickets[$i]['subject']                 = 
$this->db->f('subject');
                                $tickets[$i]['location_code']   = 
$this->db->f('location_code');
                                $tickets[$i]['owner']                   = 
$this->db->f('owner');
                                $tickets[$i]['address']                 = 
$this->db->f('street');
                                $tickets[$i]['assignedto']              = 
$this->db->f('assignedto');
                                $tickets[$i]['status']                  = 
$this->db->f('status');
                                $tickets[$i]['priority']                = 
$this->db->f('priority');
                                $tickets[$i]['grants']                  = 
$ngrants;

                                $this->db2->query("select count(*) from 
phpgw_fm_tts_views where view_id='" . $this->db->f('id')
                                        . "' and view_account_id='" . 
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
                                $this->db2->next_record();

                                if (!$this->db2->f(0))
                                {
                                        $tickets[$i]['new_ticket'] = True;
                                }

                                $i++;

                        }
                        return $tickets;
                }

                function read_single($id)
                {
                        $sql = "SELECT * FROM boei_bygg  where 
objekt_id='$property_id' and bygg_id='$building_id'";

                        $this->db->query($sql,__LINE__,__FILE__);

                        if ($this->db->next_record())
                        {
                                $building['property_id']                = 
(int)$this->db->f('objekt_id');
                                $building['building_id']                = 
(int)$this->db->f('bygg_id');
                                $building['owner']                              
= $this->db->f('owner');
                                $building['name']                               
= stripslashes($this->db->f('byggnavn'));
                                $building['generaladdress']             = 
stripslashes($this->db->f('generelladresse'));
                                $building['access']                             
= $this->db->f('access');
                                $building['date']                               
= $this->db->f('entry_date');
                                $building['cat_id']                             
= (int)$this->db->f('cat_id');
                                $building['omraade_id']                 = 
$this->db->f('omraade_id');
                                $building['part_of_town']               = 
$this->db->f('bydel');
                                $building['building_type_id']   = 
$this->db->f('building_type_id');
                                $building['location_code']              = 
$this->db->f('location_code');

                                return $building;
                        }
                }

                function add($ticket)
                {

                        $this->db->query("INSERT INTO boei_bygg (location_code, 
objekt_id,bygg_id,owner,access,entry_date,byggnavn,generelladresse,cat_id) "
                                . "VALUES ('" . $building['location_code']. 
"','" . $building['property_id'] . "','" . $building['building_id'] . "','" . 
$this->account . "','" . $building['access'] . "','" . time() . "','" . 
$building['name']
                                . "','" . $building['generaladdress'] ."','" . 
$building['cat_id']. "')",__LINE__,__FILE__);

                        $ids['building_id'] = $building['building_id'];
                        $ids['property_id'] = $building['property_id'];

                        $message = lang('Building has been saved');
                        return $message;
                }

                function edit($ticket)
                {
                        $ticket['content'] = 
$this->db->db_addslashes($ticket['content']);

                        $this->db->query("UPDATE boei_bygg set byggnavn='" . 
$building['name'] . "', entry_date='" . time()
                                                . "', cat_id='" . 
$building['cat_id'] . "', generelladresse='" . $building['generaladdress'] . 
"', access='" . $building['access']
                                                . "' WHERE objekt_id= '" . 
$building['property_id']
                                                . "' AND bygg_id=" . 
$building['building_id'],__LINE__,__FILE__);

                        $message = lang('Building has been edited');
                        return $message;
                }

                function delete($id )
                {
                        $this->db->query('DELETE FROM boei_bygg WHERE 
objekt_id=' . $property_id . ' and bygg_id=' . $building_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 uitts
        {
                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,
                        'add'   => True,
                        'delete' => True
                );

                function uitts()
                {
                        $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->cats                                     = 
CreateObject('phpgwapi.categories');
                        $this->cats->app_name           = 'p_ticket';
                        $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.'.botts',True);
                        $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon',True);

                        $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;
                }

                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('tts',
                                                                                
'menu',
                                                                                
'nextmatchs',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));

                        $sub = get_var('sub',array('POST','GET'));
                        $links = $this->bocommon->menu($sub);


                        $ticket_list = $this->bo->read();

                        while (is_array($ticket_list) && list(,$ticket) = 
each($ticket_list))
                        {
                                $words = split(' ',$ticket['subject']);
                                $first = "$words[0] $words[1] $words[2] 
$words[3] .....";

                                $priostr = '';

                                while ($ticket['priority'] > 0)
                                {
                                        $priostr=$priostr . "||";
                                        $ticket['priority']--;
                                }

                                $content[] = array
                                (
                                        'id'                                    
        => $ticket['id'],
                                        'new_ticket'                            
=> $ticket['new_ticket'],
                                        'priostr'                               
        => $priostr,
                                        'first'                                 
        => $first,
                                        'location_code'                         
=> $ticket['location_code'],
                                        'address'                               
        => $ticket['address'],
                                        'date'                                  
        => $ticket['timestampopened'],
                                        'owner'                                 
        => $ticket['owner'],
                                        'assignedto'                            
=> $ticket['assignedto'],
                                        'address'                               
        => $ticket['address'],
                                        'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.view&id='
 . $ticket['id']),
                                        'lang_view_statustext'          => 
lang('view the ticket'),
                                        'text_view'                             
        => lang('view'),
                                );
                        }

                        $table_header[] = array
                        (
                                'sort_priority' => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'priority',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uitts.index',
                                                                                
                                                        'sub'           =>$sub,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'filter'        
=>$this->filter,
                                                                                
                                                        'query'         
=>$this->query)
                                                                                
)),

                                'lang_priority'         => lang('Priority'),
                                'lang_priority_statustext'              => 
lang('Sort the tickets by their priority'),

                                'sort_id'       => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'id',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uitts.index',
                                                                                
                                                        'sub'           =>$sub,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'filter'        
=>$this->filter,
                                                                                
                                                        'query'         
=>$this->query)
                                                                                
)),

                                'lang_id'               => lang('Ticket ID'),
                                'lang_id_statustext'            => lang('Sort 
the tickets by their ID'),

                                'lang_subject'                  => 
lang('Subject'),
                                'lang_time_created'     => lang('Started'),
                                'lang_view'                     => lang('view'),
                                'lang_location_code'    => lang('Location 
code'),
                                'lang_address'          => lang('Address'),
                                'lang_owner'            => lang('owner'),
                                'sort_assigned_to'      => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'assignedto',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uitts.index',
                                                                                
                                                        'sub'           =>$sub,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'filter'        
=>$this->filter,
                                                                                
                                                        'query'         
=>$this->query)
                                                                                
)),
                                'lang_assigned_to'              => 
lang('Assigned to'),
                                'sort_opened_by'        => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'owner',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uitts.index',
                                                                                
                                                        'sub'           =>$sub,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'filter'        
=>$this->filter,
                                                                                
                                                        'query'         
=>$this->query)
                                                                                
)),
                                'lang_opened_by'                => lang('Opened 
by')

                        );

                        $table_add[] = array
                        (
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a ticket'),
                                'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.add&sub='
 . $sub)
                        );

                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uitts.index',
                                                'sub'           =>$sub,
                                                'sort'          =>$this->sort,
                                                'order'         =>$this->order,
                                                'cat_id'        =>$this->cat_id,
                                                'filter'        =>$this->filter,
                                                'query'         =>$this->query
                        );

                        $GLOBALS['phpgw']->preferences->read_repository();
                        if 
($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'])
                        {
                                $autorefresh = 
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'].';
 URL='.$GLOBALS['phpgw']->link('/index.php',$link_data);
                        }

                        $data = array
                        (
                                'autorefresh'                                   
=> $autorefresh,
                                'links'                                         
        => $links,
                                'allow_allrows'                                 
=> false,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($ticket_list),
                                'all_records'                                   
=> $this->bo->total_records,
                                'link_url'                                      
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index'),
                                'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
                                'appname'                                       
        => lang($this->currentapp),
                                'function_msg'                                  
=> lang('list ticket'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the ticket belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
                                'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('selected' => 
$this->cat_id,'globals' => True)),
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'filter_name'                                   
=> 'filter',
                                'filter_list'                                   
=> $this->bo->filter(array('filter' => $this->filter,'default' => 'open')),
                                'lang_show_all'                                 
=> lang('Show all'),
                                '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_submit'                                   
=> lang('submit'),
                                'table_header'                                  
=> $table_header,
                                'values'                                        
        => $content,
                                'table_add'                                     
        => $table_add
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                        $this->save_sessiondata();
                }

                function add()
                {

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('tts','location',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));

                        $values         = get_var('values',array('POST'));
                        $sub            = get_var('sub',array('POST','GET'));

                        $values'[property_id']  = 
get_var('property_id',array('POST'));
                        $values'[building_id']  = 
get_var('building_id',array('POST'));
                        $values'[entrance_id']  = 
get_var('entrance_id',array('POST'));
                        $values'[apartment_id'] = 
get_var('apartment_id',array('POST'));
                        $values'[equipment_id'] = 
get_var('equipment_id',array('POST'));

                        
$location_data=$this->bocommon->initiate_ui_location(array('equipment'          
=> False,
                                                                                
                                                                'tenant'        
        => False,
                                                                                
                                                                'property_id'   
=> $values['property_id'],
                                                                                
                                                                'building_id'   
=> $values['building_id'],
                                                                                
                                                                'entrance_id'   
=> $values['entrance_id'],
                                                                                
                                                                'apartment_id'  
=> $values['apartment_id'],
                                                                                
                                                                'equipment_id'  
=> $values['equipment_id']));


_debug_array($values);
                        if ($values['save'])
                        {
                //              $message = $this->bo->save($values);
                        }

                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uitts.add',
                                'sub'                   => $sub
                        );

                        $data = array
                        (
                                'location_data'                                 
=> $location_data,
                                'lang_assign_to'                                
=> lang('Assign to'),
                                'lang_no_user'                                  
=> lang('Select user'),
                                'lang_user_statustext'                  => 
lang('Select the user the selection belongs to. To do not use a user select NO 
USER'),
                                'select_user_name'                              
=> 'values[user_id]',
                                'user_list'                                     
        => $this->bocommon->get_user_list('select',$values['user_id']),

                                'lang_priority'                                 
=> lang('Priority'),
                                'lang_priority_statustext'              => 
lang('Select the priority the selection belongs to.'),
                                'select_priority_name'                  => 
'values[priority]',
                                'priority_list'                                 
=> $this->bo->get_priority_list($values['priority']),

                                'appname'                                       
        => lang($this->currentapp),

                                'function_msg'                                  
=> lang('add ticket'),
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index&sub='
 . $sub),
                                'lang_subject'                                  
=> lang('Subject'),
                                'value_subject'                                 
=> $values['subject'],
                                'lang_subject_statustext'               => 
lang('Enter the subject of this ticket'),

                                'lang_details'                                  
=> lang('Details'),
                                'value_details'                                 
=> $values['details'],
                                'lang_details_statustext'               => 
lang('Enter the details of this ticket'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'value_property_id'                             
=> $property_id,
                                'value_building_id'                             
=> $building_id,
                                'value_cat'                                     
        => $building['cat'],
                                'message'                                       
        => $message,
                                'lang_name_statustext'                  => 
lang('Enter the name of the building'),
                                'lang_property_id_statustext'   => lang('Enter 
Property ID'),
                                'lang_building_id_statustext'   => lang('Enter 
Building ID'),
                                'lang_generaladdress_statustext'=> lang('Enter 
the general address'),
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the building'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'lang_town_statustext'                  => 
lang('Select the part of town the building belongs to. To do not use a part of 
town -  select NO PART OF TOWN'),
                                'lang_part_of_town'                             
=> lang('Part of town'),
                                'lang_no_part_of_town'                  => 
lang('No part of town'),
                                'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('format' => 
'select','selected' => $values['cat_id'],'globals' => True)),
                                'building_type_id'                              
=> $building['building_type_id'],
                                'location_code'                                 
=> $building['location_code'],


                        );

//_debug_array($data);
                        $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add' 
=> $data));
                }

                function delete()
                {
                        $property_id = get_var('property_id',array('GET'));
                        $building_id = 
get_var('building_id',array('POST','GET'));
                        $confirm        = get_var('confirm',array('POST'));

                        $link_data = array
                        (
                                'menuaction' => 
$this->currentapp.'.uibuilding.index'
                        );

                        if (get_var('confirm',array('POST')))
                        {
                                $this->bo->delete($property_id,$building_id);
                                Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                        }

                        
$GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_delete',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header'));

                        $data = array
                        (
                                'appname'                               => 
lang('building'),
                                'function_msg'                  => lang('delete 
building'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.delete&property_id='
 . $property_id.'&building_id=' . $building_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')
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
                }

                function view()
                {
                        $property_id = get_var('property_id',array('GET'));
                        $building_id = get_var('building_id',array('GET'));

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('building',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));

                        $building = 
$this->bo->read_single($property_id,$building_id);

                        $data = array
                        (
                                'appname'                       => 
lang('building'),
                                'function_msg'          => lang('view 
building'),
                                'done_action'           => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.index'),
                                'lang_name'                     => lang('name'),
                                'lang_category'         => lang('category'),
                                'lang_access'           => lang('access'),
                                'lang_time_created'     => lang('time created'),
                                'lang_done'                     => lang('done'),
                                'value_name'            => $building['name'],
                                'value_access'          => 
lang(ucfirst($building['access'])),
                                'value_cat'                     => 
$this->cats->id2name($building['cat']),
                                'value_date'            => 
$GLOBALS['phpgw']->common->show_date($building['date'])
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                }
        }
?>

Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.bocommon.inc.php      26 Jan 2003 12:27:49 -0000      1.7
--- class.bocommon.inc.php      3 Feb 2003 21:50:22 -0000       1.8
***************
*** 50,53 ****
--- 50,54 ----
                        $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->socommon                 = 
CreateObject($this->currentapp.'.socommon',True);
+                       $this->accounts                 = 
CreateObject('phpgwapi.accounts');
  
                        $this->part_of_town_id  = 
get_var('part_of_town_id',array('POST','GET'));
***************
*** 155,158 ****
--- 156,241 ----
                }
  
+               function get_user_list($format='',$selected='')
+               {
+                       switch($format)
+                       {
+                               case 'select':
+                                       
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_select',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
+                                       break;
+                               case 'filter':
+                                       
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_filter',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
+                                       break;
+                       }
+ 
+                       $users = $this->accounts->get_list('accounts', $start, 
$sort, $order, $query);
+ 
+                       while (is_array($users) && list(,$user) = each($users))
+                       {
+                               $sel_user = '';
+                               if ($user['account_id']==$selected)
+                               {
+                                       $sel_user = 'selected';
+                               }
+ 
+                               $user_list[] = array
+                               (
+                                       'user_id'       => $user['account_id'],
+                                       'name'          => 
$user['account_lastname'].', '.$user['account_firstname'],
+                                       'selected'      => $sel_user
+                               );
+                       }
+ 
+                       for ($i=0;$i<count($user_list);$i++)
+                       {
+                               if ($user_list[$i]['selected'] != 'selected')
+                               {
+                                       unset($user_list[$i]['selected']);
+                               }
+                       }
+ 
+ //_debug_array($user_list);
+                       return $user_list;
+               }
+ 
+ 
+               function initiate_ui_location($data)
+               {
+ 
+                       if($data['equipment'])
+                       {
+                               $location['equipment']                          
                        = True;
+                               $location['lang_select_location_statustext']    
= lang('select either a location or an equipment');
+                               $location['equipment_link']                     
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.equipment');
+                               $location['lang_equipment']                     
                        = lang('Equipment');
+                       }
+                       else
+                       {
+                               $location['lang_select_location_statustext']    
= lang('select a location');
+                       }
+ 
+                       if($data['tenant'])
+                       {
+                               $location['tenant']                             
                                = True;
+                               $location['lang_tenant']                        
                        = lang('Tenant');
+                       }
+ 
+ 
+                       $location['value_property_id']                          
                = $data['property_id'];
+                       $location['value_building_id']                          
                = $data['building_id'];
+                       $location['value_entrance_id']                          
                = $data['entrance_id'];
+                       $location['value_apartment_id']                         
                = $data['apartment_id'];
+                       $location['value_tenant_id']                            
                = $data['tenant_id'];
+                       $location['value_equipment_id']                         
                = $data['equipment_id'];
+ 
+                       $location['lang_location']                              
                        = lang('Location');
+                       $location['location_link']                              
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.property');
+                       $location['lang_property']                              
                        = lang('Property');
+                       $location['lang_building']                              
                        = lang('Building');
+                       $location['lang_entrance']                              
                        = lang('Entrance');
+                       $location['lang_apartment']                             
                        = lang('Apartment');
+ 
+                       return $location;
+ 
+               }
  
                function list_methods($_type='xmlrpc')
***************
*** 267,271 ****
                                'link_events'           =>      
$GLOBALS['phpgw']->link('/calendar/index.php'),
                                'lang_events'           =>      lang('Events'),
!                               'link_helpdesk'         =>      
$GLOBALS['phpgw']->link('/property/list_ticket.php','sub=ticket'),
                                'lang_helpdesk'         =>      
lang('Helpdesk'),
                                'link_workorder'        =>      
$GLOBALS['phpgw']->link('/property/list_workorder.php','sub=workorder'),
--- 350,354 ----
                                'link_events'           =>      
$GLOBALS['phpgw']->link('/calendar/index.php'),
                                'lang_events'           =>      lang('Events'),
!                               'link_helpdesk'         =>      
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitts.index&sub=ticket'),
                                'lang_helpdesk'         =>      
lang('Helpdesk'),
                                'link_workorder'        =>      
$GLOBALS['phpgw']->link('/property/list_workorder.php','sub=workorder'),

Index: class.uibuilding.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uibuilding.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.uibuilding.inc.php    27 Jan 2003 10:40:31 -0000      1.2
--- class.uibuilding.inc.php    3 Feb 2003 21:50:22 -0000       1.3
***************
*** 69,76 ****
                        $GLOBALS['phpgw']->xslttpl->add_file(array('building',
                                                                                
'menu',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
!                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field',
!                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'nextmatchs'));
  
                        $sub = get_var('sub',array('POST','GET'));
--- 69,76 ----
                        $GLOBALS['phpgw']->xslttpl->add_file(array('building',
                                                                                
'menu',
+                                                                               
'nextmatchs',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
!                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));
  
                        $sub = get_var('sub',array('POST','GET'));

Index: class.uiinvestment.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiinvestment.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.uiinvestment.inc.php  27 Jan 2003 10:40:31 -0000      1.5
--- class.uiinvestment.inc.php  3 Feb 2003 21:50:22 -0000       1.6
***************
*** 224,229 ****
                                'part_of_town_list'                             
=> $this->bocommon->select_part_of_town('select',$this->part_of_town_id),
                                'select_name_part_of_town'              => 
'part_of_town_id',
- 
- 
                                'filter_list'                                   
=> $this->bo->filter('select',$this->filter),
                                'filter_name'                                   
=> 'filter',
--- 224,227 ----
***************
*** 443,447 ****
                        $values['equipment_id'] = 
get_var('equipment_id',array('POST'));
  
!                       
$GLOBALS['phpgw']->xslttpl->add_file(array('investment',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
  
                        if ($values['save'])
--- 441,453 ----
                        $values['equipment_id'] = 
get_var('equipment_id',array('POST'));
  
!                       
$location_data=$this->bocommon->initiate_ui_location(array('equipment'          
=> True,
!                                                                               
                                                                'tenant'        
        => False,
!                                                                               
                                                                'property_id'   
=> $values['property_id'],
!                                                                               
                                                                'building_id'   
=> $values['building_id'],
!                                                                               
                                                                'entrance_id'   
=> $values['entrance_id'],
!                                                                               
                                                                'apartment_id'  
=> $values['apartment_id'],
!                                                                               
                                                                'equipment_id'  
=> $values['equipment_id']));
! 
!                       
$GLOBALS['phpgw']->xslttpl->add_file(array('investment','location',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));
  
                        if ($values['save'])
***************
*** 503,506 ****
--- 509,513 ----
                        $data = array
                        (
+                               'location_data'                                 
=> $location_data,
                                'appname'                                       
        => lang('investment'),
                                'function_msg'                                  
=> lang('add investment'),

Index: class.uiproperty.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiproperty.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.uiproperty.inc.php    27 Jan 2003 10:40:31 -0000      1.3
--- class.uiproperty.inc.php    3 Feb 2003 21:50:22 -0000       1.4
***************
*** 68,75 ****
                        $GLOBALS['phpgw']->xslttpl->add_file(array('property',
                                                                                
'menu',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
!                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field',
!                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'nextmatchs'));
  
                        $sub = get_var('sub',array('POST','GET'));
--- 68,75 ----
                        $GLOBALS['phpgw']->xslttpl->add_file(array('property',
                                                                                
'menu',
+                                                                               
'nextmatchs',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
!                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));
  
                        $sub = get_var('sub',array('POST','GET'));





reply via email to

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