forked from extern/egroupware
some code-modernisation while looking for the fix to show title of disabled apps
This commit is contained in:
parent
27497d4f21
commit
1433761aa6
@ -21,6 +21,7 @@
|
|||||||
\**************************************************************************/
|
\**************************************************************************/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@class applicatons
|
@class applicatons
|
||||||
@abstract functions for managing and installing apps
|
@abstract functions for managing and installing apps
|
||||||
@ -111,25 +112,24 @@
|
|||||||
$this->read_installed_apps();
|
$this->read_installed_apps();
|
||||||
}
|
}
|
||||||
$this->data = Array();
|
$this->data = Array();
|
||||||
if($this->account_id == False) { return False; }
|
if(!$this->account_id)
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
$apps = $GLOBALS['phpgw']->acl->get_user_applications($this->account_id);
|
$apps = $GLOBALS['phpgw']->acl->get_user_applications($this->account_id);
|
||||||
reset($GLOBALS['phpgw_info']['apps']);
|
foreach($GLOBALS['phpgw_info']['apps'] as $app => $data)
|
||||||
while ($app = each($GLOBALS['phpgw_info']['apps']))
|
|
||||||
{
|
{
|
||||||
// $check = $phpgw->acl->check('run',1,$app[0]);
|
if (isset($apps[$app]) && $apps[$app])
|
||||||
$check = (isset($apps[$app[0]])?$apps[$app[0]]:False);
|
|
||||||
if ($check)
|
|
||||||
{
|
{
|
||||||
$this->data[$app[0]] = array(
|
$this->data[$app] = array(
|
||||||
'title' => $GLOBALS['phpgw_info']['apps'][$app[0]]['title'],
|
'title' => $GLOBALS['phpgw_info']['apps'][$app]['title'],
|
||||||
'name' => $app[0],
|
'name' => $app,
|
||||||
'enabled' => True,
|
'enabled' => True,
|
||||||
'status' => $GLOBALS['phpgw_info']['apps'][$app[0]]['status'],
|
'status' => $GLOBALS['phpgw_info']['apps'][$app]['status'],
|
||||||
'id' => $GLOBALS['phpgw_info']['apps'][$app[0]]['id']
|
'id' => $GLOBALS['phpgw_info']['apps'][$app]['id']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reset($this->data);
|
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,11 +140,10 @@
|
|||||||
*/
|
*/
|
||||||
function read()
|
function read()
|
||||||
{
|
{
|
||||||
if (count($this->data) == 0)
|
if (!count($this->data))
|
||||||
{
|
{
|
||||||
$this->read_repository();
|
$this->read_repository();
|
||||||
}
|
}
|
||||||
reset($this->data);
|
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -157,14 +156,14 @@
|
|||||||
{
|
{
|
||||||
if(is_array($apps))
|
if(is_array($apps))
|
||||||
{
|
{
|
||||||
while($app = each($apps))
|
foreach($apps as $app)
|
||||||
{
|
{
|
||||||
$this->data[$app[1]] = array(
|
$this->data[$app] = array(
|
||||||
'title' => $GLOBALS['phpgw_info']['apps'][$app[1]]['title'],
|
'title' => $GLOBALS['phpgw_info']['apps'][$app]['title'],
|
||||||
'name' => $app[1],
|
'name' => $app,
|
||||||
'enabled' => True,
|
'enabled' => True,
|
||||||
'status' => $GLOBALS['phpgw_info']['apps'][$app[1]]['status'],
|
'status' => $GLOBALS['phpgw_info']['apps'][$app]['status'],
|
||||||
'id' => $GLOBALS['phpgw_info']['apps'][$app[1]]['id']
|
'id' => $GLOBALS['phpgw_info']['apps'][$app]['id']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,10 +174,9 @@
|
|||||||
'name' => $apps,
|
'name' => $apps,
|
||||||
'enabled' => True,
|
'enabled' => True,
|
||||||
'status' => $GLOBALS['phpgw_info']['apps'][$apps]['status'],
|
'status' => $GLOBALS['phpgw_info']['apps'][$apps]['status'],
|
||||||
'id' => $GLOBALS['phpgw_info']['apps'][$app[1]]['id']
|
'id' => $GLOBALS['phpgw_info']['apps'][$apps]['id']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
reset($this->data);
|
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -193,7 +191,6 @@
|
|||||||
{
|
{
|
||||||
unset($this->data[$appname]);
|
unset($this->data[$appname]);
|
||||||
}
|
}
|
||||||
reset($this->data);
|
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -204,10 +201,7 @@
|
|||||||
*/
|
*/
|
||||||
function update_data($data)
|
function update_data($data)
|
||||||
{
|
{
|
||||||
reset($data);
|
|
||||||
$this->data = Array();
|
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
reset($this->data);
|
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -218,16 +212,14 @@
|
|||||||
function save_repository()
|
function save_repository()
|
||||||
{
|
{
|
||||||
$num_rows = $GLOBALS['phpgw']->acl->delete_repository("%%", 'run', $this->account_id);
|
$num_rows = $GLOBALS['phpgw']->acl->delete_repository("%%", 'run', $this->account_id);
|
||||||
reset($this->data);
|
foreach($this->data as $app => $data)
|
||||||
while($app = each($this->data))
|
|
||||||
{
|
{
|
||||||
if(!$this->is_system_enabled($app[0]))
|
if(!$this->is_system_enabled($app))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->acl->add_repository($app[0],'run',$this->account_id,1);
|
$GLOBALS['phpgw']->acl->add_repository($app,'run',$this->account_id,1);
|
||||||
}
|
}
|
||||||
reset($this->data);
|
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,16 +229,15 @@
|
|||||||
|
|
||||||
function app_perms()
|
function app_perms()
|
||||||
{
|
{
|
||||||
if (count($this->data) == 0)
|
if (!count($this->data))
|
||||||
{
|
{
|
||||||
$this->read_repository();
|
$this->read_repository();
|
||||||
}
|
}
|
||||||
@reset($this->data);
|
foreach ($this->data as $app => $data)
|
||||||
while (list ($key) = each ($this->data))
|
|
||||||
{
|
{
|
||||||
$app[] = $this->data[$key]['name'];
|
$apps[] = $this->data[$app]['name'];
|
||||||
}
|
}
|
||||||
return $app;
|
return $apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_account_specific()
|
function read_account_specific()
|
||||||
@ -255,27 +246,22 @@
|
|||||||
{
|
{
|
||||||
$this->read_installed_apps();
|
$this->read_installed_apps();
|
||||||
}
|
}
|
||||||
$app_list = $GLOBALS['phpgw']->acl->get_app_list_for_id('run',1,$this->account_id);
|
if ($app_list = $GLOBALS['phpgw']->acl->get_app_list_for_id('run',1,$this->account_id))
|
||||||
if(!$app_list)
|
|
||||||
{
|
{
|
||||||
reset($this->data);
|
foreach($app_list as $app)
|
||||||
return $this->data;
|
|
||||||
}
|
|
||||||
@reset($app_list);
|
|
||||||
while ($app = each($app_list))
|
|
||||||
{
|
{
|
||||||
if ($this->is_system_enabled($app[1]))
|
if ($this->is_system_enabled($app))
|
||||||
{
|
{
|
||||||
$this->data[$app[1]] = array(
|
$this->data[$app] = array(
|
||||||
'title' => $GLOBALS['phpgw_info']['apps'][$app[1]]['title'],
|
'title' => $GLOBALS['phpgw_info']['apps'][$app]['title'],
|
||||||
'name' => $app[1],
|
'name' => $app,
|
||||||
'enabled' => True,
|
'enabled' => True,
|
||||||
'status' => $GLOBALS['phpgw_info']['apps'][$app[1]]['status'],
|
'status' => $GLOBALS['phpgw_info']['apps'][$app]['status'],
|
||||||
'id' => $GLOBALS['phpgw_info']['apps'][$app[1]]['id']
|
'id' => $GLOBALS['phpgw_info']['apps'][$app]['id']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reset($this->data);
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,16 +322,13 @@
|
|||||||
|
|
||||||
function id2name($id)
|
function id2name($id)
|
||||||
{
|
{
|
||||||
@reset($GLOBALS['phpgw_info']['apps']);
|
foreach($GLOBALS['phpgw_info']['apps'] as $appname => $app)
|
||||||
while (list($appname,$app) = each($GLOBALS['phpgw_info']['apps']))
|
|
||||||
{
|
{
|
||||||
if(intval($app['id']) == intval($id))
|
if(intval($app['id']) == intval($id))
|
||||||
{
|
{
|
||||||
@reset($GLOBALS['phpgw_info']['apps']);
|
|
||||||
return $appname;
|
return $appname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@reset($GLOBALS['phpgw_info']['apps']);
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,10 +338,7 @@
|
|||||||
{
|
{
|
||||||
return $GLOBALS['phpgw_info']['apps'][$appname]['id'];
|
return $GLOBALS['phpgw_info']['apps'][$appname]['id'];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user