removed unnecessary instancations and using static methods of html and egw_link class

This commit is contained in:
Ralf Becker 2008-03-25 16:42:23 +00:00
parent afe2795f2d
commit 5fd2d8def8
9 changed files with 7 additions and 69 deletions

View File

@ -177,9 +177,6 @@
$GLOBALS['egw_info']['flags']['include_xajax'] = True;
// JavaScript
if(!is_object($GLOBALS['egw']->js)) {
$GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
}
$options = $GLOBALS['egw']->js->convert_phparray_jsarray("options['$name']", $options, true);
$GLOBALS['egw']->js->set_onload("if(!options) {
var options = new Object();

View File

@ -452,12 +452,7 @@ class bo_tracking
*/
function get_title($data,$old)
{
if (!is_object($GLOBALS['egw']->link))
{
require_once(EGW_API_INC.'/class.bolink.inc.php');
$GLOBALS['egw']->link =& new bolink();
}
return $GLOBALS['egw']->link->title($this->app,$data[$this->id_field]);
return egw_link::title($this->app,$data[$this->id_field]);
}
/**
@ -471,12 +466,7 @@ class bo_tracking
*/
function get_subject($data,$old)
{
if (!is_object($GLOBALS['egw']->link))
{
require_once(EGW_API_INC.'/class.bolink.inc.php');
$GLOBALS['egw']->link =& new bolink();
}
return $GLOBALS['egw']->link->title($this->app,$data[$this->id_field]);
return egw_link::title($this->app,$data[$this->id_field]);
}
/**
@ -514,15 +504,10 @@ class bo_tracking
}
else
{
if (!is_object($GLOBALS['egw']->link))
{
require_once(EGW_API_INC.'/class.bolink.inc.php');
$GLOBALS['egw']->link =& new bolink();
}
if (($view = $GLOBALS['egw']->link->view($this->app,$data[$this->id_field])))
if (($view = egw_link::view($this->app,$data[$this->id_field])))
{
$link = $GLOBALS['egw']->link('/index.php',$view);
$popup = $GLOBALS['egw']->link->is_popup($this->app,'view');
$popup = egw_link::is_popup($this->app,'view');
}
}
if ($link{0} == '/')
@ -553,10 +538,10 @@ class bo_tracking
{
$GLOBALS['egw']->link = new bolink();
}
if($view = $GLOBALS['egw']->link->view($this->app,$data[$this->id_field])) {
if($view = egw_link::view($this->app,$data[$this->id_field])) {
return array( 'text' => $this->get_title($data,$old),
'view' => $view,
'popup' => $GLOBALS['egw']->link->is_popup($this->app,'view'),
'popup' => egw_link::is_popup($this->app,'view'),
);
}
return false;

View File

@ -57,10 +57,7 @@ class contact_widget
function contact_widget($ui)
{
$this->ui = $ui;
if (!is_object($GLOBALS['egw']->contacts))
{
$GLOBALS['egw']->contacts =& CreateObject('phpgwapi.contacts');
}
$this->contacts =& $GLOBALS['egw']->contacts;
}

View File

@ -64,10 +64,6 @@
{
if ($ui == 'html')
{
if (!is_object($GLOBALS['egw']->jscalendar))
{
$GLOBALS['egw']->jscalendar =& CreateObject('phpgwapi.jscalendar');
}
$this->jscal =& $GLOBALS['egw']->jscalendar;
}
$this->timeformat = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'];

View File

@ -68,10 +68,6 @@ class historylog_widget
}
else // compatibilty code for 1.2, can be removed after
{
if (!is_object($GLOBALS['egw']->datetime))
{
$GLOBALS['egw']->datetime =& CreateObject('phpgwapi.datetime');
}
$value = $historylog->return_array('','','history_id','DESC',$id);
foreach($value as $key => $val)
{

View File

@ -972,10 +972,6 @@
case 'select-cat':
if ($val)
{
if (!is_object($GLOBALS['egw']->categories))
{
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
}
$value[$key] = $GLOBALS['egw']->categories->id2name($val);
}
break;

View File

@ -137,10 +137,6 @@
break;
case 'select-country': // #Row|Extralabel,1=use country name, 0=use 2 letter-code
if (!is_object($GLOBALS['egw']->country))
{
$GLOBALS['egw']->country =& CreateObject('phpgwapi.country');
}
$cell['sel_options'] = $GLOBALS['egw']->country->countries();
if (($extension_data['country_use_name'] = $type) && $value)
@ -155,19 +151,11 @@
break;
case 'select-state':
if (!is_object($GLOBALS['egw']->country))
{
$GLOBALS['egw']->country =& CreateObject('phpgwapi.country');
}
$cell['sel_options'] = $GLOBALS['egw']->country->us_states();
$cell['no_lang'] = True;
break;
case 'select-cat': // !$type == globals cats too, $type2: extraStyleMultiselect, $type3: application, if not current-app
if (!is_object($GLOBALS['egw']->categories))
{
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
}
if ($readonly) // for readonly we dont need to fetch all cat's, nor do we need to indent them by level
{
$cell['no_lang'] = True;
@ -242,11 +230,6 @@
}
if ($this->ui == 'html' && $type != 'groups') // use eGW's new account-selection (html only)
{
if (!is_object($GLOBALS['egw']->uiaccountsel))
{
require_once(EGW_API_INC.'/class.uiaccountsel.inc.php');
$GLOBALS['egw']->uiaccountsel =& new uiaccountsel;
}
$not = array_slice(explode(',',$cell['size']),4);
$help = (int)$cell['no_lang'] < 2 ? lang($cell['help']) : $cell['help'];
$onFocus = "self.status='".addslashes(htmlspecialchars($help))."'; return true;";
@ -556,10 +539,6 @@
case 'select-country':
if ($extension_data['country_use_name'] && $value_in)
{
if (!is_object($GLOBALS['egw']->country))
{
$GLOBALS['egw']->country =& CreateObject('phpgwapi.country');
}
if (($value = $GLOBALS['egw']->country->get_full_name($value_in)))
{
break;

View File

@ -168,10 +168,6 @@ class so_sql
echo "<p>so_sql('$app','$table')</p>\n";
_debug_array($this);
}
if (!is_object($GLOBALS['egw']->datetime))
{
$GLOBALS['egw']->datetime =& CreateObject('phpgwapi.datetime');
}
$this->tz_offset_s = $GLOBALS['egw']->datetime->tz_offset;
$this->now = time() + $this->tz_offset_s; // time() is server-time and we need a user-time
}

View File

@ -66,10 +66,6 @@ class tree_widget
switch ($cell['type'])
{
case 'tree-cat': // !$type == globals cats too, $type2: not used, $type3: application, if not current-app
if (!is_object($GLOBALS['egw']->categories))
{
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
}
if ($readonly) // for readonly we dont need to fetch all cat's, nor do we need to indent them by level
{
$cell['no_lang'] = True;