mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-18 22:13:30 +01:00
73 lines
2.4 KiB
PHP
73 lines
2.4 KiB
PHP
|
<?php
|
||
|
/**************************************************************************\
|
||
|
* phpGroupWare - eTemplate Extension - InfoLog LinkList Widget *
|
||
|
* http://www.phpgroupware.org *
|
||
|
* Written by Ralf Becker <RalfBecker@outdoor-training.de> *
|
||
|
* -------------------------------------------- *
|
||
|
* This program is free software; you can redistribute it and/or modify it *
|
||
|
* under the terms of the GNU General Public License as published by the *
|
||
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
||
|
* option) any later version. *
|
||
|
\**************************************************************************/
|
||
|
|
||
|
/* $Id$ */
|
||
|
|
||
|
/*!
|
||
|
@class linklist_widget
|
||
|
@author ralfbecker
|
||
|
@abstract widget that shows the links to an entry and a Unlink Button for each entry
|
||
|
@discussion This widget is independent of the UI as it only uses etemplate-widgets and has therefor no render-function
|
||
|
*/
|
||
|
class linklist_widget
|
||
|
{
|
||
|
var $public_functions = array(
|
||
|
'pre_process' => True,
|
||
|
'post_process' => True
|
||
|
);
|
||
|
var $human_name = 'LinkList'; // this is the name for the editor
|
||
|
|
||
|
function linklist_widget($ui)
|
||
|
{
|
||
|
$this->link = CreateObject('infolog.bolink');
|
||
|
}
|
||
|
|
||
|
function pre_process(&$cell,&$value,&$extension_data,&$readonlys)
|
||
|
{
|
||
|
$app = $value['app'] = 'addressbook';
|
||
|
$id = $value['id'] = 921;
|
||
|
//echo "<p>linklist_widget.preprocess: app='$app', id='$id', value="; _debug_array($value);
|
||
|
|
||
|
if (!$value['title'])
|
||
|
{
|
||
|
$value['title'] = $this->link->title($app,$id);
|
||
|
}
|
||
|
$extension_data = $value;
|
||
|
|
||
|
$links = $this->link->get_links($app,$id);
|
||
|
|
||
|
for($row=1; list(,$link) = each($links); ++$row)
|
||
|
{
|
||
|
$value[$row] = $link;
|
||
|
$value[$row]['title'] = $this->link->title($link['app'],$link['id']);
|
||
|
}
|
||
|
$cell['size'] = $cell['name'];
|
||
|
$cell['type'] = 'template';
|
||
|
$cell['name'] = 'infolog.linklist_widget';
|
||
|
|
||
|
return True; // extra Label is ok
|
||
|
}
|
||
|
|
||
|
function post_process(&$cell,&$value,&$extension_data,&$loop)
|
||
|
{
|
||
|
list($unlink) = @each($value['unlink']);
|
||
|
$pre_value = $extension_data;
|
||
|
//echo "<p>linklist_widget.postprocess: app='$pre_value[app]', id='$pre_value[id]', unlink='$unlink', value="; _debug_array($value);
|
||
|
|
||
|
if ($unlink)
|
||
|
{
|
||
|
$this->link->unlink($unlink,$pre_value['app'],$pre_value['id']);
|
||
|
$loop = True;
|
||
|
$value = $pre_value;
|
||
|
}
|
||
|
}
|
||
|
}
|