mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-03-03 01:21:42 +01:00
- added ability to store participant roles to calendar backend,
currently not settable via GUI, but GUI leaves them untouched - showing quantity for resources in brackets behind resource name - docu and formatting updates all over the place
This commit is contained in:
parent
e757e53819
commit
c29ab01e8d
@ -6,7 +6,7 @@
|
||||
* @package calendar
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @author Joerg Lehrke <jlehrke@noc.de>
|
||||
* @copyright (c) 2004-8 by RalfBecker-At-outdoor-training.de
|
||||
* @copyright (c) 2004-9 by RalfBecker-At-outdoor-training.de
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -22,7 +22,7 @@ define('WEEK_s',7*DAY_s);
|
||||
|
||||
/**
|
||||
* Gives read access to the calendar, but all events the user is not participating are private!
|
||||
* Used be the addressbook.
|
||||
* Used by addressbook.
|
||||
*/
|
||||
define('EGW_ACL_READ_FOR_PARTICIPANTS',EGW_ACL_CUSTOM_1);
|
||||
define('EGW_ACL_FREEBUSY',EGW_ACL_CUSTOM_2);
|
||||
@ -203,7 +203,7 @@ class calendar_bo
|
||||
/**
|
||||
* returns info about email addresses as participants
|
||||
*
|
||||
* @param int/array $ids single contact-id or array of id's
|
||||
* @param int|array $ids single contact-id or array of id's
|
||||
* @return array
|
||||
*/
|
||||
static function email_info($ids)
|
||||
@ -544,7 +544,7 @@ class calendar_bo
|
||||
}
|
||||
}
|
||||
// update the horizont
|
||||
$config =& CreateObject('phpgwapi.config','calendar');
|
||||
$config = CreateObject('phpgwapi.config','calendar');
|
||||
$config->save_value('horizont',$this->config['horizont'],'calendar');
|
||||
|
||||
if ($this->debug == 'check_move_horizont') $this->debug_message('bocal::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,$this->config['horizont']);
|
||||
@ -628,7 +628,7 @@ class calendar_bo
|
||||
* 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
|
||||
* @param string $date_format='ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format
|
||||
*/
|
||||
function date2usertime($ts,$date_format='ts')
|
||||
{
|
||||
@ -654,7 +654,7 @@ class calendar_bo
|
||||
/**
|
||||
* 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 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
|
||||
@ -714,11 +714,11 @@ class calendar_bo
|
||||
* 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)
|
||||
* @param array $event repeating event whos repetions should be inserted
|
||||
* @param mixed $start start-date
|
||||
* @param mixed $end end-date
|
||||
* @param array $events where the repetions get inserted
|
||||
* @param array $recur_exceptions with date (in Ymd) as key (and True as values)
|
||||
*/
|
||||
function insert_all_repetitions($event,$start,$end,&$events,$recur_exceptions)
|
||||
{
|
||||
@ -898,9 +898,9 @@ class calendar_bo
|
||||
/**
|
||||
* 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
|
||||
* @param array $events array in which the event gets inserted
|
||||
* @param array $event event to insert, it has start- and end-date of the first recurrence, not of $date_ymd
|
||||
* @param int|string $date_ymd of the date of the event
|
||||
*/
|
||||
function add_adjusted_event(&$events,$event,$date_ymd)
|
||||
{
|
||||
@ -931,7 +931,7 @@ class calendar_bo
|
||||
* 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
|
||||
* @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
|
||||
*/
|
||||
function resource_info($uid)
|
||||
{
|
||||
@ -1068,11 +1068,11 @@ class calendar_bo
|
||||
/**
|
||||
* 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 mixed $date date to convert, should be one of the following types
|
||||
* string (!) in form YYYYMMDD or iso8601 YYYY-MM-DDThh:mm:ss or YYYYMMDDThhmmss
|
||||
* int already a timestamp
|
||||
* array with keys 'second', 'minute', 'hour', 'day' or 'mday' (depricated !), 'month' and 'year'
|
||||
* @param $user2server_time boolean conversation between user- and server-time default False == Off
|
||||
* @param boolean $user2server_time conversation between user- and server-time default False == Off
|
||||
*/
|
||||
function date2ts($date,$user2server=False)
|
||||
{
|
||||
@ -1149,8 +1149,8 @@ class calendar_bo
|
||||
/**
|
||||
* 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
|
||||
* @param mixed $date date to convert
|
||||
* @param boolean $server2user_time 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)
|
||||
*/
|
||||
function date2array($date,$server2user=False)
|
||||
@ -1230,7 +1230,7 @@ class calendar_bo
|
||||
* 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
|
||||
* @param string|boolean $format='' default common_prefs[dateformat], common_prefs[timeformat], false=time only, true=date only
|
||||
* @return string the formated date (incl. time)
|
||||
*/
|
||||
function format_date($date,$format='')
|
||||
@ -1264,10 +1264,10 @@ class calendar_bo
|
||||
*
|
||||
* 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 string $msg message with parameters/variables like lang(), eg. '%1'
|
||||
* @param boolean $backtrace=True include a function-backtrace, default True=On
|
||||
* should only be set to False=Off, if your code ensures a call with backtrace=On was made before !!!
|
||||
* @param $param mixed a variable number of parameters, to be inserted in $msg
|
||||
* @param mixed $param a variable number of parameters, to be inserted in $msg
|
||||
* arrays get serialized with print_r() !
|
||||
*/
|
||||
function debug_message($msg,$backtrace=True)
|
||||
@ -1449,7 +1449,7 @@ class calendar_bo
|
||||
/**
|
||||
* Converts a participant into a (readable) user- or resource-name
|
||||
*
|
||||
* @param $id string/int id of user or resource
|
||||
* @param string|int $id id of user or resource
|
||||
* @return string with name
|
||||
*/
|
||||
function participant_name($id,$use_type=false)
|
||||
@ -1490,11 +1490,19 @@ class calendar_bo
|
||||
$names = array();
|
||||
foreach($event['participants'] as $id => $status)
|
||||
{
|
||||
$quantity = $role = '';
|
||||
if (strlen($status) > 1 && preg_match('/^.([0-9]*)(.*)$/',$status,$matches))
|
||||
{
|
||||
if ((int)$matches[1] > 1) $quantity = (int)$matches[1];
|
||||
$role = $matches[2];
|
||||
}
|
||||
$status = $status[0];
|
||||
|
||||
if ($status == 'G' && !$show_group_invitation) continue; // dont show group-invitation
|
||||
|
||||
if (!$long_status)
|
||||
{
|
||||
switch($status)
|
||||
switch($status[0])
|
||||
{
|
||||
case 'A': // accepted
|
||||
$status = html::image('calendar','agt_action_success',$this->verbose_status[$status]);
|
||||
@ -1518,7 +1526,8 @@ class calendar_bo
|
||||
{
|
||||
$status = '('.$this->verbose_status[$status].')';
|
||||
}
|
||||
$names[$id] = $this->participant_name($id).' '.$status;
|
||||
$names[$id] = $this->participant_name($id).($quantity ? ' ('.$quantity.')' : '').
|
||||
' '.$status.($role ? ' '.lang(str_replace('X-','',$role)) : '');
|
||||
}
|
||||
return $names;
|
||||
}
|
||||
@ -1526,8 +1535,8 @@ class calendar_bo
|
||||
/**
|
||||
* 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
|
||||
* @param string $category cat-id (multiple id's commaseparated)
|
||||
* @param int $color color of the category, if multiple cats, the color of the last one with color is returned
|
||||
* @return array with id / names
|
||||
*/
|
||||
function categories($category,&$color)
|
||||
@ -1537,7 +1546,7 @@ class calendar_bo
|
||||
$color = 0;
|
||||
if (!is_object($this->cats))
|
||||
{
|
||||
$this->cats =& CreateObject('phpgwapi.categories','','calendar');
|
||||
$this->cats = CreateObject('phpgwapi.categories','','calendar');
|
||||
}
|
||||
foreach(explode(',',$category) as $cat_id)
|
||||
{
|
||||
@ -1666,7 +1675,7 @@ class calendar_bo
|
||||
*
|
||||
* 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
|
||||
* @param int $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:
|
||||
* index: numerical unique id
|
||||
* locale: string, 2-char short for the nation
|
||||
@ -1689,7 +1698,7 @@ class calendar_bo
|
||||
{
|
||||
if (!is_object($this->holidays))
|
||||
{
|
||||
$this->holidays =& CreateObject('calendar.boholiday');
|
||||
$this->holidays = CreateObject('calendar.boholiday');
|
||||
}
|
||||
$this->holidays->prepare_read_holidays($year);
|
||||
$this->cached_holidays[$year] = $this->holidays->read_holiday();
|
||||
@ -1697,7 +1706,7 @@ class calendar_bo
|
||||
// search for birthdays
|
||||
if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes')
|
||||
{
|
||||
$contacts =& CreateObject('phpgwapi.contacts');
|
||||
$contacts = CreateObject('phpgwapi.contacts');
|
||||
$bdays =& $contacts->read(0,0,array('id','n_family','n_given','n_prefix','n_middle','bday'),'',"bday=!'',n_family=!''",'ASC','bday');
|
||||
if ($bdays)
|
||||
{
|
||||
@ -1733,8 +1742,8 @@ class calendar_bo
|
||||
*
|
||||
* 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
|
||||
* @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
|
||||
*/
|
||||
function link_title($event)
|
||||
{
|
||||
@ -1755,7 +1764,7 @@ class calendar_bo
|
||||
* 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
|
||||
* @return array with cal_id - title pairs of the matching entries
|
||||
*/
|
||||
function link_query($pattern)
|
||||
{
|
||||
@ -1841,7 +1850,7 @@ class calendar_bo
|
||||
/**
|
||||
* Get the freebusy URL of a user
|
||||
*
|
||||
* @param int/string $user account_id or account_lid
|
||||
* @param int|string $user account_id or account_lid
|
||||
* @param string $pw=null password
|
||||
*/
|
||||
static function freebusy_url($user,$pw=null)
|
||||
@ -1857,16 +1866,15 @@ class calendar_bo
|
||||
/**
|
||||
* Check if the event is the whole day
|
||||
*
|
||||
* @param event
|
||||
* @return boolean true for whole day events
|
||||
* @param array $event event
|
||||
* @return boolean true if whole day event, false othwerwise
|
||||
*/
|
||||
function isWholeDay($event)
|
||||
{
|
||||
// check if the event is the whole day
|
||||
$start = $this->date2array($event['start']);
|
||||
$end = $this->date2array($event['end']);
|
||||
$result = (!$start['hour'] && !$start['minute']
|
||||
&& $end['hour'] == 23 && $end['minute'] == 59);
|
||||
return $result;
|
||||
$start = $this->date2array($event['start']);
|
||||
$end = $this->date2array($event['end']);
|
||||
|
||||
return !$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
// types of messsages send by bocalupdate::send_update
|
||||
// types of messsages send by calendar_boupdate::send_update
|
||||
define('MSG_DELETED',0);
|
||||
define('MSG_MODIFIED',1);
|
||||
define('MSG_ADDED',2);
|
||||
@ -52,7 +52,7 @@ class calendar_boupdate extends calendar_bo
|
||||
var $debug;
|
||||
|
||||
/**
|
||||
* @var string/boolean $log_file filename to enable the login or false for no update-logging
|
||||
* @var string|boolean $log_file filename to enable the login or false for no update-logging
|
||||
*/
|
||||
var $log_file = false;
|
||||
|
||||
@ -61,11 +61,11 @@ class calendar_boupdate extends calendar_bo
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
if ($this->debug > 0) $this->debug_message('bocalupdate::bocalupdate() started',True);
|
||||
if ($this->debug > 0) $this->debug_message('calendar_boupdate::__construct() started',True);
|
||||
|
||||
parent::__construct(); // calling the parent constructor
|
||||
|
||||
if ($this->debug > 0) $this->debug_message('bocalupdate::bocalupdate() finished',True);
|
||||
if ($this->debug > 0) $this->debug_message('calendar_boupdate::__construct() finished',True);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,7 +83,7 @@ class calendar_boupdate extends calendar_bo
|
||||
//error_log(__METHOD__."(".array2string($event).",$ignore_conflicts,$touch_modified,$ignore_acl)");
|
||||
if ($this->debug > 1 || $this->debug == 'update')
|
||||
{
|
||||
$this->debug_message('bocalupdate::update(%1,ignore_conflict=%2,touch_modified=%3,ignore_acl=%4)',
|
||||
$this->debug_message('calendar_boupdate::update(%1,ignore_conflict=%2,touch_modified=%3,ignore_acl=%4)',
|
||||
false,$event,$ignore_conflicts,$touch_modified,$ignore_acl);
|
||||
}
|
||||
// check some minimum requirements:
|
||||
@ -153,7 +153,7 @@ class calendar_boupdate extends calendar_bo
|
||||
));
|
||||
if ($this->debug > 2 || $this->debug == 'update')
|
||||
{
|
||||
$this->debug_message('bocalupdate::update() checking for potential overlapping events for users %1 from %2 to %3',false,$users,$event['start'],$event['end']);
|
||||
$this->debug_message('calendar_boupdate::update() checking for potential overlapping events for users %1 from %2 to %3',false,$users,$event['start'],$event['end']);
|
||||
}
|
||||
$max_quantity = $possible_quantity_conflicts = $conflicts = array();
|
||||
foreach((array) $overlapping_events as $k => $overlap)
|
||||
@ -166,7 +166,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
if ($this->debug > 3 || $this->debug == 'update')
|
||||
{
|
||||
$this->debug_message('bocalupdate::update() checking overlapping event %1',false,$overlap);
|
||||
$this->debug_message('calendar_boupdate::update() checking overlapping event %1',false,$overlap);
|
||||
}
|
||||
// check if the overlap is with a rejected participant or within the allowed quantity
|
||||
$common_parts = array_intersect($users,array_keys($overlap['participants']));
|
||||
@ -199,7 +199,7 @@ class calendar_boupdate extends calendar_bo
|
||||
{
|
||||
if ($this->debug > 3 || $this->debug == 'update')
|
||||
{
|
||||
$this->debug_message('bocalupdate::update() conflicts with the following participants found %1',false,$common_parts);
|
||||
$this->debug_message('calendar_boupdate::update() conflicts with the following participants found %1',false,$common_parts);
|
||||
}
|
||||
$conflicts[$overlap['id'].'-'.$this->date2ts($overlap['start'])] =& $overlapping_events[$k];
|
||||
}
|
||||
@ -235,7 +235,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
if ($this->debug > 2 || $this->debug == 'update')
|
||||
{
|
||||
$this->debug_message('bocalupdate::update() %1 conflicts found %2',false,count($conflicts),$conflicts);
|
||||
$this->debug_message('calendar_boupdate::update() %1 conflicts found %2',false,count($conflicts),$conflicts);
|
||||
}
|
||||
return $conflicts;
|
||||
}
|
||||
@ -300,7 +300,7 @@ class calendar_boupdate extends calendar_bo
|
||||
{
|
||||
$modified = $added = $deleted = array();
|
||||
|
||||
//echo "<p>bocalupdate::check4update() new participants = ".print_r($new_event['participants'],true).", old participants =".print_r($old_event['participants'],true)."</p>\n";
|
||||
//echo "<p>calendar_boupdate::check4update() new participants = ".print_r($new_event['participants'],true).", old participants =".print_r($old_event['participants'],true)."</p>\n";
|
||||
|
||||
// Find modified and deleted participants ...
|
||||
foreach($old_event['participants'] as $old_userid => $old_status)
|
||||
@ -322,7 +322,7 @@ class calendar_boupdate extends calendar_bo
|
||||
$added[$new_userid] = 'U';
|
||||
}
|
||||
}
|
||||
//echo "<p>bocalupdate::check4update() added=".print_r($added,true).", modified=".print_r($modified,true).", deleted=".print_r($deleted,true)."</p>\n";
|
||||
//echo "<p>calendar_boupdate::check4update() added=".print_r($added,true).", modified=".print_r($modified,true).", deleted=".print_r($deleted,true)."</p>\n";
|
||||
if(count($added) || count($modified) || count($deleted))
|
||||
{
|
||||
if(count($added))
|
||||
@ -393,7 +393,7 @@ class calendar_boupdate extends calendar_bo
|
||||
case 'no':
|
||||
break;
|
||||
}
|
||||
//echo "<p>bocalupdate::update_requested(user=$userid,pref=".$part_prefs['calendar']['receive_updates'] .",msg_type=$msg_type,".($old_event?$old_event['title']:'False').",".($old_event?$old_event['title']:'False').") = $want_update</p>\n";
|
||||
//echo "<p>calendar_boupdate::update_requested(user=$userid,pref=".$part_prefs['calendar']['receive_updates'] .",msg_type=$msg_type,".($old_event?$old_event['title']:'False').",".($old_event?$old_event['title']:'False').") = $want_update</p>\n";
|
||||
return $want_update > 0;
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
if($userid != $GLOBALS['egw_info']['user']['account_id'] || $msg_type == MSG_ALARM)
|
||||
{
|
||||
$preferences =& CreateObject('phpgwapi.preferences',$userid);
|
||||
$preferences = CreateObject('phpgwapi.preferences',$userid);
|
||||
$part_prefs = $preferences->read_repository();
|
||||
|
||||
if (!$this->update_requested($userid,$part_prefs,$msg_type,$old_event,$new_event))
|
||||
@ -667,13 +667,13 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
|
||||
/**
|
||||
* saves an event to the database, does NOT do any notifications, see bocalupdate::update for that
|
||||
* saves an event to the database, does NOT do any notifications, see calendar_boupdate::update for that
|
||||
*
|
||||
* This methode converts from user to server time and handles the insertion of users and dates of repeating events
|
||||
*
|
||||
* @param array $event
|
||||
* @param boolean $ignore_acl=false should we ignore the acl
|
||||
* @return int/boolean $cal_id > 0 or false on error (eg. permission denied)
|
||||
* @return int|boolean $cal_id > 0 or false on error (eg. permission denied)
|
||||
*/
|
||||
function save($event, $ignore_acl=false)
|
||||
{
|
||||
@ -728,8 +728,8 @@ class calendar_boupdate extends calendar_bo
|
||||
*
|
||||
* For contacts we use edit rights of the owner of the event (aka. edit rights of the event).
|
||||
*
|
||||
* @param int/string $uid account_id or 1-char type-identifer plus id (eg. c15 for addressbook entry #15)
|
||||
* @param array/int $event event array or id of the event
|
||||
* @param int|string $uid account_id or 1-char type-identifer plus id (eg. c15 for addressbook entry #15)
|
||||
* @param array|int $event event array or id of the event
|
||||
* @return boolean
|
||||
*/
|
||||
function check_status_perms($uid,$event)
|
||||
@ -753,9 +753,9 @@ class calendar_boupdate extends calendar_bo
|
||||
/**
|
||||
* set the status of one participant for a given recurrence or for all recurrences since now (includes recur_date=0)
|
||||
*
|
||||
* @param int/array $event event-array or id of the event
|
||||
* @param string/int $uid account_id or 1-char type-identifer plus id (eg. c15 for addressbook entry #15)
|
||||
* @param int/char $status numeric status (defines) or 1-char code: 'R', 'U', 'T' or 'A'
|
||||
* @param int|array $event event-array or id of the event
|
||||
* @param string|int $uid account_id or 1-char type-identifer plus id (eg. c15 for addressbook entry #15)
|
||||
* @param int|char $status numeric status (defines) or 1-char code: 'R', 'U', 'T' or 'A'
|
||||
* @param int $recur_date=0 date to change, or 0 = all since now
|
||||
* @param boolean $ignore_acl=false do not check the permisions for the $uid, if true
|
||||
* @return int number of changed recurrences
|
||||
@ -763,7 +763,7 @@ class calendar_boupdate extends calendar_bo
|
||||
function set_status($event,$uid,$status,$recur_date=0, $ignore_acl=false)
|
||||
{
|
||||
$cal_id = is_array($event) ? $event['id'] : $event;
|
||||
//echo "<p>bocalupdate::set_status($cal_id,$uid,$status,$recur_date)</p>\n";
|
||||
//echo "<p>calendar_boupdate::set_status($cal_id,$uid,$status,$recur_date)</p>\n";
|
||||
if (!$cal_id || (!$ignore_acl && !$this->check_status_perms($uid,$event)))
|
||||
{
|
||||
return false;
|
||||
@ -1050,7 +1050,7 @@ class calendar_boupdate extends calendar_bo
|
||||
{
|
||||
if (!is_object($this->categories))
|
||||
{
|
||||
$this->categories =& CreateObject('phpgwapi.categories',$GLOBALS['egw_info']['user']['account_id'],'calendar');
|
||||
$this->categories = CreateObject('phpgwapi.categories',$GLOBALS['egw_info']['user']['account_id'],'calendar');
|
||||
}
|
||||
|
||||
$cat_id_list = array();
|
||||
@ -1085,7 +1085,7 @@ class calendar_boupdate extends calendar_bo
|
||||
{
|
||||
if (!is_object($this->categories))
|
||||
{
|
||||
$this->categories =& CreateObject('phpgwapi.categories',$GLOBALS['egw_info']['user']['account_id'],'calendar');
|
||||
$this->categories = CreateObject('phpgwapi.categories',$GLOBALS['egw_info']['user']['account_id'],'calendar');
|
||||
}
|
||||
|
||||
if (!is_array($cat_id_list))
|
||||
|
@ -14,7 +14,7 @@
|
||||
/**
|
||||
* some necessary defines used by the calendar
|
||||
*/
|
||||
if(extension_loaded('mcal') == False)
|
||||
if(!extension_loaded('mcal'))
|
||||
{
|
||||
define('MCAL_RECUR_NONE',0);
|
||||
define('MCAL_RECUR_DAILY',1);
|
||||
@ -162,8 +162,10 @@ class calendar_so
|
||||
}
|
||||
if (!$events) return false;
|
||||
|
||||
foreach ($events as $event) {
|
||||
if (!isset($event['uid']) || strlen($event['uid']) < $minimum_uid_length) {
|
||||
foreach ($events as &$event)
|
||||
{
|
||||
if (!isset($event['uid']) || strlen($event['uid']) < $minimum_uid_length)
|
||||
{
|
||||
// event (without uid), not strong enough uid => create new uid
|
||||
$event['uid'] = $GLOBALS['egw']->common->generate_uid('calendar',$event['id']);
|
||||
$this->db->update($this->cal_table, array('cal_uid' => $event['uid']),
|
||||
@ -197,7 +199,9 @@ class calendar_so
|
||||
// prefix the id with the type
|
||||
$user_id = $row['cal_user_type'].$row['cal_user_id'];
|
||||
// and append quantity
|
||||
$row['cal_status'] .= $row['cal_quantity'] == 1 ? '' : $row['cal_quantity'];
|
||||
if ($row['cal_quantity'] > 1) $row['cal_status'] .= $row['cal_quantity'];
|
||||
// append role to status, if != 'REQ-PARTICIPANT'
|
||||
if ($row['cal_role'] != 'REQ-PARTICIPANT') $row['cal_status'] .= $row['cal_role'];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -403,7 +407,7 @@ class calendar_so
|
||||
// now ready all users with the given cal_id AND (cal_recur_date=0 or the fitting recur-date)
|
||||
// This will always read the first entry of each recuring event too, we eliminate it later
|
||||
$recur_dates[] = 0;
|
||||
$utcal_id_view = " (select * from ".$this->user_table." where cal_id in (".implode(',',array_unique($ids)).")) utcalid ";
|
||||
$utcal_id_view = " (SELECT * FROM ".$this->user_table." WHERE cal_id IN (".implode(',',array_unique($ids)).")) utcalid ";
|
||||
//$utrecurdate_view = " (select * from ".$this->user_table." where cal_recur_date in (".implode(',',array_unique($recur_dates)).")) utrecurdates ";
|
||||
foreach($this->db->select($utcal_id_view,'*',array(
|
||||
//'cal_id' => array_unique($ids),
|
||||
@ -416,6 +420,10 @@ class calendar_so
|
||||
|
||||
if (!isset($events[$id])) continue; // not needed first entry of recuring event
|
||||
|
||||
// add quantity
|
||||
if ($row['cal_quantity'] > 1) $row['cal_status'] .= $row['cal_quantity'];
|
||||
// append role to status, if != 'REQ-PARTICIPANT'
|
||||
if ($row['cal_role'] != 'REQ-PARTICIPANT') $row['cal_status'] .= $row['cal_role'];
|
||||
$events[$id]['participants'][$this->combine_user($row['cal_user_type'],$row['cal_user_id'])] = $row['cal_status'];
|
||||
}
|
||||
/* custom fields are not shown in the regular views, so we can ignore them here for the moment
|
||||
@ -821,7 +829,7 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
* updates the participants of an event, taken into account the evtl. recurrences of the event(!)
|
||||
*
|
||||
* @param int $cal_id
|
||||
* @param array $participants id => status pairs
|
||||
* @param array $participants uid => status pairs
|
||||
* @param int|boolean $change_since=0 false=new entry, > 0 time from which on the repetitions should be changed, default 0=all
|
||||
* @return int|boolean number of updated recurrences or false on error
|
||||
*/
|
||||
@ -905,12 +913,18 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
|
||||
$id = null;
|
||||
$this->split_user($uid,$type,$id);
|
||||
$set = array(
|
||||
'cal_status' => $status !== true ? $status[0] : 'U',
|
||||
'cal_quantity' => substr($status,1) > 1 ? (int)substr($status,1) : 1,
|
||||
);
|
||||
// update role if set, it's apended to status and quantity
|
||||
if (strlen($status) > 1 && preg_match('/^.[0-9]*(.*)$/',$status,$matches))
|
||||
{
|
||||
$set['cal_role'] = $matches[1];
|
||||
}
|
||||
foreach($recurrences as $recur_date)
|
||||
{
|
||||
$this->db->insert($this->user_table,array(
|
||||
'cal_status' => $status !== true ? $status[0] : 'U',
|
||||
'cal_quantity' => substr($status,1) ? substr($status,1) : 1,
|
||||
),array(
|
||||
$this->db->insert($this->user_table,$set,array(
|
||||
'cal_id' => $cal_id,
|
||||
'cal_recur_date' => $recur_date,
|
||||
'cal_user_type' => $type,
|
||||
@ -930,9 +944,10 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
* @param int $user_id
|
||||
* @param int|char $status numeric status (defines) or 1-char code: 'R', 'U', 'T' or 'A'
|
||||
* @param int $recur_date=0 date to change, or 0 = all since now
|
||||
* @param string $role=null role to set if !is_null($role)
|
||||
* @return int number of changed recurrences
|
||||
*/
|
||||
function set_status($cal_id,$user_type,$user_id,$status,$recur_date=0)
|
||||
function set_status($cal_id,$user_type,$user_id,$status,$recur_date=0,$role=null)
|
||||
{
|
||||
static $status_code_short = array(
|
||||
REJECTED => 'R',
|
||||
@ -966,13 +981,13 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->insert($this->user_table,array(
|
||||
'cal_status' => $status,
|
||||
),$where,__LINE__,__FILE__,'calendar');
|
||||
$set = array('cal_status' => $status);
|
||||
if (!is_null($role)) $set['cal_role'] = $role;
|
||||
$this->db->insert($this->user_table,$set,$where,__LINE__,__FILE__,'calendar');
|
||||
}
|
||||
$ret = $this->db->affected_rows();
|
||||
//error_log(__METHOD__."($cal_id,$user_type,$user_id,$status,$recur_date) = $ret");
|
||||
return $this->db->affected_rows();
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,7 +247,7 @@ class calendar_ui
|
||||
* - filter: the used filter: all or hideprivate
|
||||
* - sortby: category or user of planner
|
||||
* - view: the actual view, where dialogs should return to or which they refresh
|
||||
* @param set_states array to manualy set / change one of the states, default NULL = use $_REQUEST
|
||||
* @param array $set_states array to manualy set / change one of the states, default NULL = use $_REQUEST
|
||||
*/
|
||||
function manage_states($set_states=NULL)
|
||||
{
|
||||
@ -390,7 +390,7 @@ class calendar_ui
|
||||
/**
|
||||
* gets the icons displayed for a given event
|
||||
*
|
||||
* @param $event array
|
||||
* @param array $event
|
||||
* @return array of 'img' / 'title' pairs
|
||||
*/
|
||||
function event_icons($event)
|
||||
@ -509,8 +509,8 @@ class calendar_ui
|
||||
function popup($link,$target='_blank',$width=750,$height=410,$Link_confirm_abort='',$Link_confirm_text='')
|
||||
{
|
||||
//Handle Exception for Calandar
|
||||
if (($Link_confirm_abort) && ($Link_confirm_text))
|
||||
{
|
||||
if ($Link_confirm_abort && $Link_confirm_text)
|
||||
{
|
||||
$returnvalue = 'javascript:var check=confirm(\''.$Link_confirm_text.'\');';
|
||||
$returnvalue .=' if (check==true) {';
|
||||
// open confirm =0kay
|
||||
@ -524,14 +524,9 @@ class calendar_ui
|
||||
$returnvalue .= '}';
|
||||
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
return 'egw_openWindowCentered2('.($link == 'this.href' ? $link : "'".$link."'").','.
|
||||
($target == 'this.target' ? $target : "'".$target."'").",$width,$height,'yes')";
|
||||
|
||||
}
|
||||
return 'egw_openWindowCentered2('.($link == 'this.href' ? $link : "'".$link."'").','.
|
||||
($target == 'this.target' ? $target : "'".$target."'").",$width,$height,'yes')";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -287,7 +287,7 @@ class calendar_uiforms extends calendar_ui
|
||||
{
|
||||
$quantity = $content['participants']['quantity'] ? $content['participants']['quantity'] : 1;
|
||||
if ($app == "resources" && !empty($id)) {
|
||||
$bores =& CreateObject('resources.bo_resources');
|
||||
$bores = CreateObject('resources.bo_resources');
|
||||
$selectedres = $bores->read($id);
|
||||
$cats = $bores->acl->get_cats(EGW_ACL_DIRECT_BOOKING);
|
||||
if (is_array($cats) && $selectedres['bookable'] == 1 &&
|
||||
@ -749,7 +749,7 @@ class calendar_uiforms extends calendar_ui
|
||||
function edit($event=null,$preserv=null,$msg='',$js = 'window.focus();',$link_to_id='')
|
||||
{
|
||||
$template = $_REQUEST['print'] ? 'calendar.print' : 'calendar.edit';
|
||||
$etpl =& CreateObject('etemplate.etemplate',$template);
|
||||
$etpl = CreateObject('etemplate.etemplate',$template);
|
||||
$sel_options = array(
|
||||
'recur_type' => &$this->bo->recur_types,
|
||||
'status' => $this->bo->verbose_status,
|
||||
@ -1106,7 +1106,7 @@ class calendar_uiforms extends calendar_ui
|
||||
*/
|
||||
function conflicts($event,$conflicts,$preserv)
|
||||
{
|
||||
$etpl =& CreateObject('etemplate.etemplate','calendar.conflicts');
|
||||
$etpl = CreateObject('etemplate.etemplate','calendar.conflicts');
|
||||
|
||||
foreach($conflicts as $k => $conflict)
|
||||
{
|
||||
@ -1482,7 +1482,7 @@ class calendar_uiforms extends calendar_ui
|
||||
/**
|
||||
* Export events as vCalendar version 2.0 files (iCal)
|
||||
*
|
||||
* @param int/array $content=0 numeric cal_id or submitted content from etempalte::exec
|
||||
* @param int|array $content=0 numeric cal_id or submitted content from etempalte::exec
|
||||
* @param boolean $return_error=false should an error-msg be returned or a regular page with it generated (default)
|
||||
* @return string error-msg if $return_error
|
||||
*/
|
||||
@ -1543,7 +1543,7 @@ class calendar_uiforms extends calendar_ui
|
||||
$content['msg'] = $msg;
|
||||
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('iCal Export');
|
||||
$etpl =& CreateObject('etemplate.etemplate','calendar.export');
|
||||
$etpl = CreateObject('etemplate.etemplate','calendar.export');
|
||||
|
||||
$etpl->exec('calendar.calendar_uiforms.export',$content);
|
||||
}
|
||||
@ -1577,7 +1577,7 @@ class calendar_uiforms extends calendar_ui
|
||||
'msg' => $msg,
|
||||
);
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('iCal Import');
|
||||
$etpl =& CreateObject('etemplate.etemplate','calendar.import');
|
||||
$etpl = CreateObject('etemplate.etemplate','calendar.import');
|
||||
|
||||
$etpl->exec('calendar.calendar_uiforms.import',$content);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @package calendar
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2004-8 by RalfBecker-At-outdoor-training.de
|
||||
* @copyright (c) 2004-9 by RalfBecker-At-outdoor-training.de
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -161,7 +161,7 @@ class calendar_uiviews extends calendar_ui
|
||||
$this->dragdrop = new dragdrop();
|
||||
// if the object would auto-disable itself unset object
|
||||
// to avoid unneccesary dragdrop calls later
|
||||
if(!$this->dragdrop->validateBrowser()) { $this->dragdrop = false; }
|
||||
if(!$this->dragdrop->validateBrowser()) $this->dragdrop = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1128,7 +1128,7 @@ class calendar_uiviews extends calendar_ui
|
||||
{
|
||||
if ($this->debug > 1 || $this->debug==='eventWidget') $this->bo->debug_message('uiviews::eventWidget(%1,width=%2)',False,$event,$width);
|
||||
|
||||
if($this->use_time_grid && $event['whole_day_on_top']) { $block='event_widget_wholeday_on_top'; }
|
||||
if($this->use_time_grid && $event['whole_day_on_top']) $block = 'event_widget_wholeday_on_top';
|
||||
|
||||
static $tpl = False;
|
||||
if (!$tpl)
|
||||
@ -1185,9 +1185,9 @@ class calendar_uiviews extends calendar_ui
|
||||
{
|
||||
$part_array[lang('Participants')][$part_key] = $participant;
|
||||
}
|
||||
elseif(isset($this->bo->resources[$part_key{0}]))
|
||||
elseif(isset($this->bo->resources[$part_key[0]]))
|
||||
{
|
||||
$part_array[((isset($this->bo->resources[$part_key{0}]['participants_header'])) ? $this->bo->resources[$part_key{0}]['participants_header'] : lang($this->bo->resources[$part_key{0}]['app']))][$part_key] = $participant;
|
||||
$part_array[((isset($this->bo->resources[$part_key[0]]['participants_header'])) ? $this->bo->resources[$part_key[0]]['participants_header'] : lang($this->bo->resources[$part_key[0]]['app']))][$part_key] = $participant;
|
||||
}
|
||||
}
|
||||
foreach($part_array as $part_group => $participant)
|
||||
|
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
$setup_info['calendar']['name'] = 'calendar';
|
||||
$setup_info['calendar']['version'] = '1.7.001';
|
||||
$setup_info['calendar']['version'] = '1.7.002';
|
||||
$setup_info['calendar']['app_order'] = 3;
|
||||
$setup_info['calendar']['enable'] = 1;
|
||||
$setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index';
|
||||
@ -60,3 +60,4 @@ $setup_info['calendar']['check_install'] = array(
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
@ -73,7 +73,8 @@ $phpgw_baseline = array(
|
||||
'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u'),
|
||||
'cal_user_id' => array('type' => 'varchar','precision' => '128','nullable' => False),
|
||||
'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'),
|
||||
'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1')
|
||||
'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1'),
|
||||
'cal_role' => array('type' => 'varchar','precision' => '64','default' => 'REQ-PARTICIPANT')
|
||||
),
|
||||
'pk' => array('cal_id','cal_recur_date','cal_user_type','cal_user_id'),
|
||||
'fk' => array(),
|
||||
|
@ -1691,3 +1691,15 @@ function calendar_upgrade1_6()
|
||||
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.001';
|
||||
}
|
||||
|
||||
|
||||
function calendar_upgrade1_7_001()
|
||||
{
|
||||
$GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_role',array(
|
||||
'type' => 'varchar',
|
||||
'precision' => '64',
|
||||
'default' => 'REQ-PARTICIPANT'
|
||||
));
|
||||
|
||||
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.002';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user