phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc/class.accounts.inc.php, 1.12


From: nomail
Subject: [Phpgroupware-cvs] phpgwapi/inc/class.accounts.inc.php, 1.12
Date: Tue, 27 Jul 2004 15:11:01 +0200

Update of /phpgwapi/inc
Modified Files:
        Branch: 
          class.accounts.inc.php

date: 2004/07/27 13:11:01;  author: fipsfuchs;  state: Exp;  lines: +25 -17

Log Message:
some code moved to parent class
code makeup
=====================================================================
Index: phpgwapi/inc/class.accounts.inc.php
diff -u phpgwapi/inc/class.accounts.inc.php:1.11 
phpgwapi/inc/class.accounts.inc.php:1.12
--- phpgwapi/inc/class.accounts.inc.php:1.11    Fri Jun 25 08:17:37 2004
+++ phpgwapi/inc/class.accounts.inc.php Tue Jul 27 13:11:01 2004
@@ -53,8 +53,14 @@
 
        class accounts_
        {
-               var $memberships = Array();
-               var $members = Array();
+               var $db;
+               var $account_id; // better use $this->data[$this->fields[0]]
+               var $data;
+               var $total;
+               var $account_type; // better use $this->data[$this->fields[6]]
+               
+               var $memberships = array();
+               var $members = array();
 
                var $fields = array(0  => 'account_id',
                                    1  => 'account_lid',
@@ -89,21 +95,28 @@
                        }
                }
 
+               /* use function read_repository to get the entire content of 
data */
+               function get_account_data($account_id)
+               {
+                       $this->account_id = $account_id;
+                       $this->read_repository();
+
+                       $data[$this->data['account_id']]['lid']       = 
$this->data[$this->fields[1]];
+                       $data[$this->data['account_id']]['firstname'] = 
$this->data[$this->fields[2]];
+                       $data[$this->data['account_id']]['lastname']  = 
$this->data[$this->fields[3]];
+                       $data[$this->data['account_id']]['fullname']  = 
$this->data[$this->fields[2]].' '.$this->data[$this->fields[3]]; //method 
build_fullname in api would make more sense
+                       $data[$this->data['account_id']]['type']      = 
$this->data[$this->fields[5]];
+                       return $data;
+               }
+
                function is_expired()
                {
-                       if($this->data['expires'] != -1 && 
$this->data['expires'] < time())
-                       {
-                               return True;
-                       }
-                       else
-                       {
-                               return False;
-                       }
+                       return ($this->data[$this->fields[7]] != -1 && 
$this->data[$this->fields[7]] < time());
                }
 
                function read()
                {
-                       if(count($this->data) == 0)
+                       if(!count($this->data))
                        {
                                $this->read_repository();
                        }
@@ -115,10 +128,7 @@
                // this is more a replace_data
                function update_data($data)
                {
-                       reset($data);
-                       $this->data = Array();
                        $this->data = $data;
-
                        reset($this->data);
                        return $this->data;
                }
@@ -151,9 +161,7 @@
                        $account_id = get_account_id($accountid);
 
                        $security_equals = Array();
-                       $acl = CreateObject('phpgwapi.acl');
-                       $security_equals = 
$acl->get_ids_for_location($account_id, 1, 'phpgw_group');
-                       unset($acl);
+                       $security_equals = 
$GLOBALS['phpgw']->acl->get_ids_for_location($account_id, 1, 'phpgw_group');
 
                        if($security_equals == False)
                        {




reply via email to

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