mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 19:03:14 +01:00
Preseed link title-cache for link-list and link-string widget
This commit is contained in:
parent
51ffc2fc97
commit
c356464a16
@ -195,7 +195,7 @@ class link_widget
|
||||
}
|
||||
if ($value['to_id'] && $value['to_app'])
|
||||
{
|
||||
$value = egw_link::get_links($value['to_app'],$value['to_id'],$only_app = $value['only_app']);
|
||||
$value = egw_link::get_links($value['to_app'],$value['to_id'],$only_app = $value['only_app'],'link_lastmod DESC',true);
|
||||
if ($only_app)
|
||||
{
|
||||
foreach($value as $key => $id)
|
||||
@ -287,7 +287,7 @@ class link_widget
|
||||
{
|
||||
$value['title'] = egw_link::title($app,$id);
|
||||
}
|
||||
$links = egw_link::get_links($app,$id);
|
||||
$links = egw_link::get_links($app,$id,'','link_lastmod DESC',true);
|
||||
$value['anz_links'] = count($links);
|
||||
$extension_data = $value;
|
||||
|
||||
|
@ -55,6 +55,11 @@
|
||||
* 'file_access' => 'app.class.method', // method to be called to check file access rights, see links_stream_wrapper class
|
||||
* // boolean file_access(string $id,int $check,string $rel_path)
|
||||
* 'find_extra' => array('name_preg' => '/^(?!.picture.jpg)$/') // extra options to egw_vfs::find, to eg. remove some files from the list of attachments
|
||||
* 'edit' => array(
|
||||
* 'menuaction' => 'app.class.method',
|
||||
* ),
|
||||
* 'edit_id' => 'app_id',
|
||||
* 'edit_popup' => '400x300',
|
||||
* }
|
||||
* All entries are optional, thought you only get conected functionality, if you implement them ...
|
||||
*
|
||||
@ -282,9 +287,10 @@ class egw_link extends solink
|
||||
* @param string/array $id id of entry in $app or array of links if entry not yet created
|
||||
* @param string $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!'
|
||||
* @param string $order='link_lastmod DESC' defaults to newest links first
|
||||
* @param boolean $cache_titles=false should all titles be queryed and cached (allows to query each link app only once!)
|
||||
* @return array of links or empty array if no matching links found
|
||||
*/
|
||||
static function get_links( $app,$id,$only_app='',$order='link_lastmod DESC' )
|
||||
static function get_links( $app,$id,$only_app='',$order='link_lastmod DESC',$cache_titles=false )
|
||||
{
|
||||
if (self::DEBUG) echo "<p>egw_link::get_links(app='$app',id='$id',only_app='$only_app',order='$order')</p>\n";
|
||||
|
||||
@ -318,7 +324,21 @@ class egw_link extends solink
|
||||
}
|
||||
}
|
||||
//echo "ids=<pre>"; print_r($ids); echo "</pre>\n";
|
||||
if ($cache_titles)
|
||||
{
|
||||
// agregate links by app
|
||||
$app_ids = array();
|
||||
foreach($ids as $link)
|
||||
{
|
||||
$app_ids[$link['app']][] = $link['id'];
|
||||
}
|
||||
reset($ids);
|
||||
|
||||
foreach($app_ids as $appname => $a_ids)
|
||||
{
|
||||
self::titles($appname,array_unique($a_ids));
|
||||
}
|
||||
}
|
||||
return $ids;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user