[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/ -> class.bolink.inc.php (sommaire)

(pas de description)

Poids: 1152 lignes (37 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 1 fichier
 phpgwapi/inc/class.solink.inc.php

Définit 1 class

bolink:: (33 méthodes):
  bolink()
  link()
  temp_link_id()
  get_links()
  get_link()
  unlink()
  unlink2()
  app_list()
  query()
  title()
  add()
  view()
  is_popup()
  get_file()
  vfs_path()
  attach_file()
  delete_attached()
  info_attached()
  fileinfo2link()
  list_attached()
  is_win_path()
  read_attached()
  attached_local()
  decode_htmlspecialchars()
  calendar_title()
  calendar_query()
  addressbook_title()
  addressbook_query()
  projects_title()
  projects_query()
  notify_update()
  notify()
  notify_unlink()


Classe: bolink  - X-Ref

generalized linking between entries of eGroupware apps - BO layer

Links have two ends each pointing to an entry, each entry is a double:
- app   app-name or directory-name of an egw application, eg. 'infolog'
- id    this is the id, eg. an integer or a tupple like '0:INBOX:1234'

The BO-layer implementes 2 extra features on top of the so-layer:
1) It handles links to not already existing entries. This is used by the eTemplate link-widget, which allows to
setup links even for new / not already existing entries, before they get saved.
In that case you have to set the first id to 0 for the link-function and pass the array returned in that id
(not the return-value) after saveing your new entry again to the link function.
2) Attaching files: they are saved in the vfs and not the link-table (!).
Attached files are stored under $vfs_basedir='/infolog' in the vfs!

bolink( )   X-Ref
constructor


link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0,$no_notify=0 )   X-Ref
creats a link between $app1,$id1 and $app2,$id2 - $id1 does NOT need to exist yet

Does NOT check if link already exists.
File-attachments return a negative link-id !!!

param: string $app1 app of $id1
param: string/array &$id1 id of item to linkto or 0 if item not yet created or array with links
param: string/array $app2 app of 2.linkend or array with links ($id2 not used)
param: string $id2='' id of 2. item of $file-array if $app2 == $this->vfs_appname (see below)<br>
param: string $remark='' Remark to be saved with the link (defaults to '')
param: int $owner=0 Owner of the link (defaults to user)
param: int $lastmod=0 timestamp of last modification (defaults to now=time())
param: int $no_notify=0 &1 dont notify $app1, &2 dont notify $app2
return: int/boolean False (for db or param-error) or on success link_id (Please not the return-value of $id1)

temp_link_id($app,$id)   X-Ref
generate temporary link_id used as array-key

param: string $app app-name
param: mixed $id
return: string

get_links( $app,$id,$only_app='',$order='link_lastmod DESC' )   X-Ref
returns array of links to $app,$id (reimplemented to deal with not yet created items)

param: string $app appname
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
return: array of links or empty array if no matching links found

get_link($app_link_id,$id='',$app2='',$id2='')   X-Ref
Read one link specified by it's link_id or by the two end-points

If $id is an array (links not yet created) only link_ids are allowed.

param: int/string $app_link_id > 0 link_id of link or app-name of link
param: string/array $id='' id if $app_link_id is an appname or array with links, if 1. entry not yet created
param: string $app2='' second app
param: string $id2='' id in $app2
return: array with link-data or False

unlink($link_id,$app='',$id='',$owner='',$app2='',$id2='')   X-Ref
Remove link with $link_id or all links matching given $app,$id

Note: if $link_id != '' and $id is an array: unlink removes links from that array only
unlink has to be called with &$id to see the result (depricated) or unlink2 has to be used !!!

param: $link_id link-id to remove if > 0
param: string $app='' appname of first endpoint
param: string/array $id='' id in $app or array with links, if 1. entry not yet created
param: string $app2='' app of second endpoint
param: string $id2='' id in $app2
return: the number of links deleted

unlink2($link_id,$app,&$id,$owner='',$app2='',$id2='')   X-Ref
Remove link with $link_id or all links matching given $app,$id

param: $link_id link-id to remove if > 0
param: string $app='' appname of first endpoint
param: string/array &$id='' id in $app or array with links, if 1. entry not yet created
param: string $app2='' app of second endpoint
param: string $id2='' id in $app2
return: the number of links deleted

app_list($must_support='')   X-Ref
get list/array of link-aware apps the user has rights to use

param: string $must_support capability the apps need to support, eg. 'add', default ''=list all apps
return: array with app => title pairs

query($app,$pattern)   X-Ref
Searches for a $pattern in the entries of $app

param: string $app app to search
param: string $pattern pattern to search
return: array with $id => $title pairs of matching entries of app

title($app,$id,$link=null)   X-Ref
returns the title (short description) of entry $id and $app

param: string $app appname
param: string $id id in $app
param: array $link=null link-data for file-attachments
return: string/boolean string with title, null if $id does not exist in $app or false if no perms to view it

add($app,$to_app='',$to_id='')   X-Ref
Add new entry to $app, evtl. already linked to $to_app, $to_id

param: string $app appname of entry to create
param: string $to_app appname to link the new entry to
param: string $to_id id in $to_app
return: array/boolean with name-value pairs for link to add-methode of $app or false if add not supported

view($app,$id,$link=null)   X-Ref
view entry $id of $app

param: string $app appname
param: string $id id in $app
param: array $link=null link-data for file-attachments
return: array with name-value pairs for link to view-methode of $app to view $id

is_popup($app,$action='view')   X-Ref
Check if $app uses a popup for $action

param: string $app app-name
param: string $action='view' name of the action, atm. 'view' or 'add'
return: boolean/string false if no popup is used or $app is not registered, otherwise string with the prefered popup size (eg. '640x400)

get_file($link='')   X-Ref
Pas de description

vfs_path($app,$id='',$file='',$relatives=False)   X-Ref
path to the attached files of $app/$ip or the directory for $app if no $id,$file given

All link-files are based in the vfs-subdir '/infolog'. For other apps
separate subdirs with name app are created.

param: string $app appname
param: string $id='' id in $app
param: string $file='' filename
param: boolean/array $relatives=False return path as array with path in string incl. relatives
return: string/array path or array with path and relatives, depending on $relatives

attach_file($app,$id,$file,$comment='')   X-Ref
Put a file to the corrosponding place in the VFS and set the attributes

param: string $app appname to linke the file to
param: string $id id in $app
param: array $file informations about the file in format of the etemplate file-type
param: string $comment='' comment to add to the link
return: int negative id of phpgw_vfs table as negative link-id's are for vfs attachments

delete_attached($app,$id='',$fname = '')   X-Ref
deletes an attached file

param: int/string $app > 0: file_id of an attchemnt or $app/$id entry which linked to
param: string $id='' id in app
param: string $fname filename

info_attached($app,$id,$filename)   X-Ref
converts the infos vfs has about a file into a link

param: string $app appname
param: string $id id in app
param: string $filename filename
return: array 'kind' of link-array

fileinfo2link($fileinfo)   X-Ref
converts a fileinfo (row in the vfs-db-table) in a link

param: array/int $fileinfo a row from the vfs-db-table (eg. returned by the vfs ls function) or a file_id of that table
return: array a 'kind' of link-array

list_attached($app,$id)   X-Ref
lists all attachments to $app/$id

param: string $app appname
param: string $id id in app
return: array with link_id => 'kind' of link-array pairs

is_win_path($path)   X-Ref
checks if path starts with a '\\' or has a ':' in it

param: string $path path to check
return: boolean true if windows path, false otherwise

read_attached($app,$id,$filename)   X-Ref
reads the attached file and returns the content

param: string $app appname
param: string $id id in app
param: string $filename filename
return: string/boolean content of the attached file, null if $id not found, false if no view perms

attached_local($app,$id,$filename,$ip,$win_user)   X-Ref
Checks if filename should be local availible and if so returns

param: string $app appname
param: string $id id in app
param: string $filename filename
param: string $id ip-address of user
param: boolean $win_user true if user is on windows, otherwise false
return: string 'file:/path' for HTTP-redirect else return False

decode_htmlspecialchars($str)   X-Ref
reverse function of htmlspecialchars()

param: string $str string to decode
return: string decoded string

calendar_title( $event )   X-Ref
get title for an event, should be moved to bocalendar.link_title

param: int/array $event event-id or already read event
return: string/boolean the title (startdate plus subject), of false if event is not found

calendar_query($pattern)   X-Ref
query calendar for an event $matching pattern, should be moved to bocalendar.link_query

param: string $pattern pattern to search
return: array with id => title pairs of matching events

addressbook_title( $addr )   X-Ref
get title for an address, should be moved to boaddressbook.link_title

param: int/array $event address-id or already read address
return: string/boolean the title ([org:] n_familiy[, n_given|n_prefix]), of false if address is not found

addressbook_query( $pattern )   X-Ref
query addressbook for $pattern, should be moved to boaddressbook.link_query

param: string $pattern pattern to search
return: array with id => title pairs of matching addresses

projects_title( $proj )   X-Ref
get title for a project, should be moved to boprojects.link_title

param: int/array $event project-id or already read project
return: string/boolean the title (number: title), null if project is not found or false if no perms to view it

projects_query( $pattern )   X-Ref
query for projects matching $pattern, should be moved to boprojects.link_query

param: string $pattern pattern to search
return: array with id => title pairs of matching projects

notify_update($app,$id,$data=null)   X-Ref
notify other apps about changed content in $app,$id

param: string $app name of app in which the updated happend
param: string $id id in $app of the updated entry
param: array $data=null updated data of changed entry, as the read-method of the BO-layer would supply it

notify($type,$notify_app,$notify_id,$target_app,$target_id,$link_id,$data=null)   X-Ref
notify an application about a new or deleted links to own entries or updates in the content of the linked entry

Please note: not all apps supply update notifications

param: string $type 'link' for new links, 'unlink' for unlinked entries, 'update' of content in linked entries
param: string $notify_app app to notify
param: string $notify_id id in $notify_app
param: string $target_app name of app whos entry changed, linked or deleted
param: string $target_id id in $target_app
param: array $data=null data of entry in app2 (optional)

notify_unlink(&$links)   X-Ref
notifies about unlinked links

param: array &$links unlinked links from the database



Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7