phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] notes/inc class.bonotes.inc.php, 1.21, 1.22 class.son


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] notes/inc class.bonotes.inc.php, 1.21, 1.22 class.sonotes.inc.php, 1.10, 1.11 class.uinotes.inc.php, 1.29, 1.30 class.bo.inc.php, 1.15, NONE class.so.inc.php, 1.11, NONE class.ui.inc.php, 1.53, NONE
Date: Tue, 11 Nov 2003 12:45:33 +0000

Update of /cvsroot/phpgroupware/notes/inc
In directory subversions:/tmp/cvs-serv32333/inc

Added Files:
        class.bonotes.inc.php class.sonotes.inc.php 
        class.uinotes.inc.php 
Removed Files:
        class.bo.inc.php class.so.inc.php class.ui.inc.php 
Log Message:
update classnames plus nextmatchs

--- NEW FILE: class.bonotes.inc.php ---
<?php
        
/**************************************************************************\
        * phpGroupWare - Notes                                                  
   *
        * http://www.phpgroupware.org                                           
   *
        * Written by : Bettina Gille address@hidden                        *
        * Based on notes by Andy Holman (LoCdOg)                                
   *
        * 
------------------------------------------------------------------------ *
        * Copyright 2000 - 2003 Free Software Foundation, Inc                   
   *
        * This program is part of the GNU project, see http://www.gnu.org/      
   *
        * 
------------------------------------------------------------------------ *
        * This program is free software; you can redistribute it and/or modify 
it  *
        * under the terms of the GNU General Public License as published by the 
   *
        * Free Software Foundation; either version 2 of the License, or (at 
your   *
        * option) any later version.                                            
   *
        
\**************************************************************************/
        /* $Id: class.bonotes.inc.php,v 1.22 2003/11/11 12:45:30 ceb Exp $ */

        class bonotes
        {
                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 bonotes($session=False)
                {
                        $this->sonotes = CreateObject('notes.sonotes');

                        if ($session)
                        {
                                $this->read_sessiondata();
                                $this->use_session = True;
                        }

                        $start  = get_var('start',array('POST','GET'));
                        $query  = get_var('query',array('POST','GET'));
                        $sort   = get_var('sort',array('POST','GET'));
                        $order  = get_var('order',array('POST','GET'));
                        $filter = get_var('filter',array('POST','GET'));
                        $cat_id = get_var('cat_id',array('POST','GET'));

                        $this->start = (isset($start)?$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) && !empty($cat_id))
                        {
                                $this->cat_id = $cat_id;
                        }
                        else
                        {
                                unset($this->cat_id);
                        }
                }

                function list_methods($_type='xmlrpc')
                {
                        /*
                          This handles introspection or discovery by the logged 
in client,
                          in which case the input might be an array.  The 
server always calls
                          this function to fill the server dispatch map using a 
string.
                        */
                        if (is_array($_type))
                        {
                                $_type = $_type['type'] ? $_type['type'] : 
$_type[0];
                        }
                        switch($_type)
                        {
                                case 'xmlrpc':
                                        $xml_functions = array(
                                                'read' => array(
                                                        'function'  => 'read',
                                                        'signature' => 
array(array(xmlrpcInt,xmlrpcStruct)),
                                                        'docstring' => 
lang('Read a single entry by passing the id and fieldlist.')
                                                ),
                                                'save' => array(
                                                        'function'  => 'save',
                                                        'signature' => 
array(array(xmlrpcStruct,xmlrpcStruct)),
                                                        'docstring' => 
lang('Update a single entry by passing the fields.')
                                                ),
                                                'delete' => array(
                                                        'function'  => 'delete',
                                                        'signature' => 
array(array(xmlrpcBoolean,xmlrpcInt)),
                                                        'docstring' => 
lang('Delete a single entry by passing the id.')
                                                ),
                                                'list' => array(
                                                        'function'  => '_list',
                                                        'signature' => 
array(array(xmlrpcStruct,xmlrpcStruct)),
                                                        'docstring' => 
lang('Read a list of entries.')
                                                ),
                                                'list_methods' => array(
                                                        'function'  => 
'list_methods',
                                                        'signature' => 
array(array(xmlrpcStruct,xmlrpcString)),
                                                        'docstring' => 
lang('Read this list of methods.')
                                                )
                                        );
                                        return $xml_functions;
                                        break;
                                case 'soap':
                                        return $this->soap_functions;
                                        break;
                                default:
                                        return array();
                                        break;
                        }
                }

                function save_sessiondata($data)
                {
                        if ($this->use_session)
                        {
                                
$GLOBALS['phpgw']->session->appsession('session_data','notes',$data);
                        }
                }

                function read_sessiondata()
                {
                        $data = 
$GLOBALS['phpgw']->session->appsession('session_data','notes');

                        //_debug_array($data);

                        $this->start    = $data['start'];
                        $this->query    = $data['query'];
                        $this->filter   = $data['filter'];
                        $this->sort             = $data['sort'];
                        $this->order    = $data['order'];
                        $this->cat_id   = $data['cat_id'];
                }

                function check_perms($has, $needed)
                {
                        return (!!($has & $needed) == True);
                }

                function read()
                {
                        $notes = $this->sonotes->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->sonotes->total_records;

                        for ($i=0; $i<count($notes); $i++)
                        {
                                $notes[$i]['date']  = 
$GLOBALS['phpgw']->common->show_date($notes[$i]['date']);
                                $notes[$i]['owner'] = 
$GLOBALS['phpgw']->accounts->id2name($notes[$i]['owner']);
                        }
                        return $notes;
                }

                function read_single($note_id)
                {
                        return $this->sonotes->read_single($note_id);
                }

                function save($note)
                {
                        if ($note['access'])
                        {
                                $note['access'] = 'private';
                        }
                        else
                        {
                                $note['access'] = 'public';
                        }

                        if ($note['note_id'])
                        {
                                if ($note['note_id'] != 0)
                                {
                                        $note_id = $note['note_id'];
                                        $this->sonotes->edit($note);
                                }
                        }
                        else
                        {
                                $note_id = $this->sonotes->add($note);
                        }
                        return $note_id;
                }

                function delete($params)
                {
                        if (is_array($params))
                        {
                                $this->sonotes->delete($params[0]);
                        }
                        else
                        {
                                $this->sonotes->delete($params);
                        }
                }
        }
?>

--- NEW FILE: class.uinotes.inc.php ---
<?php
        
/**************************************************************************\
        * phpGroupWare - Notes                                                  
   *
        * http://www.phpgroupware.org                                           
   *
        * Written by : Bettina Gille address@hidden                        *
        * Based on notes by Andy Holman (LoCdOg)                                
   *
        * 
------------------------------------------------------------------------ *
        * Copyright 2000 - 2003 Free Software Foundation, Inc                   
   *
        * This program is part of the GNU project, see http://www.gnu.org/      
   *
        * 
------------------------------------------------------------------------ *
        * This program is free software; you can redistribute it and/or modify 
it  *
        * under the terms of the GNU General Public License as published by the 
   *
        * Free Software Foundation; either version 2 of the License, or (at 
your   *
        * option) any later version.                                            
   *
        
\**************************************************************************/
        /* $Id: class.uinotes.inc.php,v 1.30 2003/11/11 12:45:30 ceb Exp $ */

        class uinotes
        {
                var $grants;
                var $cat_id;
                var $start;
                var $query;
                var $sort;
                var $order;
                var $filter;

                var $public_functions = array
                (
                        'index'  => True,
                        'view'   => True,
                        'edit'   => True,
                        'delete' => True
                );

                function uinotes()
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
                        $this->cats                     = 
CreateObject('phpgwapi.categories');
                        $this->nextmatchs       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];

                        $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants('notes');
                        $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bonotes          = 
CreateObject('notes.bonotes',True);

                        $this->start            = $this->bonotes->start;
                        $this->query            = $this->bonotes->query;
                        $this->sort                     = $this->bonotes->sort;
                        $this->order            = $this->bonotes->order;
                        $this->filter           = $this->bonotes->filter;
                        $this->cat_id           = $this->bonotes->cat_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->bonotes->save_sessiondata($data);
                }

                function index()
                {
                        $GLOBALS['phpgw']->xslttpl->add_file(array('app_data',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));

                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('notes') . ': ' . lang('list notes');

                        $notes_list = $this->bonotes->read();

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

                                $content[] = array
                                (
                                        'note_id'                               
        => $note['note_id'],
                                        'first'                                 
        => $first,
                                        'date'                                  
        => $note['date'],
                                        'owner'                                 
        => $note['owner'],
                                        'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction=notes.uinotes.view&note_id=' . 
$note['note_id']),
                                        'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction=notes.uinotes.edit&note_id=' . 
$note['note_id']),
                                        'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction=notes.uinotes.delete&note_id=' 
. $note['note_id']),
                                        'lang_view_statustext'          => 
lang('view the note'),
                                        'lang_edit_statustext'          => 
lang('edit the note'),
                                        'lang_delete_statustext'        => 
lang('delete the note'),
                                        'text_view'                             
        => lang('view'),
                                        'text_edit'                             
        => lang('edit'),
                                        'text_delete'                           
=> lang('delete')
                                );
                        }

                        $table_header = array
                        (
                                'sort_time_created'     => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'note_date',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 'notes.uinotes.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
)),
                                'lang_content'          => lang('content'),
                                'lang_time_created'     => lang('time created'),
                                'lang_view'                     => lang('view'),
                                'lang_edit'                     => lang('edit'),
                                'lang_delete'           => lang('delete'),
                                'lang_note_id'          => lang('note id'),
                                'sort_note_id'          => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   => 'note_id',
                                                                                
        'order' => $this->order,
                                                                                
        'extra'         => array('menuaction'   => 'notes.uinotes.index',
                                                                                
                                                        'cat_id'        => 
$this->cat_id)
                                                                                
)),
                                'lang_owner'            => lang('owner')
                        );

                        $table_add = array
                        (
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a note'),
                                'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=notes.uinotes.edit')
                        );

                        $nm = array
                        (
                                'start_record'                                  
=> $this->start,
                                'num_records'                                   
=> count($notes_list),
                                'all_records'                                   
=> $this->bonotes->total_records,
                                'nextmatchs_url'                                
=> $GLOBALS['phpgw']->link('/index.php','menuaction=notes.uinotes.index')
                        );

                        $data = array
                        (
                                'nm_data'                                       
        => $this->nextmatchs->xslt_tpl($nm),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the notes 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_url'                                    
=> $GLOBALS['phpgw']->link('/index.php','menuaction=notes.uinotes.index'),
                                'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
                                '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_search'                                   
=> lang('search'),
                                'table_header'                                  
=> $table_header,
                                'values'                                        
        => $content,
                                'table_add'                                     
        => $table_add 
                        );
                        $this->save_sessiondata();
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                }

                function edit()
                {
                        $note_id        = 
get_var('note_id',array('POST','GET'));
                        $values         = get_var('values',array('POST'));

                        if (is_array($values))
                        {
                                if ($values['save'])
                                {
                                        $values['note_id']      = $note_id;
                                        $note_id = 
$this->bonotes->save($values);
                                        $this->cat_id = 
($values['cat_id']?$values['cat_id']:$this->cat_id);
                                        
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=notes.uinotes.index');
                                }
                                elseif($values['cancel'])
                                {
                                        
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=notes.uinotes.index');
                                }
                                else
                                {
                                        $values['note_id']      = $note_id;
                                        $note_id                        = 
$this->bonotes->save($values);
                                        $action                         = 
'apply';
                                }
                        }

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

                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('notes') . ': ' . ($note_id?lang('edit note'):lang('add note'));

                        if ($note_id)
                        {
                                $note = $this->bonotes->read_single($note_id);
                                $this->cat_id = 
($note['cat_id']?$note['cat_id']:$this->cat_id);
                        }

                        $link_data = array
                        (
                                'menuaction'    => 'notes.uinotes.edit',
                                'note_id'               => $note_id
                        );

                        $data = array
                        (
                                'msgbox_data'                                   
=> (($action=='apply')?$GLOBALS['phpgw']->common->msgbox('note has been 
saved',True):''),
                                'edit_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'lang_content'                                  
=> lang('content'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_access'                                   
=> lang('private'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_cancel'                                   
=> lang('cancel'),
                                'lang_apply'                                    
=> lang('apply'),
                                'value_content'                                 
=> $note['content'],
                                'value_access'                                  
=> $note['access'],
                                'value_cat'                                     
        => $note['cat'],
                                'lang_content_statustext'               => 
lang('Enter the content of the note'),
                                'lang_apply_statustext'                 => 
lang('Apply the values'),
                                'lang_cancel_statustext'                => 
lang('Leave the note untouched and return back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the note and return back to the list'),
                                'lang_access_off_statustext'    => lang('The 
note is public. If the note should be private, check this box'),
                                'lang_access_on_statustext'             => 
lang('The note is private. If the note should be public, uncheck this box'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the notes belongs to. To do not use a category select 
NO CATEGORY'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('format' => 
'select','selected' => $this->cat_id,'globals' => True))
                        );
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
                }

                function delete()
                {
                        $note_id        = 
get_var('note_id',array('POST','GET'));
                        $delete         = get_var('delete',array('POST'));
                        $cancel         = get_var('cancel',array('POST'));

                        $link_data = array
                        (
                                'menuaction' => 'notes.ui.index'
                        );

                        if ($_POST['delete'])
                        {
                                $this->bonotes->delete($note_id);
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }

                        if ($_POST['cancel'])
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }

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

                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('notes') . ': ' . lang('delete note');

                        $data = array
                        (
                                'delete_url'                            => 
$GLOBALS['phpgw']->link('/index.php','menuaction=notes.uinotes.delete&note_id=' 
. $note_id),
                                'lang_delete_msg'                       => 
lang('do you really want to delete this note ?'),
                                'lang_delete'                           => 
lang('delete'),
                                'lang_delete_statustext'        => lang('Delete 
the note'),
                                'lang_cancel_statustext'        => lang('Leave 
the note untouched and return back to the list'),
                                'lang_cancel'                           => 
lang('cancel')
                        );

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

                function view()
                {
                        $note_id        = get_var('note_id',array('GET'));
                        $action         = get_var('action',array('GET'));

                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('notes') . ': ' . lang('view note');

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

                        $note = $this->bonotes->read_single($note_id);

                        $data = array
                        (
                                'done_action'           => 
$GLOBALS['phpgw']->link('/index.php','menuaction=notes.uinotes.index'),
                                'lang_content'          => lang('content'),
                                'lang_category'         => lang('category'),
                                'lang_access'           => lang('access'),
                                'lang_time_created'     => lang('time created'),
                                'lang_done'                     => lang('done'),
                                'value_content'         => $note['content'],
                                'value_access'          => 
lang(ucfirst($note['access'])),
                                'value_cat'                     => 
$this->cats->id2name($note['cat_id']),
                                'value_date'            => 
$GLOBALS['phpgw']->common->show_date($note['date'])
                        );

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

--- NEW FILE: class.sonotes.inc.php ---
<?php
        
/**************************************************************************\
        * phpGroupWare - Notes                                                  
   *
        * http://www.phpgroupware.org                                           
   *
        * Written by : Bettina Gille address@hidden                        *
        * Based on notes by Andy Holman (LoCdOg)                                
   *
        * 
------------------------------------------------------------------------ *
        * Copyright 2000 - 2003 Free Software Foundation, Inc                   
   *
        * This program is part of the GNU project, see http://www.gnu.org/      
   *
        * 
------------------------------------------------------------------------ *
        * This program is free software; you can redistribute it and/or modify 
it  *
        * under the terms of the GNU General Public License as published by the 
   *
        * Free Software Foundation; either version 2 of the License, or (at 
your   *
        * option) any later version.                                            
   *
        
\**************************************************************************/
        /* $Id: class.sonotes.inc.php,v 1.11 2003/11/11 12:45:30 ceb Exp $ */

        class sonotes
        {
                var $grants;

                function sonotes()
                {
                        $this->db               = $GLOBALS['phpgw']->db;
                        $this->db2              = $this->db;
                        $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants('notes');
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }

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

                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
                        }
                        else
                        {
                                $ordermethod = ' order by note_date DESC';
                        }

                        if ($filter == 'none')
                        {
                                $filtermethod = ' ( note_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 .= " OR 
(note_access='public' AND note_owner IN(" . implode(',',$public_user_list) . 
")))";
                                }
                                else
                                {
                                        $filtermethod .= ' )';
                                }
                        }
                        elseif ($filter == 'yours')
                        {
                                $filtermethod = " note_owner='" . 
$this->account . "'";
                        }
                        else
                        {
                                $filtermethod = " note_owner='" . 
$this->account . "' AND note_access='private'";
                        }

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

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

                                $querymethod = " AND note_content LIKE 
'%$query%'";
                        }

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

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

                        while ($this->db->next_record())
                        {
                                $ngrants = 
(int)$this->grants[$this->db->f('note_owner')];
                                $notes[] = array
                                (
                                        'note_id'       => 
(int)$this->db->f('note_id'),
                                        'owner'         => 
$this->db->f('note_owner'),
                                        'owner_id'      => 
(int)$this->db->f('note_owner'),
                                        'access'        => 
$this->db->f('note_access'),
                                        'date'          => 
$this->db->f('note_date'),
                                        'cat_id'        => 
(int)$this->db->f('note_category'),
                                        'content'       => 
stripslashes($this->db->f('note_content')),
                                        'grants'        => $ngrants
                                );
                        }
                        return $notes;
                }

                function read_single($note_id)
                {
                        $this->db->query("select * from phpgw_notes where 
note_id='$note_id'",__LINE__,__FILE__);

                        if ($this->db->next_record())
                        {
                                $note['id']                     = 
(int)$this->db->f('note_id');
                                $note['owner']          = 
$this->db->f('note_owner');
                                $note['content']        = 
stripslashes($this->db->f('note_content'));
                                $note['access']         = 
$this->db->f('note_access');
                                $note['date']           = 
$this->db->f('note_date');
                                $note['cat_id']         = 
(int)$this->db->f('note_category');

                                return $note;
                        }
                }

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

                        $this->db->query("INSERT INTO phpgw_notes 
(note_owner,note_access,note_date,note_content,note_category) "
                                . "VALUES ('" . $this->account . "','" . 
$note['access'] . "','" . time() . "','" . $note['content']
                                . "','" . $note['cat_id'] . 
"')",__LINE__,__FILE__);
                        return 
$this->db->get_last_insert_id('phpgw_notes','note_id');
                }

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

                        $this->db->query("UPDATE phpgw_notes set 
note_content='" . $note['content'] . "', note_date='" . time() . "', 
note_category='"
                                                        . $note['cat_id'] . "', 
note_access='" . $note['access'] . "' WHERE note_id=" . 
intval($note['note_id']),__LINE__,__FILE__);
                }

                function delete($note_id)
                {
                        $this->db->query('DELETE FROM phpgw_notes WHERE 
note_id=' . intval($note_id),__LINE__,__FILE__);
                }
        }
?>

--- class.ui.inc.php DELETED ---

--- class.bo.inc.php DELETED ---

--- class.so.inc.php DELETED ---





reply via email to

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