"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 <?php
/**************************************************************************\ /**
* eGroupWare API - Applications manager functions * * eGroupWare API - Applications
* This file written by Mark Peters <skeeter@phpgroupware.org> * *
* Copyright (C) 2001 Mark Peters * * @link http://www.egroupware.org
* ------------------------------------------------------------------------ * * @author Mark Peters <skeeter@phpgroupware.org>
* This library is part of the eGroupWare API * * Copyright (C) 2001 Mark Peters
* http://www.egroupware.org/api * * @license http://opensource.org/licenses/lgpl-license.php LGPL - GNU Lesser General Public License
* ------------------------------------------------------------------------ * * @package api
* This library is free software; you can redistribute it and/or modify it * * @version $Id$
* 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$ */
/** /**
* functions for managing and installing apps * functions for managing and installing apps
@ -31,12 +19,17 @@
{ {
var $account_id; var $account_id;
var $data = Array(); var $data = Array();
/**
* Reference to the global db class
*
* @var egw_db
*/
var $db; var $db;
var $table_name = 'egw_applications'; var $table_name = 'egw_applications';
var $public_functions = array( /*var $public_functions = array(
'list_methods' => True, 'list_methods' => True,
'read' => True 'read' => True
); );*/
var $xmlrpc_methods = array(); var $xmlrpc_methods = array();
/**************************************************************************\ /**************************************************************************\
@ -52,13 +45,12 @@
{ {
if (is_object($GLOBALS['egw_setup']) && is_object($GLOBALS['egw_setup']->db)) 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 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); $this->account_id = get_account_id($account_id);
@ -284,23 +276,22 @@
*/ */
function read_installed_apps() function read_installed_apps()
{ {
$this->db->select($this->table_name,'*','app_enabled != 0',__LINE__,__FILE__,false,'ORDER BY app_order ASC'); foreach($this->db->select($this->table_name,'*','app_enabled != 0',__LINE__,__FILE__,false,'ORDER BY app_order ASC') as $row)
while ($this->db->next_record())
{ {
$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.'*') if (@is_array($GLOBALS['egw_info']['user']['preferences']) && ($t = lang($app_name)) != $app_name.'*')
{ {
$title = $t; $title = $t;
} }
$GLOBALS['egw_info']['apps'][$this->db->f('app_name')] = Array( $GLOBALS['egw_info']['apps'][$app_name] = Array(
'title' => $title, 'title' => $title,
'name' => $this->db->f('app_name'), 'name' => $app_name,
'enabled' => True, 'enabled' => True,
'status' => $this->db->f('app_enabled'), 'status' => $row['app_enabled'],
'id' => (int)$this->db->f('app_id'), 'id' => (int)$row['app_id'],
'order' => (int)$this->db->f('app_order'), 'order' => (int)$row['app_order'],
'version' => $this->db->f('app_version') 'version' => $row['app_version'],
); );
} }
} }