phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] addressbook/inc class.uicatalog_contact_note_type.inc


From: Jonathan Rivera <address@hidden>
Subject: [Phpgroupware-cvs] addressbook/inc class.uicatalog_contact_note_type.inc.php, NONE, 1.1.2.1 class.uicatalog_contact_comm_type.inc.php, NONE, 1.1.2.1 class.uicatalog_contact_comm_descr.inc.php, NONE, 1.1.2.1 class.uicatalog_contact_addr_type.inc.php, NONE, 1.1.2.1 class.socatalog_contact_note_type.inc.php, NONE, 1.1.2.1 class.socatalog_contact_comm_type.inc.php, NONE, 1.1.2.1 class.socatalog_contact_comm_descr.inc.php, NONE, 1.1.2.1 class.socatalog_contact_addr_type.inc.php, NONE, 1.1.2.1 class.catalog_manager.inc.php, NONE, 1.1.2.1 class.bocatalog_contact_note_type.inc.php, NONE, 1.1.2.1 class.bocatalog_contact_comm_type.inc.php, NONE, 1.1.2.1 class.bocatalog_contact_comm_descr.inc.php, NONE, 1.1.2.1 class.bocatalog_contact_addr_type.inc.php, NONE, 1.1.2.1
Date: Tue, 30 Sep 2003 15:08:40 +0000

Update of /cvsroot/phpgroupware/addressbook/inc
In directory subversions:/tmp/cvs-serv16406/addressbook/inc

Added Files:
      Tag: Version-0_9_16-branch
        class.uicatalog_contact_note_type.inc.php 
        class.uicatalog_contact_comm_type.inc.php 
        class.uicatalog_contact_comm_descr.inc.php 
        class.uicatalog_contact_addr_type.inc.php 
        class.socatalog_contact_note_type.inc.php 
        class.socatalog_contact_comm_type.inc.php 
        class.socatalog_contact_comm_descr.inc.php 
        class.socatalog_contact_addr_type.inc.php 
        class.catalog_manager.inc.php 
        class.bocatalog_contact_note_type.inc.php 
        class.bocatalog_contact_comm_type.inc.php 
        class.bocatalog_contact_comm_descr.inc.php 
        class.bocatalog_contact_addr_type.inc.php 
Log Message:
This files are for catalogs, this is bugfix #5165


--- NEW FILE: class.uicatalog_contact_note_type.inc.php ---
<?php
        include('class.catalog_manager.inc.php');

        class uicatalog_contact_note_type extends catalog_manager
        {
                var $public_functions = array('view' => True);

                function uicatalog_contact_note_type()
                {
                        $this->_constructor();

                        $this->bo = 
CreateObject('addressbook.bocatalog_contact_note_type');
                        
                        $this->form_action = 
'menuaction=addressbook.uicatalog_contact_note_type.view';
                        $this->catalog_name = 'note_types';
                        $this->headers = array('Type', 'Edit', 'Delete');
                        $this->array_name = 'note_types_array';
                        $this->index = 'key_note_id';
                        $this->title = 'Notes Type - Catalog';
                        $this->catalog_button_name = 'note_types_add_row';
                        $this->key_edit_name = 'note_type_id';
                        $this->num_cols = 1;

                        $this->form_fields = array(1 => array('Type', 
$this->get_column_data(
                                                                      
array('type' => 'text',
                                                                            
'name' => 'entry[note_description]', 
                                                                            
'value'=> $this->entry['note_description']))));

                        $this->objs_data = array('value'=> array('type' => 
'data',
                                                                 'field' => 
'note_description'),
                                                 'edit' => array('type' => 
'link',
                                                                 'mode' => 
'edit',
                                                                 'key'  => 
'note_type_id',
                                                                 'action'=> 
'note_types_edit_row',
                                                                 'extra'=> ''),
                                                 'delete'=>array('type' => 
'link',
                                                                 'mode' => 
'delete',
                                                                 'key'  => 
'note_type_id',
                                                                 'action'=> 
'note_types_del_row',
                                                                 'extra'=> ''));
                }

                function view()
                {
                        $this->get_vars();
                        $this->validate_action($this->action);
                        $this->create_window($this->catalog_name, $this->entry, 
$this->title);
                }

                function select_catalog()
                {
                        $this->note_types_array = $this->bo->select_catalog();
                }
                
                function insert($fields)
                {
                        $this->bo->insert($fields);
                }
                
                function delete($key)
                {
                        $this->bo->delete($key);
                }
                
                function update($key, $fields)
                {
                        $this->bo->update($key, $fields);
                }

                function edit($key)
                {
                        $this->catalog_button_name = 'note_types_update_row';
                        $this->key_edit_name = 'note_type_id';
                        $this->key_edit_id = $key;

                        $record = $this->bo->get_record($key);
                        $this->entry['note_description'] = 
$record[0]['note_description'];
                        $this->form_fields = array(1 => array('Type', 
$this->get_column_data(
                                                                      
array('type' => 'text',
                                                                            
'name' => 'entry[note_description]', 
                                                                            
'value'=> $this->entry['note_description']))));
                }
        }
?>

--- NEW FILE: class.catalog_manager.inc.php ---
<?php
  /**************************************************************************\
  * phpGroupWare - catalog_manager                                           *
  * http://www.phpgroupware.org                                              *
  * This program is part of the GNU project, see http://www.gnu.org/         *
  *                                                                          *
  * Copyright 2003 Free Software Foundation, Inc.                            *
  *                                                                          *
  * Originally Written by Jonathan Alberto Rivera Gomez - jarg at co.com.mx  *
  * Current Maintained by Jonathan Alberto Rivera Gomez - jarg at co.com.mx  *
  * --------------------------------------------                             *
  * Development of this application was funded by http://www.sogrp.com       *
  * --------------------------------------------                             *
  *  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 catalog_manager
        {
                var $form_action;
                var $catalog_name;
                var $headers;
                var $array_name;
                var $objs_data;
                var $index;
                var $entry;
                var $action;
                var $form_fields;
                var $title;
                var $catalog_button_name;
                var $num_cols;
                
                function catalog_manager()
                {
                }

                function _constructor()
                {
                        $this->template = &$GLOBALS['phpgw']->template;
                        $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
                }
                
                function create_window($catalog_name, $entry, $title)
                {
                        //start to draw the add window
                        $GLOBALS['phpgw']->common->phpgw_header();
                        echo parse_navbar();
                        $this->main_form($catalog_name, $entry, $title);
                }

                /**
                * Start to draw the html screens
                *
                * @param 
                * @return 
                */
                function main_form($catalog_name, $entry, $title)
                {
                        $this->template->set_file(array('form' => 'form.tpl'));
                        $this->template->set_var('principal_tabs_inc', '');
                        $this->template->set_var('action', 
$GLOBALS['phpgw']->link('/index.php',
                                                                                
   $this->form_action));
                        $this->template->set_var('tab', '');
                        $this->template->set_var('current_tab_body', 
$this->current_body($catalog_name, $entry, $title));
                        $this->template->set_var('control_buttons', '');
                        $this->template->pparse('out', 'form');
                }

                function current_body($catalog_name, $entry, $title)
                {
                        $this->form_start();
                        
                        $this->template->set_var('lang_general_data', $title);

                        $this->template->set_var('current_id_name', 
$this->key_edit_name);
                        $this->template->set_var('current_id', 
$this->key_edit_id);

                        $this->set_form_fields($this->form_fields);
                        
                        $this->select_catalog();
                        
                        $this->template->set_var('detail_fields', 
$this->get_detail_form($catalog_name, $this->headers, 
                                                                                
         $this->array_name, $this->objs_data, 
                                                                                
         $this->index));
                        
                        $this->form_end();
                        
                        return $this->template->fp('out', 
'tab_body_general_data');
                }

                /**
                * Draw the detail form, this form is as show in comms, addr and 
othes windows
                *            
                * @param string $tab The name which identify the section
                * @param array $headers Array with all headers which you want 
to show in the form
                * @param string $array_name The array name from you want to 
show data
                * @param array $objs_data Array with all properties of all data 
which you want to show
                * @param string $idx The index name (for edit mode use)
                * @param boolean $button Flag for indicate if you want draw the 
Add button
                * @return string All the detail form html code in the template
                */
                function get_detail_form($catalog_name, $headers, $array_name, 
$objs_data, $idx, $button=True)
                {
                        $this->template->set_file(array('detail_data'   => 
'body_detail.tpl'));
                        
$this->template->set_block('detail_data','detail_body','detail_body');
                        
$this->template->set_block('detail_data','input_detail_row','input_detail_row');
                        
$this->template->set_block('detail_data','input_detail_data','input_detail_data');

                        $add_button = '<input type="submit" name="'. 
$this->catalog_button_name .'" value="Add">';

                        if($button)
                        {
                                $this->template->set_var('caption_detail', 
$title);
                                $this->template->set_var('add_button', 
$add_button);
                        }
                        else
                        {
                                $this->template->set_var('caption_detail', '');
                                $this->template->set_var('add_button', '');
                        }
                        
                        $this->template->set_var('row_bgc', 
$GLOBALS['phpgw_info']['theme']['th_bg']);
                        $tr_color = $GLOBALS['phpgw_info']['theme']['row_on'];

                        $cols='';
                        foreach($headers as $head)
                        {
                                $cols .= '<td>' . $head . '</td>';
                        }

                        $this->template->set_var('input_cols', $cols);

                        $this->template->fp('input_detail', 
'input_detail_data', True);
                        $this->template->fp('detail_body_set', 
'input_detail_row');

                        if (is_array($this->$array_name))
                        {
                                foreach($this->$array_name as $k => $v)
                                {
                                        $id = $v[$idx]; 
                                        $this->array_value = $v;

                                        $tr_color = 
$this->nextmatchs->alternate_row_color($tr_color);
                                        $this->template->set_var('row_bgc', 
$tr_color);
                                        
                                        $cols='';                       
                                        reset($objs_data);
                                        foreach($objs_data as $type => 
$properties)
                                        {
                                                $cols .= '<td>' . 
$this->get_column_data($properties) . '</td>';
                                        }
                                        
                                        $this->template->set_var('input_cols', 
$cols);
                                        
                                        $this->template->fp('input_detail', 
'input_detail_data', True);
                                        $this->template->fp('detail_body_set', 
'input_detail_row');
                                }
                        }

                        $this->template->set_var('th_bg',   
$GLOBALS['phpgw_info']['theme']['th_bg']);
                        $this->template->set_var('th_text', 
$GLOBALS['phpgw_info']['theme']['th_text']);
                        $this->template->set_var('row_on',  
$GLOBALS['phpgw_info']['theme']['row_on']);
                        $this->template->set_var('row_off', 
$GLOBALS['phpgw_info']['theme']['row_off']);
                        
$this->template->set_var('row_text',$GLOBALS['phpgw_info']['theme']['row_text']);
                        return $this->template->fp('out', 'detail_body');
                }

                /**
                * This function initialize the template for draw the tabs 
windows
                *
                * @param 
                * @return
                */
                function form_start()
                {
                        $this->template->set_file(array('person_data'   => 
'current_catalog_body.tpl'));
                        
$this->template->set_block('person_data','tab_body_general_data','general_data');
                        
$this->template->set_block('person_data','input_data','input_data');
                }

                /**
                * This function end the template for draw the tabs windows
                *
                * @param 
                * @return
                */
                function form_end()
                {
                        $this->template->set_var('th_bg',   
$GLOBALS['phpgw_info']['theme']['th_bg']);
                        $this->template->set_var('th_text', 
$GLOBALS['phpgw_info']['theme']['th_text']);
                        $this->template->set_var('row_on',  
$GLOBALS['phpgw_info']['theme']['row_on']);
                        $this->template->set_var('row_off', 
$GLOBALS['phpgw_info']['theme']['row_off']);
                        
$this->template->set_var('row_text',$GLOBALS['phpgw_info']['theme']['row_text']);
                }

                function set_form_fields($form_fields)
                {
                        $tr_color = $GLOBALS['phpgw_info']['theme']['row_on'];

                        ksort($form_fields, SORT_NUMERIC);

                        $cols='';
                        $count=1;
                        foreach($form_fields as $key => $row)
                        {
                                $tr_color = 
$this->nextmatchs->alternate_row_color($tr_color);
                                $cols = $cols . 
'<td>'.$row[0].'</td>'.'<td>'.$row[1].'</td>';;
                                if($count == $this->num_cols)
                                {
                                        
$this->template->set_var('input_fields_cols', $cols);
                                        $this->template->fp('input_fields', 
'input_data', True);
                                        $cols = '';
                                        $count=1;
                                }
                                $count ++;
                        }
                }
                
                function set_row_input($field_name, $input_name, $input_value, 
$col)
                {
                        if ($col==1)
                        {
                                $this->template->set_var('field_name_one', 
$field_name);
                                $this->template->set_var('input_name_one', 
$input_name);
                                $this->template->set_var('input_value_one', 
$input_value);
                        }
                        else
                        {
                                $this->template->set_var('field_name_two', 
$field_name);
                                $this->template->set_var('input_name_two', 
$input_name);
                                $this->template->set_var('input_value_two', 
$input_value);
                        }
                }

                function set_row_other_input($field_name, $field_value, $col)
                {
                        if ($col==1)
                        {
                                $this->template->set_var('field_other_name1', 
$field_name);
                                $this->template->set_var('value_other_name1', 
$field_value);
                        }
                        else
                        {
                                $this->template->set_var('field_other_name2', 
$field_name);
                                $this->template->set_var('value_other_name2', 
$field_value);
                        }
                }

                function get_column_data($properties=array())
                {                       
                        switch($properties['type'])
                        {
                        case 'data':
                                $column_data = 
$this->array_value[$properties['field']];
                                break;
                        case 'text':
                                if(isset($properties['field']) && 
$properties['field']!='')
                                {
                                        $sub_name = '[' . 
$this->array_value[$properties['field']] . ']" ';
                                }
                                if($this->array_value[$properties['value']])
                                {
                                        $value = 
$this->array_value[$properties['value']];
                                }
                                else
                                {
                                        $value = $properties['value'];
                                }
                                $name = $properties['name'] . $sub_name;
                                $column_data = '<input type="text" 
name="'.$name.'" value="'.$value.'">';
                                break;
                        case 'radio':
                                
if($this->array_value[$properties['field']]=='Y'){$checked='checked';}          
                
                                $column_data = '<input type="radio" name="' . 
$properties['name'] 
                                        .'" value="' . 
$this->array_value[$properties['value']] . '"'. $checked . '>';
                                break;
                        case 'link':
                                $link = $GLOBALS['phpgw']->link('/index.php', 
$this->form_action)
                                        . '&'. $properties['action'] . '=' . 
$this->array_value[$properties['key']] . $properties['extra'];
                                $column_data = '<a 
href="'.$link.'">'.$properties['mode'].'</a>';
                                break;
                        case 'combo':
                                $column_data = '<select 
name="'.$properties['name'].'">'.$properties['value'].'</select>';
                                break;
                        }
                        return $column_data;
                }

                function get_vars()
                {
                        $this->entry = get_var('entry',array('get','post'));

                        
if(get_var($this->catalog_name.'_add_row',array('get','post')))
                        {
                                $this->action = 'insert';
                        }
                        
elseif(get_var($this->catalog_name.'_update_row',array('get','post')))
                        {
                                $this->action = 'update';
                                $this->key = (get_var($this->key_edit_name, 
array('get','post')));
                        }
                        
elseif(get_var($this->catalog_name.'_del_row',array('get','post')))
                        {
                                $this->action = 'delete';
                                $this->key = 
(get_var($this->catalog_name.'_del_row',array('get','post')));
                        }
                        
elseif(get_var($this->catalog_name.'_edit_row',array('get','post')))
                        {
                                $this->action = 'edit';
                                $this->key = 
(get_var($this->catalog_name.'_edit_row',array('get','post')));
                        }
                }

                function validate_action($action='')
                {
                        switch($action)
                        {
                        case 'insert':
                                $this->insert($this->entry);
                                unset($this->entry);
                                break;
                        case 'delete':
                                $this->delete($this->key);
                                unset($this->key);
                                break;
                        case 'edit':
                                $this->edit($this->key);
                                break;
                        case 'update':
                                $this->update($this->key, $this->entry);
                                break;
                        }
                }
        }
?>

--- NEW FILE: class.socatalog_contact_comm_descr.inc.php ---
<?php
        class socatalog_contact_comm_descr
        {
                function socatalog_contact_comm_descr()
                {
                        $this->db = &$GLOBALS['phpgw']->db;
                }
                
                function _constructor()
                {
                }
                
                function select_catalog()
                {
                        $comm_type = 
CreateObject('phpgwapi.contact_comm_descr');
                        $comm_type->add_select('comm_descr_id');
                        $comm_type->add_select('comm_type');
                        $comm_type->add_select('comm_description');
                        $sql = $comm_type->select();
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $return_fields[] = $this->db->Record;
                        }
                        return $return_fields;
                }
                
                function insert($fields)
                {
                        $comm_type = 
CreateObject('phpgwapi.contact_comm_descr');
                        return $comm_type->insert($fields, PHPGW_SQL_RUN_SQL);
                }
                
                function delete($key)
                {
                        $comm_type = 
CreateObject('phpgwapi.contact_comm_descr');
                        return $comm_type->delete('comm_descr_id ='. $key, 
PHPGW_SQL_RUN_SQL);
                }
                
                function update($key, $fields)
                {
                        $comm_type = 
CreateObject('phpgwapi.contact_comm_descr');
                        return $comm_type->update($fields, 'comm_descr_id ='. 
$key, PHPGW_SQL_RUN_SQL);
                }

                function get_record($key)
                {
                        $comm_type = 
CreateObject('phpgwapi.contact_comm_descr');
                        $comm_type->add_select('comm_type');
                        $comm_type->add_select('comm_description');
                        $comm_type->set_criteria('comm_descr_id='. $key);
                        $sql = $comm_type->select();
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $return_fields[] = $this->db->Record;
                        }
                        return $return_fields;
                }

                function select_catalog_types()
                {
                        $comm_type = CreateObject('phpgwapi.contact_comm_type');
                        $comm_type->add_select('comm_type_id');
                        $comm_type->add_select('comm_type_description');
                        $sql = $comm_type->select();
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $return_fields[] = $this->db->Record;
                        }
                        return $return_fields;
                }
        }
?>

--- NEW FILE: class.bocatalog_contact_comm_descr.inc.php ---
<?php
        class bocatalog_contact_comm_descr
        {
                function bocatalog_contact_comm_descr()
                {
                        $this->so = 
CreateObject('addressbook.socatalog_contact_comm_descr');
                }
                
                function select_catalog()
                {
                        $comm_descr = $this->so->select_catalog();
                        foreach($comm_descr as $key => $value)
                        {
                                $comm_descr_array[] = array('comm_type_id' => 
$value['comm_type'],
                                                            'comm_type' => 
$this->search_comm_type_id($value['comm_type']),
                                                            'comm_descr_id' => 
$value['comm_descr_id'],
                                                            'comm_description' 
=> $value['comm_description']);
                        }
                        return $comm_descr_array;
                }
                
                function insert($fields)
                {
                        return $this->so->insert($fields);
                }
                
                function delete($key)
                {
                        return $this->so->delete($key);
                }
                
                function update($key, $fields)
                {
                        $this->so->update($key, $fields);
                }

                function get_record($key)
                {
                        return $this->so->get_record($key);
                }

                function select_catalog_types()
                {
                        $this->comm_type = $this->so->select_catalog_types();
                        return $this->comm_type;
                }

                /**
                * Search communication type id in communications catalog
                *
                * @param integer $id The communication id to find
                * @return string The description type of id
                */
                function search_comm_type_id($id)
                {
                        return $this->search_catalog('comm_type_id', $id, 
'comm_type_description', 'comm_type');
                }
                
                /**
                * Search communication type in location catalog
                *
                * @param string $description The communication type to find
                * @return integer The id of description
                */
                function search_comm_type($description)
                {
                        return $this->search_catalog('comm_type_description', 
$description, 'comm_type_id', 'comm_type');
                }

                /**
                * Search a value into an array
                *
                * @param string $field_to_search Field into what you want to 
find
                * @param string $value_to_search Value what you want
                * @param string $field Field what you want return
                * @param string $catalog Catalog name into you want to find
                * @return string The value which you requiere in $field
                */
                function search_catalog($field_to_search, $value_to_search, 
$field, $catalog)
                {
                        reset($this->$catalog);
                        foreach ($this->$catalog as $key => $value)
                        {
                                if ($value[$field_to_search] == 
$value_to_search)
                                {
                                        return $value[$field];
                                }
                        }
                }
        }
?>

--- NEW FILE: class.bocatalog_contact_note_type.inc.php ---
<?php
        class bocatalog_contact_note_type
        {
                function bocatalog_contact_note_type()
                {
                        $this->so = 
CreateObject('addressbook.socatalog_contact_note_type');
                }
                
                function select_catalog()
                {
                        return $this->so->select_catalog();
                }
                
                function insert($fields)
                {
                        return $this->so->insert($fields);
                }
                
                function delete($key)
                {
                        return $this->so->delete($key);
                }
                
                function update($key, $fields)
                {
                        $this->so->update($key, $fields);
                }

                function get_record($key)
                {
                        return $this->so->get_record($key);
                }
        }
?>

--- NEW FILE: class.socatalog_contact_addr_type.inc.php ---
<?php
        class socatalog_contact_addr_type
        {
                function socatalog_contact_addr_type()
                {
                        $this->db = &$GLOBALS['phpgw']->db;
                }
                
                function _constructor()
                {
                }
                
                function select_catalog()
                {
                        $addr_type = CreateObject('phpgwapi.contact_addr_type');
                        $addr_type->add_select('addr_type_id');
                        $addr_type->add_select('addr_description');
                        $sql = $addr_type->select();
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $return_fields[] = $this->db->Record;
                        }
                        return $return_fields;
                }
                
                function insert($fields)
                {
                        $comm_type = CreateObject('phpgwapi.contact_addr_type');
                        return $comm_type->insert($fields, PHPGW_SQL_RUN_SQL);
                }
                
                function delete($key)
                {
                        $comm_type = CreateObject('phpgwapi.contact_addr_type');
                        return $comm_type->delete('addr_type_id ='. $key, 
PHPGW_SQL_RUN_SQL);
                }
                
                function update($key, $fields)
                {
                        $comm_type = CreateObject('phpgwapi.contact_addr_type');
                        return $comm_type->update($fields, 'addr_type_id ='. 
$key, PHPGW_SQL_RUN_SQL);
                }

                function get_record($key)
                {
                        $comm_type = CreateObject('phpgwapi.contact_addr_type');
                        $comm_type->add_select('addr_type_id');
                        $comm_type->add_select('addr_description');
                        $comm_type->set_criteria('addr_type_id='. $key);
                        $sql = $comm_type->select();
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $return_fields[] = $this->db->Record;
                        }
                        return $return_fields;
                }
        }
?>

--- NEW FILE: class.socatalog_contact_note_type.inc.php ---
<?php
        class socatalog_contact_note_type
        {
                function socatalog_contact_note_type()
                {
                        $this->db = &$GLOBALS['phpgw']->db;
                }
                
                function _constructor()
                {
                }
                
                function select_catalog()
                {
                        $comm_type = CreateObject('phpgwapi.contact_note_type');
                        $comm_type->add_select('note_type_id');
                        $comm_type->add_select('note_description');
                        $sql = $comm_type->select();
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $return_fields[] = $this->db->Record;
                        }
                        return $return_fields;
                }
                
                function insert($fields)
                {
                        $comm_type = CreateObject('phpgwapi.contact_note_type');
                        return $comm_type->insert($fields, PHPGW_SQL_RUN_SQL);
                }
                
                function delete($key)
                {
                        $comm_type = CreateObject('phpgwapi.contact_note_type');
                        return $comm_type->delete('note_type_id ='. $key, 
PHPGW_SQL_RUN_SQL);
                }
                
                function update($key, $fields)
                {
                        $comm_type = CreateObject('phpgwapi.contact_note_type');
                        return $comm_type->update($fields, 'note_type_id ='. 
$key, PHPGW_SQL_RUN_SQL);
                }

                function get_record($key)
                {
                        $comm_type = CreateObject('phpgwapi.contact_note_type');
                        $comm_type->add_select('note_type_id');
                        $comm_type->add_select('note_description');
                        $comm_type->set_criteria('note_type_id='. $key);
                        $sql = $comm_type->select();
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $return_fields[] = $this->db->Record;
                        }
                        return $return_fields;
                }
        }
?>

--- NEW FILE: class.bocatalog_contact_addr_type.inc.php ---
<?php
        class bocatalog_contact_addr_type
        {
                function bocatalog_contact_addr_type()
                {
                        $this->so = 
CreateObject('addressbook.socatalog_contact_addr_type');
                }
                
                function select_catalog()
                {
                        return $this->so->select_catalog();
                }
                
                function insert($fields)
                {
                        return $this->so->insert($fields);
                }
                
                function delete($key)
                {
                        return $this->so->delete($key);
                }
                
                function update($key, $fields)
                {
                        $this->so->update($key, $fields);
                }

                function get_record($key)
                {
                        return $this->so->get_record($key);
                }
        }
?>

--- NEW FILE: class.uicatalog_contact_comm_descr.inc.php ---
<?php
        include('class.catalog_manager.inc.php');

        class uicatalog_contact_comm_descr extends catalog_manager
        {
                var $public_functions = array('view' => True);

                function uicatalog_contact_comm_descr()
                {
                        $this->_constructor();

                        $this->bo = 
CreateObject('addressbook.bocatalog_contact_comm_descr');
                        
                        $this->form_action = 
'menuaction=addressbook.uicatalog_contact_comm_descr.view';
                        $this->catalog_name = 'comm_descr';
                        $this->headers = array('Type', 'Description', 'Edit', 
'Delete');
                        $this->array_name = 'comm_descr_array';
                        $this->index = '';
                        $this->title = 'Communications Description - Catalog';
                        $this->catalog_button_name = 'comm_descr_add_row';
                        $this->key_edit_name = 'comm_descr_id';
                        $this->num_cols = 2;
                        
                        $this->form_fields = array(1 => array('Type', 
$this->get_column_data(
                                                                      
array('type' => 'combo',
                                                                            
'name' => 'entry[comm_type]', 
                                                                            
'value'=> $this->get_options()))),
                                                   2 => array('Description', 
$this->get_column_data(
                                                                      
array('type' => 'text',
                                                                            
'name' => 'entry[comm_description]', 
                                                                            
'value'=> ''))));

                        $this->objs_data = array('value'=> array('type' => 
'data',
                                                                 'field' => 
'comm_type'),
                                                 'value1'=> array('type' => 
'data',
                                                                 'field' => 
'comm_description'),
                                                 'edit' => array('type' => 
'link',
                                                                 'mode' => 
'edit',
                                                                 'key'  => 
'comm_descr_id',
                                                                 'action'=> 
'comm_descr_edit_row',
                                                                 'extra'=> ''),
                                                 'delete'=>array('type' => 
'link',
                                                                 'mode' => 
'delete',
                                                                 'key'  => 
'comm_descr_id',
                                                                 'action'=> 
'comm_descr_del_row',
                                                                 'extra'=> ''));
                }

                function view()
                {
                        $this->get_vars();
                        $this->validate_action($this->action);
                        $this->create_window($this->catalog_name, $this->entry, 
$this->title);
                }

                function select_catalog()
                {
                        $this->comm_descr_array = $this->bo->select_catalog();
                }
                
                function insert($fields)
                {
                        $this->bo->insert($fields);
                }
                
                function delete($key)
                {
                        $this->bo->delete($key);
                }
                
                function update($key, $fields)
                {
                        $this->bo->update($key, $fields);
                }

                function edit($key)
                {
                        $this->catalog_button_name = 'comm_descr_update_row';
                        $this->key_edit_name = 'comm_descr_id';
                        $this->key_edit_id = $key;

                        $record = $this->bo->get_record($key);
                        $entry['comm_type'] = $record[0]['comm_type'];
                        $entry['comm_description'] = 
$record[0]['comm_description'];
                        $this->form_fields = array(1 => array('Type', 
$this->get_column_data(
                                                                      
array('type' => 'combo',
                                                                            
'name' => 'entry[comm_type]', 
                                                                            
'value'=> $this->get_options($entry['comm_type'])))),
                                                   2 => array('Description', 
$this->get_column_data(
                                                                      
array('type' => 'text',
                                                                            
'name' => 'entry[comm_description]', 
                                                                            
'value'=> $entry['comm_description']))));
                }

                function get_options($selected='')
                {
                        $this->comm_type_array = 
$this->bo->select_catalog_types();
                        foreach($this->comm_type_array as $option)
                        {
                                if ($option['comm_type_id'] == $selected)
                                {
                                        $options .= '<option 
value="'.$option['comm_type_id'].'" selected>' 
                                                . 
$option['comm_type_description'] . '</option>';

                                }
                                else
                                {
                                        $options .= '<option 
value="'.$option['comm_type_id'].'">' 
                                                . 
$option['comm_type_description'] . '</option>';
                                }
                        }
                        return $options;
                }
        }
?>

--- NEW FILE: class.socatalog_contact_comm_type.inc.php ---
<?php
        class socatalog_contact_comm_type
        {
                function socatalog_contact_comm_type()
                {
                        $this->db = &$GLOBALS['phpgw']->db;
                }
                
                function _constructor()
                {
                }
                
                function select_catalog()
                {
                        $comm_type = CreateObject('phpgwapi.contact_comm_type');
                        $comm_type->add_select('comm_type_id');
                        $comm_type->add_select('comm_type_description');
                        $sql = $comm_type->select();
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $return_fields[] = $this->db->Record;
                        }
                        return $return_fields;
                }
                
                function insert($fields)
                {
                        $comm_type = CreateObject('phpgwapi.contact_comm_type');
                        return $comm_type->insert($fields, PHPGW_SQL_RUN_SQL);
                }
                
                function delete($key)
                {
                        $comm_type = CreateObject('phpgwapi.contact_comm_type');
                        return $comm_type->delete('comm_type_id ='. $key, 
PHPGW_SQL_RUN_SQL);
                }
                
                function update($key, $fields)
                {
                        $comm_type = CreateObject('phpgwapi.contact_comm_type');
                        return $comm_type->update($fields, 'comm_type_id ='. 
$key, PHPGW_SQL_RUN_SQL);
                }

                function get_record($key)
                {
                        $comm_type = CreateObject('phpgwapi.contact_comm_type');
                        $comm_type->add_select('comm_type_id');
                        $comm_type->add_select('comm_type_description');
                        $comm_type->set_criteria('comm_type_id='. $key);
                        $sql = $comm_type->select();
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $return_fields[] = $this->db->Record;
                        }
                        return $return_fields;
                }
        }
?>

--- NEW FILE: class.uicatalog_contact_addr_type.inc.php ---
<?php
        include('class.catalog_manager.inc.php');

        class uicatalog_contact_addr_type extends catalog_manager
        {
                var $public_functions = array('view' => True);

                function uicatalog_contact_addr_type()
                {
                        $this->_constructor();

                        $this->bo = 
CreateObject('addressbook.bocatalog_contact_addr_type');
                        
                        $this->form_action = 
'menuaction=addressbook.uicatalog_contact_addr_type.view';
                        $this->catalog_name = 'addr_types';
                        $this->headers = array('Type', 'Edit', 'Delete');
                        $this->array_name = 'addr_types_array';
                        $this->index = 'key_addr_id';
                        $this->title = 'Location Types - Catalog';
                        $this->catalog_button_name = 'addr_types_add_row';
                        $this->key_edit_name = 'addr_type_id';
                        $this->num_cols = 1;

                        $this->form_fields = array(1 => array('Type', 
$this->get_column_data(
                                                                      
array('type' => 'text',
                                                                            
'name' => 'entry[addr_description]', 
                                                                            
'value'=> $this->entry['addr_description']))));

                        $this->objs_data = array('value'=> array('type' => 
'data',
                                                                 'field' => 
'addr_description'),
                                                 'edit' => array('type' => 
'link',
                                                                 'mode' => 
'edit',
                                                                 'key'  => 
'addr_type_id',
                                                                 'action'=> 
'addr_types_edit_row',
                                                                 'extra'=> ''),
                                                 'delete'=>array('type' => 
'link',
                                                                 'mode' => 
'delete',
                                                                 'key'  => 
'addr_type_id',
                                                                 'action'=> 
'addr_types_del_row',
                                                                 'extra'=> ''));
                }

                function view()
                {
                        $this->get_vars();
                        $this->validate_action($this->action);
                        $this->create_window($this->catalog_name, $this->entry, 
$this->title);
                }

                function select_catalog()
                {
                        $this->addr_types_array = $this->bo->select_catalog();
                }
                
                function insert($fields)
                {
                        $this->bo->insert($fields);
                }
                
                function delete($key)
                {
                        $this->bo->delete($key);
                }
                
                function update($key, $fields)
                {
                        $this->bo->update($key, $fields);
                }

                function edit($key)
                {
                        $this->catalog_button_name = 'addr_types_update_row';
                        $this->key_edit_name = 'addr_type_id';
                        $this->key_edit_id = $key;

                        $record = $this->bo->get_record($key);
                        $this->entry['addr_description'] = 
$record[0]['addr_description'];
                        $this->form_fields = array(1 => array('Type', 
$this->get_column_data(
                                                                      
array('type' => 'text',
                                                                            
'name' => 'entry[addr_description]', 
                                                                            
'value'=> $this->entry['addr_description']))));
                }
        }
?>

--- NEW FILE: class.bocatalog_contact_comm_type.inc.php ---
<?php
        class bocatalog_contact_comm_type
        {
                function bocatalog_contact_comm_type()
                {
                        $this->so = 
CreateObject('addressbook.socatalog_contact_comm_type');
                }
                
                function select_catalog()
                {
                        return $this->so->select_catalog();
                }
                
                function insert($fields)
                {
                        return $this->so->insert($fields);
                }
                
                function delete($key)
                {
                        return $this->so->delete($key);
                }
                
                function update($key, $fields)
                {
                        $this->so->update($key, $fields);
                }

                function get_record($key)
                {
                        return $this->so->get_record($key);
                }
        }
?>

--- NEW FILE: class.uicatalog_contact_comm_type.inc.php ---
<?php
        include('class.catalog_manager.inc.php');

        class uicatalog_contact_comm_type extends catalog_manager
        {
                var $public_functions = array('view' => True);

                function uicatalog_contact_comm_type()
                {
                        $this->_constructor();

                        $this->bo = 
CreateObject('addressbook.bocatalog_contact_comm_type');
                        
                        $this->form_action = 
'menuaction=addressbook.uicatalog_contact_comm_type.view';
                        $this->catalog_name = 'comm_types';
                        $this->headers = array('Type', 'Edit', 'Delete');
                        $this->array_name = 'comm_types_array';
                        $this->index = 'key_comm_id';
                        $this->title = 'Communication Types - Catalog';
                        $this->catalog_button_name = 'comm_types_add_row';
                        $this->key_edit_name = 'comm_type_id';
                        $this->num_cols = 1;

                        $this->form_fields = array(1 => array('Type', 
$this->get_column_data(
                                                                      
array('type' => 'text',
                                                                            
'name' => 'entry[comm_type_description]', 
                                                                            
'value'=> $this->entry['comm_type_description']))));

                        $this->objs_data = array('value'=> array('type' => 
'data',
                                                                 'field' => 
'comm_type_description'),
                                                 'edit' => array('type' => 
'link',
                                                                 'mode' => 
'edit',
                                                                 'key'  => 
'comm_type_id',
                                                                 'action'=> 
'comm_types_edit_row',
                                                                 'extra'=> ''),
                                                 'delete'=>array('type' => 
'link',
                                                                 'mode' => 
'delete',
                                                                 'key'  => 
'comm_type_id',
                                                                 'action'=> 
'comm_types_del_row',
                                                                 'extra'=> ''));
                }

                function view()
                {
                        $this->get_vars();
                        $this->validate_action($this->action);
                        $this->create_window($this->catalog_name, $this->entry, 
$this->title);
                }

                function select_catalog()
                {
                        $this->comm_types_array = $this->bo->select_catalog();
                }
                
                function insert($fields)
                {
                        $this->bo->insert($fields);
                }
                
                function delete($key)
                {
                        $this->bo->delete($key);
                }
                
                function update($key, $fields)
                {
                        $this->bo->update($key, $fields);
                }

                function edit($key)
                {
                        $this->catalog_button_name = 'comm_types_update_row';
                        $this->key_edit_name = 'comm_type_id';
                        $this->key_edit_id = $key;

                        $record = $this->bo->get_record($key);
                        $this->entry['comm_type_description'] = 
$record[0]['comm_type_description'];
                        $this->form_fields = array(1 => array('Type', 
$this->get_column_data(
                                                                      
array('type' => 'text',
                                                                            
'name' => 'entry[comm_type_description]', 
                                                                            
'value'=> $this->entry['comm_type_description']))));
                }
        }
?>





reply via email to

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