reverting r27959, as we dont want to add new features

This commit is contained in:
Ralf Becker 2009-11-16 08:55:07 +00:00
parent 18ff8a6fa7
commit 74fecd8e63
3 changed files with 12 additions and 58 deletions

View File

@ -279,7 +279,7 @@ class calendar_bo
* users mixed integer user-id or array of user-id's to use, defaults to the current user
* cat_id mixed category-id or array of cat-id's, defaults to all if unset, 0 or False
* Please note: only a single cat-id, will include all sub-cats (if the common-pref 'cats_no_subs' is False)
* filter string all (not rejected), accepted, unknown, tentative, rejected or hideprivate
* filter string filter-name, atm. 'all' or 'hideprivate'
* query string pattern so search for, if unset or empty all matching entries are returned (no search)
* Please Note: a search never returns repeating events more then once AND does not honor start+end date !!!
* dayswise boolean on True it returns an array with YYYYMMDD strings as keys and an array with events
@ -291,6 +291,7 @@ class calendar_bo
* otherwise the original recuring event (with the first start- + enddate) is returned
* num_rows int number of entries to return, default or if 0, max_entries from the prefs
* order column-names plus optional DESC|ASC separted by comma
* show_rejected if set rejected invitation are shown only when true, otherwise it depends on the cal-pref or a running query
* ignore_acl if set and true no check_perms for a general EGW_ACL_READ grants is performed
* enum_groups boolean if set and true, group-members will be added as participants with status 'G'
* cols string|array columns to select, if set an iterator will be returned
@ -303,17 +304,6 @@ class calendar_bo
{
$params_in = $params;
unset($params['sql_filter']); // dont allow to set it via UI or xmlrpc
// check if any resource wants to hook into
foreach($this->resources as $app => $data)
{
if (isset($data['search_filter']))
{
$params = ExecMethod($data['search_filter'],$params);
}
}
if (!isset($params['users']) || !$params['users'] ||
count($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0]) // null or '' casted to an array
{
@ -400,7 +390,7 @@ class calendar_bo
}
// date2ts(,true) converts to server time, db2data converts again to user-time
$events =& $this->so->search(isset($start) ? $this->date2ts($start,true) : null,isset($end) ? $this->date2ts($end,true) : null,
$users,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$show_rejected,$params['cols'],$params['append'],$params['cfs']);
$users,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$show_rejected,$params['cols'],$params['append']);
if (isset($params['cols']))
{

View File

@ -270,13 +270,13 @@ class calendar_so
* @param int|array $users user-id or array of user-id's, !$users means all entries regardless of users
* @param int $cat_id=0 mixed category-id or array of cat-id's, default 0 = all
* Please note: only a single cat-id, will include all sub-cats (if the common-pref 'cats_no_subs' is False)
* @param string $filter='all' string filter-name: all (not rejected), accepted, unknown, tentative, rejected or hideprivate (handled elsewhere!)
* @param string $filter='' string filter-name, atm. all or hideprivate
* @param string $query='' pattern so search for, if unset or empty all matching entries are returned (no search)
* Please Note: a search never returns repeating events more then once AND does not honor start+end date !!!
* @param int|boolean $offset=False offset for a limited query or False (default)
* @param int $num_rows=0 number of rows to return if offset set, default 0 = use default in user prefs
* @param string $order='cal_start' column-names plus optional DESC|ASC separted by comma
* @param string $sql_filter='' sql to be and'ed into query (fully quoted)
* @param boolean $show_rejected=true should the search return rejected invitations
* @param string|array $_cols=null what to select, default "$this->repeats_table.*,$this->cal_table.*,cal_start,cal_end,cal_recur_date",
* if specified and not false an iterator for the rows is returned
* @param string $append='' SQL to append to the query before $order, eg. for a GROUP BY clause
@ -285,17 +285,13 @@ class calendar_so
*
* ToDo: search custom-fields too
*/
function &search($start,$end,$users,$cat_id=0,$filter='all',$query='',$offset=False,$num_rows=0,$order='cal_start',$sql_filter='',$_cols=null,$append='',$cfs=null)
function &search($start,$end,$users,$cat_id=0,$filter='',$query='',$offset=False,$num_rows=0,$order='cal_start',$show_rejected=true,$_cols=null,$append='')
{
//echo '<p>'.__METHOD__.'('.($start ? date('Y-m-d H:i',$start) : '').','.($end ? date('Y-m-d H:i',$end) : '').','.array2string($users).','.array2string($cat_id).",'$filter',".array2string($query).",$offset,$num_rows,$order,$show_rejected,".array2string($_cols).",$append,".array2string($cfs).")</p>\n";
$cols = !is_null($_cols) ? $_cols : "$this->repeats_table.*,$this->cal_table.*,cal_start,cal_end,cal_recur_date";
$where = array();
if (!empty($sql_filter) && is_string($sql_filter))
{
$where[] = $sql_filter;
}
if (is_array($query))
{
$where = $query;
@ -330,31 +326,10 @@ class calendar_so
'cal_user_type' => $type,
'cal_user_id' => $ids,
));
if ($type == 'u' && $filter == 'owner')
{
$cal_table_def = $this->db->get_table_definitions('calendar',$this->cal_table);
$to_or[] = $this->db->expression($cal_table_def,array('cal_owner' => $ids));
}
}
$where[] = '('.implode(' OR ',$to_or).')';
switch($filter)
{
case 'unknown':
$where[] = "cal_status='U'"; break;
case 'accepted':
$where[] = "cal_status='A'"; break;
case 'tentative':
$where[] = "cal_status='T'"; break;
case 'rejected':
$where[] = "cal_status='R'"; break;
case 'all':
break;
default:
//if (!$show_rejected) // not longer used
$where[] = "cal_status != 'R'";
break;
}
if (!$show_rejected) $where[] = "cal_status != 'R'";
}
if ($cat_id)
{

View File

@ -123,7 +123,7 @@ class calendar_ui
/**
* @var array $states_to_save all states that will be saved to the user prefs
*/
var $states_to_save = array('owner','filter');
var $states_to_save = array('owner');
/**
* Constructor
@ -690,21 +690,10 @@ class calendar_ui
$this->cats->formatted_list('select','all',$this->cat_id,'True'),$baseurl ? $baseurl.'&cat_id=' : '');
// Filter all or hideprivate
$options = '';
foreach(array(
'default' => lang('Not rejected'),
'accepted' => lang('Accepted'),
'unknown' => lang('Invitations'),
'tentative' => lang('Tentative'),
'rejected' => lang('Rejected'),
'owner' => lang('Owner too'),
'all' => lang('All incl. rejected'),
'hideprivate' => lang('Hide private infos'),
) as $value => $label)
{
$options .= '<option value="'.$value.'"'.($this->filter == $value ? ' selected="selected"' : '').'>'.$label.'</options>'."\n";
}
$file[] = $this->_select_box('Filter','filter',$options,$baseurl ? $baseurl.'&filter=' : '');
$file[] = $this->_select_box('Filter','filter',
'<option value="all"'.($this->filter=='all'?' selected="selected"':'').'>'.lang('No filter').'</option>'."\n".
'<option value="hideprivate"'.($this->filter=='hideprivate'?' selected="selected"':'').'>'.lang('Hide private infos').'</option>'."\n",
$baseurl ? $baseurl.'&filter=' : '');
// Calendarselection: User or Group
if(count($this->bo->grants) > 0 && $this->accountsel->account_selection != 'none')