[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/calendar/inc/ -> class.bocal.inc.php (sommaire)

(pas de description)

Poids: 1761 lignes (61 kb)
Inclus ou requis: 2 fois
Référencé: 0 fois
Nécessite: 1 fichier
 calendar/inc/class.socal.inc.php

Définit 1 class

bocal:: (34 méthodes):
  bocal()
  enum_groups()
  search()
  clear_private_infos()
  check_move_horizont()
  set_recurrences()
  db2data()
  date2usertime()
  read()
  insert_all_repetitions()
  add_adjusted_event()
  resource_info()
  check_perms()
  accounts_members()
  date2ts()
  date2array()
  date2string()
  format_date()
  debug_message()
  long_date()
  timespan()
  participant_name()
  participants()
  categories()
  _list_cals_add()
  list_cals()
  recure2string()
  read_holidays()
  link_title()
  link_query()
  search_link()
  check_set_default_prefs()
  freebusy_url()
  array_intersect_key()


Classe: bocal  - X-Ref

Class to access all calendar data

For updating calendar data look at the bocalupdate class, which extends this class.

The new UI, BO and SO classes have a strikt definition, in which time-zone they operate:
UI only operates in user-time, so there have to be no conversation at all !!!
BO's functions take and return user-time only (!), they convert internaly everything to servertime, because
SO operates only in server-time

As this BO class deals with dates/times of several types and timezone, each variable should have a postfix
appended, telling with type it is: _s = seconds, _su = secs in user-time, _ss = secs in server-time, _h = hours

All new BO code (should be true for eGW in general) NEVER use any $_REQUEST ($_POST or $_GET) vars itself.
Nor does it store the state of any UI-elements (eg. cat-id selectbox). All this is the task of the UI class(es) !!!

All permanent debug messages of the calendar-code should done via the debug-message method of this class !!!

bocal()   X-Ref
Constructor


enum_groups(&$event)   X-Ref
Add group-members as participants with status 'G'

param: array $event event-array
return: int number of added participants

search($params)   X-Ref
Searches / lists calendar entries, including repeating ones

param: params array with the following keys
return: array of events or array with YYYYMMDD strings / array of events pairs (depending on $daywise param)

clear_private_infos(&$event,$allowed_participants = array()   X-Ref
Clears all non-private info from a privat event

That function only returns the infos allowed to be viewed by people without EGW_ACL_PRIVATE grants

param: array &$event
param: array $allowed_participants ids of the allowed participants, eg. the ones the search is over or eg. the owner of the calendar

check_move_horizont($new_horizont)   X-Ref
check and evtl. move the horizont (maximum date for unlimited recuring events) to a new date

param: mixed $new_horizont time to set the horizont to (user-time)

set_recurrences($event,$start=0)   X-Ref
set all recurances for an event til the defined horizont $this->config['horizont']

param: array $event
param: mixed $start=0 minimum start-time for new recurances or !$start = since the start of the event

db2data(&$events,$date_format='ts')   X-Ref
convert data read from the db, eg. convert server to user-time

param: array &$events array of event-arrays (reference)
param: $date_format='ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format

date2usertime($ts,$date_format='ts')   X-Ref
convert a date from server to user-time

param: int $date timestamp in server-time
param: $date_format='ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format

read($ids,$date=null,$ignore_acl=False,$date_format='ts')   X-Ref
Reads a calendar-entry

param: int/array/string $ids id or array of id's of the entries to read, or string with a single uid
param: mixed $date=null date to specify a single event of a series
param: boolean $ignore_acl should we ignore the acl, default False for a single id, true for multiple id's
param: string $date_format='ts' date-formats: 'ts'=timestamp, 'server'=timestamp in servertime, 'array'=array, or string with date-format
return: boolean/array event or array of id => event pairs, false if the acl-check went wrong, null if $ids not found

insert_all_repetitions($event,$start,$end,&$events,$recur_exceptions)   X-Ref
Inserts all repetions of $event in the timespan between $start and $end into $events

As events can have recur-exceptions, only those event-date not having one, should get inserted.
The caller supplies an array with the already inserted exceptions.

The new entries are just appended to $entries, so $events is no longer sorted by startdate !!!
Unlike the old code the start- and end-date of the events should be adapted here !!!

TODO: This code is mainly copied from bocalendar and need to be rewritten for the changed algorithm:
We insert now all repetions of one event in one go. It should be possible to calculate the time-difference
of the used recur-type and add all events in one simple for-loop. Daylightsaving changes need to be taken into Account.

param: $event array repeating event whos repetions should be inserted
param: $start mixed start-date
param: $end mixed end-date
param: $events array where the repetions get inserted
param: $recur_exceptions array with date (in Ymd) as key (and True as values)

add_adjusted_event(&$events,$event,$date_ymd)   X-Ref
Adds one repetion of $event for $date_ymd to the $events array, after adjusting its start- and end-time

param: $events array in which the event gets inserted
param: $event array event to insert, it has start- and end-date of the first recurrence, not of $date_ymd
param: $date_ymd int/string of the date of the event

resource_info($uid)   X-Ref
Fetch information about a resource

We do some caching here, as the resource itself might not do it.

param: string $uid string with one-letter resource-type and numerical resource-id, eg. "r19"
return: array/boolean array with keys res_id,cat_id,name,useable (name definied by max_quantity in $this->resources),rights,responsible or false if $uid is not found

check_perms($needed,$event=0,$other=0,$date_format='ts')   X-Ref
Checks if the current user has the necessary ACL rights

The check is performed on an event or generally on the cal of an other user

Note: Participating in an event is considered as haveing read-access on that event,
even if you have no general read-grant from that user.

param: int $needed necessary ACL right: EGW_ACL_{READ|EDIT|DELETE}
param: mixed $event event as array or the event-id or 0 for a general check
param: int $other uid to check (if event==0) or 0 to check against $this->user
param: string $date_format='ts' date-formats: 'ts'=timestamp, 'array'=array, 'string'=iso8601 string for xmlrpc
return: boolean true permission granted, false for permission denied or null if event not found

accounts_members($account_id,$just_id=false)   X-Ref
From the accounts class in trunk: Get all members of the group $account_id

param: int/string $accountid='' numeric account-id or alphanum. account-lid,
param: boolean $just_id=false return just an array of id's and not id => lid pairs, default false
return: array with account_id ($just_id) or account_id => account_lid pairs (!$just_id)

date2ts($date,$user2server=False)   X-Ref
Converts several date-types to a timestamp and optionaly converts user- to server-time

param: $date mixed date to convert, should be one of the following types
param: $user2server_time boolean conversation between user- and server-time default False == Off

date2array($date,$server2user=False)   X-Ref
Converts a date to an array and optionaly converts server- to user-time

param: $date mixed date to convert
param: $server2user_time boolean conversation between user- and server-time default False == Off
return: array with keys 'second', 'minute', 'hour', 'day', 'month', 'year', 'raw' (timestamp) and 'full' (Ymd-string)

date2string($date,$server2user=False,$format='Ymd')   X-Ref
Converts a date as timestamp or array to a date-string and optionaly converts server- to user-time

param: mixed $date integer timestamp or array with ('year','month',..,'second') to convert
param: boolean $server2user_time conversation between user- and server-time default False == Off, not used if $format ends with \Z
param: string $format='Ymd' format of the date to return, eg. 'Y-m-d\TH:i:sO' (2005-11-01T15:30:00+0100)
return: string date formatted according to $format

format_date($date,$format='')   X-Ref
Formats a date given as timestamp or array

param: mixed $date integer timestamp or array with ('year','month',..,'second') to convert
param: string/boolean $format='' default common_prefs[dateformat], common_prefs[timeformat], false=time only, true=date only
return: string the formated date (incl. time)

debug_message($msg,$backtrace=True)   X-Ref
Gives out a debug-message with certain parameters

All permanent debug-messages in the calendar should be done by this function !!!
(In future they may be logged or sent as xmlrpc-faults back.)

Permanent debug-message need to make sure NOT to give secret information like passwords !!!

This function do NOT honor the setting of the debug variable, you may use it like
if ($this->debug > N) $this->debug_message('Error ;-)');

The parameters get formated depending on their type. ACL-values need a ACL_TYPE_IDENTIFER prefix.

param: $msg string message with parameters/variables like lang(), eg. '%1'
param: $backtrace include a function-backtrace, default True=On
param: $param mixed a variable number of parameters, to be inserted in $msg

long_date($first,$last=0,$display_time=false,$display_day=false)   X-Ref
Formats one or two dates (range) as long date (full monthname), optionaly with a time

param: mixed $first first date
param: mixed $last=0 last date if != 0 (default)
param: boolean $display_time=false should a time be displayed too
param: boolean $display_day=false should a day-name prefix the date, eg. monday June 20, 2006
return: string with formated date

timespan($start_m,$end_m,$both=false)   X-Ref
Displays a timespan, eg. $both ? "10:00 - 13:00: 3h" (10:00 am - 1 pm: 3h) : "10:00 3h" (10:00 am 3h)

param: int $start_m start time in minutes since 0h
param: int $end_m end time in minutes since 0h
param: boolean $both=false display the end-time too, duration is always displayed

participant_name($id,$use_type=false)   X-Ref
Converts a participant into a (readable) user- or resource-name

param: $id string/int id of user or resource
return: string with name

participants($event,$long_status=False,$show_group_invitation=false)   X-Ref
Converts participants array of an event into array of (readable) participant-names with status

param: array $event event-data
param: boolean $long_status=false should the long/verbose status or only the one letter shortcut be used
param: boolean $show_group_invitation=false show group-invitations (status == 'G') or not (default)
return: array with id / names with status pairs

categories($category,&$color)   X-Ref
Converts category string of an event into array of (readable) category-names

param: $category string cat-id (multiple id's commaseparated)
param: $color int color of the category, if multiple cats, the color of the last one with color is returned
return: array with id / names

_list_cals_add($id,&$users,&$groups)   X-Ref
Pas de description

list_cals()   X-Ref
generate list of user- / group-calendars for the selectbox in the header

return: alphabeticaly sorted array with groups first and then users

recure2string($event)   X-Ref
Convert the recure-information of an event, into a human readable string

param: array $event
return: string

read_holidays($year=0)   X-Ref
Read the holidays for a given $year

The holidays get cached in the session (performance), so changes in holidays or birthdays do NOT affect a current session!!!

param: integer $year=0 year, defaults to 0 = current year
return: array indexed with Ymd of array of holidays. A holiday is an array with the following fields:

link_title($event)   X-Ref
get title for an event identified by $event

Is called as hook to participate in the linking

param: int/array $entry int cal_id or array with event
param: string/boolean string with title, null if not found or false if not read perms

link_query($pattern)   X-Ref
query calendar for events matching $pattern

Is called as hook to participate in the linking

param: string $pattern pattern to search
return: array with pm_id - title pairs of the matching entries

search_link($location)   X-Ref
Hook called by link-class to include calendar in the appregistry of the linkage

param: array/string $location location and other parameters (not used)
return: array with method-names

check_set_default_prefs()   X-Ref
sets the default prefs, if they are not already set (on a per pref. basis)

It sets a flag in the app-session-data to be called only once per session

freebusy_url($user,$pw=null)   X-Ref
Get the freebusy URL of a user

param: int/string $user account_id or account_lid
param: string $pw=null password

array_intersect_key($array1,$array2)   X-Ref
Pas de description



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