* InfoLog: fixed not working link-search (Parameter 2 to infolog_bo::link_query() expected to be a reference)

by merging r28803, r28855 and r31233 from Trunk
This commit is contained in:
Ralf Becker 2011-05-06 11:59:26 +00:00
parent e57eb8d891
commit 557c943914

View File

@ -45,6 +45,7 @@
* ),
* 'view_id' => 'app_id', // name of get parameter of the id
* 'view_popup' => '400x300', // size of popup (XxY), if view is in popup
* 'view_list' => 'app.class.method' // Method to be called to display a list of links, method should check $_GET['search'] to filter
* 'add' => array( // get parameter to add an empty entry to app
* 'menuaction' => 'app.class.method',
* ),
@ -565,15 +566,54 @@ class egw_link extends solink
echo "<p>egw_link::query('$app','$pattern') => '$method'</p>\n";
echo "Options: "; _debug_array($options);
}
$result = ExecMethod2($method,$pattern,$options);
// See etemplate's nextmatch widget, following was copied from there
// allow static callbacks
if(strpos($method,'::') !== false)
{
// workaround for php < 5.3: do NOT call it static, but allow application code to specify static callbacks
if (version_compare(PHP_VERSION,'5.3','<')) list($class,$method) = explode('::',$method);
}
else
{
list($app,$class,$method) = explode('.',$method);
}
if ($class)
{
if (!$app && !is_object($GLOBALS[$class]))
{
$GLOBALS[$class] = new $class();
}
if (is_object($GLOBALS[$class])) // use existing instance (put there by a previous CreateObject)
{
$obj = $GLOBALS[$class];
}
else
{
$obj = CreateObject($app.'.'.$class);
}
}
if(is_callable($method)) // php5.3+ call
{
$result = $method($pattern,$options);
}
elseif(is_object($obj) && method_exists($obj,$method))
{
$result = $obj->$method($pattern,$options);
}
else
{
// Fall back to original method
$result = ExecMethod2($method,$pattern,$options);
}
if (!isset($options['total']))
{
$options['total'] = count($result);
}
if (is_array($result) && (isset($options['start']) || count($result) > $options['num_rows']))
if (is_array($result) && (isset($options['start']) || (isset($options['num_rows']) && count($result) > $options['num_rows'])))
{
$result = array_slice($result, $options['start'], $options['num_rows'], true);
$result = array_slice($result, $options['start'], (isset($options['num_rows']) ? $options['num_rows'] : count($result)), true);
}
return $result;