phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


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

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

date: 2004/06/02 18:54:28;  author: sigurdne;  state: Exp;  lines: +113 -0

Log Message:
no message
=====================================================================
<?php
        
/**************************************************************************\
        * phpGroupWare - property                                               
   *
        * http://www.phpgroupware.org                                           
   *
        *                                                                       
   *
        * Facilities Management                                                 
   *
        * Written by Sigurd Nes [sigurdne at online.no]                         
   *
        * 
------------------------------------------------------------------------ *
        * Copyright 2000 - 2003 Free Software Foundation, Inc                   
   *
        * This program is part of the GNU project, see http://www.gnu.org/      
   *
        * 
------------------------------------------------------------------------ *
        * This program is free software; you can redistribute it and/or modify 
it  *
        * under the terms of the GNU General Public License as published by the 
   *
        * Free Software Foundation; either version 2 of the License, or (at 
your   *
        * option) any later version.                                            
   *
        
\**************************************************************************/

        class soadmin
        {

                function soadmin()
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->db               = $GLOBALS['phpgw']->db;
                        $this->db2              = $this->db;
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->socommon         = 
CreateObject($this->currentapp.'.socommon');

                        $this->join                     = $this->socommon->join;
                }


                function get_initials($id)
                {
                        $this->db->query("SELECT initials FROM fm_ecouser WHERE 
id=$id ");
                        $this->db->next_record();
                        return $this->db->f('initials');
                }

                function set_initials($initials)
                {
                        while (is_array($initials) && list($account_id,$value) 
= each($initials))
                        {
                                $this->db->query("UPDATE fm_ecouser set 
initials= '$value' WHERE id=$account_id ",__LINE__,__FILE__);
                                if($value)
                                {
                                        if(!$this->get_initials($account_id))
                                        {
                                                $account_lid    = 
strtoupper($GLOBALS['phpgw']->accounts->id2name($account_id));
                                                $this->db->query("INSERT INTO 
fm_ecouser (id,lid,initials) VALUES ($account_id,'$account_lid','$value' 
)",__LINE__,__FILE__);
                                        }
                                }
                        }
                }

                function select_location($grant='')
                {
                        if($grant)
                        {
                                $filter = ' WHERE allow_grant=1';
                        }
                        $this->db->query("SELECT * FROM fm_acl_location $filter 
ORDER BY id ");

                                $i = 0;
                                while ($this->db->next_record())
                                {
                                                $location[$i]['id']             
        = $this->db->f('id');
                                                $location[$i]['descr']          
= stripslashes($this->db->f('descr'));
                                $i++;
                                }

                                return $location;
                }


                function read_fm_id()
                {
                        $sql = "select * from fm_idgenerator ";
                        $this->db->query($sql,__LINE__,__FILE__);

                        while ($this->db->next_record())
                        {
                                $fm_ids[] = array(
                                                        'descr'         => 
$this->db->f('name'),
                                                        'value'         => 
$this->db->f('value'),
                                                        'remark'        => 
$this->db->f('remark')
                                );

                        }

                        return $fm_ids;
                }

                function edit_id($values='')
                {
                        $field=$values['field'];
                        $select=$values['select'];

                        while($entry=each($select))
                                {
                                        $n=$entry[0];


                                        $sql = "update  fm_idgenerator set 
value='$values[$n]' where name='$field[$n]'";
                                        
$this->db->query($sql,__LINE__,__FILE__);

                                }

                        $receipt['message'][] = array('msg' => lang('ID is 
updated'));
                        return $receipt;
                }
        }
?>




reply via email to

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