"using the global db object"

This commit is contained in:
Ralf Becker 2008-03-15 15:52:27 +00:00
parent 0927d90e09
commit 78624aa9e9

View File

@ -1,26 +1,14 @@
<?php
/**************************************************************************\
* eGroupWare API - Applications manager functions *
* This file written by Mark Peters <skeeter@phpgroupware.org> *
* Copyright (C) 2001 Mark Peters *
* ------------------------------------------------------------------------ *
* This library is part of the eGroupWare API *
* http://www.egroupware.org/api *
* ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, *
* or any later version. *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
/**
* eGroupWare API - Applications
*
* @link http://www.egroupware.org
* @author Mark Peters <skeeter@phpgroupware.org>
* Copyright (C) 2001 Mark Peters
* @license http://opensource.org/licenses/lgpl-license.php LGPL - GNU Lesser General Public License
* @package api
* @version $Id$
*/
/**
* functions for managing and installing apps
@ -31,12 +19,17 @@
{
var $account_id;
var $data = Array();
/**
* Reference to the global db class
*
* @var egw_db
*/
var $db;
var $table_name = 'egw_applications';
var $public_functions = array(
/*var $public_functions = array(
'list_methods' => True,
'read' => True
);
);*/
var $xmlrpc_methods = array();
/**************************************************************************\
@ -52,13 +45,12 @@
{
if (is_object($GLOBALS['egw_setup']) && is_object($GLOBALS['egw_setup']->db))
{
$this->db = clone($GLOBALS['egw_setup']->db);
$this->db = $GLOBALS['egw_setup']->db;
}
else
{
$this->db = clone($GLOBALS['egw']->db);
$this->db = $GLOBALS['egw']->db;
}
$this->db->set_app('phpgwapi');
$this->account_id = get_account_id($account_id);
@ -284,23 +276,22 @@
*/
function read_installed_apps()
{
$this->db->select($this->table_name,'*','app_enabled != 0',__LINE__,__FILE__,false,'ORDER BY app_order ASC');
while ($this->db->next_record())
foreach($this->db->select($this->table_name,'*','app_enabled != 0',__LINE__,__FILE__,false,'ORDER BY app_order ASC') as $row)
{
$title = $app_name = $this->db->f('app_name');
$title = $app_name = $row['app_name'];
if (@is_array($GLOBALS['egw_info']['user']['preferences']) && ($t = lang($app_name)) != $app_name.'*')
{
$title = $t;
}
$GLOBALS['egw_info']['apps'][$this->db->f('app_name')] = Array(
$GLOBALS['egw_info']['apps'][$app_name] = Array(
'title' => $title,
'name' => $this->db->f('app_name'),
'name' => $app_name,
'enabled' => True,
'status' => $this->db->f('app_enabled'),
'id' => (int)$this->db->f('app_id'),
'order' => (int)$this->db->f('app_order'),
'version' => $this->db->f('app_version')
'status' => $row['app_enabled'],
'id' => (int)$row['app_id'],
'order' => (int)$row['app_order'],
'version' => $row['app_version'],
);
}
}