diff --git a/phpgwapi/inc/class.nextmatchs.inc.php b/phpgwapi/inc/class.nextmatchs.inc.php
index ce290cbff8..59eedba2d2 100644
--- a/phpgwapi/inc/class.nextmatchs.inc.php
+++ b/phpgwapi/inc/class.nextmatchs.inc.php
@@ -22,230 +22,213 @@
\**************************************************************************/
/* $Id$ */
- /*!
- @class nextmatchs
- @abstract
- */
- class nextmatchs
+
+ /*!
+ @class nextmatchs
+ @abstract
+ */
+ class nextmatchs
+ {
+ var $maxmatches;
+ var $action;
+ var $template;
+
+ function nextmatchs()
{
- var $maxmatches;
- var $action;
- var $template;
+ global $phpgw_info, $menuaction;
- function nextmatchs()
+ $this->template = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
+ $this->template->set_file(array(
+ '_nextmatchs' => 'nextmatchs.tpl'
+ ));
+ $this->template->set_block('_nextmatchs','nextmatchs');
+ $this->template->set_block('_nextmatchs','filter');
+ $this->template->set_block('_nextmatchs','form');
+ $this->template->set_block('_nextmatchs','icon');
+ $this->template->set_block('_nextmatchs','link');
+ $this->template->set_block('_nextmatchs','search');
+ $this->template->set_block('_nextmatchs','cats');
+ $this->template->set_block('_nextmatchs','search_filter');
+ $this->template->set_block('_nextmatchs','cats_search_filter');
+
+ if(isset($phpgw_info['user']['preferences']['common']['maxmatchs'])
+ && intval($phpgw_info['user']['preferences']['common']['maxmatchs']) > 0)
{
- global $phpgw_info, $menuaction;
-
- $this->template = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
- $this->template->set_file(array(
- '_nextmatchs' => 'nextmatchs.tpl'
- ));
- $this->template->set_block('_nextmatchs','nextmatchs');
- $this->template->set_block('_nextmatchs','filter');
- $this->template->set_block('_nextmatchs','form');
- $this->template->set_block('_nextmatchs','icon');
- $this->template->set_block('_nextmatchs','link');
- $this->template->set_block('_nextmatchs','search');
- $this->template->set_block('_nextmatchs','cats');
- $this->template->set_block('_nextmatchs','search_filter');
- $this->template->set_block('_nextmatchs','cats_search_filter');
-
- if(isset($phpgw_info['user']['preferences']['common']['maxmatchs']) &&
- intval($phpgw_info['user']['preferences']['common']['maxmatchs']) > 0)
- {
- $this->maxmatches = intval($phpgw_info['user']['preferences']['common']['maxmatchs']);
- }
- else
- {
- $this->maxmatches = 15;
- }
-
- if(isset($menuaction))
- {
- $this->action = $menuaction;
- }
+ $this->maxmatches = intval($phpgw_info['user']['preferences']['common']['maxmatchs']);
+ }
+ else
+ {
+ $this->maxmatches = 15;
}
- /*!
- @function set_icon
- @abstract ?
- @param $align ?
- @param $img_src ?
- @param $label ?
- */
- function set_icon($align,$img,$label)
+ if(isset($menuaction))
{
- global $phpgw, $phpgw_info;
+ $this->action = $menuaction;
+ }
+ }
- switch(strtolower($phpgw_info['user']['account_lid']))
- {
- case 'ceb':
- $border = 2;
- break;
- default:
- $border = 0;
- break;
- }
+ /*!
+ @function set_icon
+ @abstract ?
+ @param $align ?
+ @param $img_src ?
+ @param $label ?
+ */
+ function set_icon($align,$img,$label)
+ {
+ global $phpgw, $phpgw_info;
- $var = array(
- 'align' => $align,
- 'img' => $phpgw->common->image('phpgwapi',$img),
- 'label' => lang($label),
- 'border' => $border
- );
- $this->template->set_var($var);
- return $this->template->fp('out','link');
+ switch(strtolower($phpgw_info['user']['account_lid']))
+ {
+ case 'ceb':
+ $border = 2;
+ break;
+ default:
+ $border = 0;
+ break;
}
+ $var = array(
+ 'align' => $align,
+ 'img' => $phpgw->common->image('phpgwapi',$img),
+ 'label' => lang($label),
+ 'border' => $border
+ );
+ $this->template->set_var($var);
+ return $this->template->fp('out','link');
+ }
- /*!
- @function page
- @abstract ?
- */
- function page($extravars='')
+
+ /*!
+ @function page
+ @abstract ?
+ */
+ function page($extravars='')
+ {
+ global $phpgw;
+
+ if($extravars && is_string($extravars) && substr($extravars,0,1)!='&')
{
- global $phpgw;
-
- if($extravars && is_string($extravars) && substr($extravars,0,1)!='&')
- {
- $extras = '&'.$extravars;
- }
- elseif($extravars && is_array($extravars))
- {
- @reset($extravars);
- while(list($var,$value) = each($extravars))
- {
- $t_extras[] = $var.'='.$value;
- }
- $extras = implode($t_extras,'&');
- }
-
- return $phpgw->link('/index.php','menuaction='.$this->action.$extras);
+ $extras = '&'.$extravars;
}
-
- /*!
- @function set_link
- @abstract ?
- @param $img_src ?
- @param $label ?
- @param $link ?
- @param $extravars ?
- */
- function set_link($align,$img,$link,$alt,$extravars)
+ elseif($extravars && is_array($extravars))
{
- global $phpgw, $phpgw_info;
-
- $hidden = '';
+ @reset($extravars);
while(list($var,$value) = each($extravars))
{
- if(((is_int($value) && $value == 0) || $value))
- {
- if(is_int($value))
- {
- $param = intval($value);
- }
- else
- {
- $param = '"'.$value.'"';
- }
- $hidden .= ' '."\n";
- }
+ $t_extras[] = $var.'='.$value;
}
-
- $border = 0;
-
- $var = Array(
- 'align' => $align,
- 'action' => ($this->action?$this->page():$phpgw->link($link)),
- 'form_name' => $img,
- 'hidden' => substr($hidden,0,strlen($hidden)-1),
- 'img' => $phpgw->common->image('phpgwapi',$img),
- 'label' => $alt,
- 'border' => $border,
- 'start' => $extravars['start']
- );
- $this->template->set_var($var);
- return $this->template->fp('out','form');
+ $extras = implode($t_extras,'&');
}
+ return $phpgw->link('/index.php','menuaction='.$this->action.$extras);
+ }
- /*!
- @function show_tpl
- @abstract ?
- @param $sn ?
- @param $start ?
- @param $total ?
- @param $extra ?
- @param $twidth ?
- @param $bgtheme ?
- @param $search_obj ?
- @param $filter_obj ?
- @param $showsearch ?
- */
- function show_tpl($sn,$localstart,$total,$extra, $twidth, $bgtheme,$search_obj=0,$filter_obj=1,$showsearch=1,$yours=0,$cat_id=0,$cat_field='fcat_id')
+ /*!
+ @function set_link
+ @abstract ?
+ @param $img_src ?
+ @param $label ?
+ @param $link ?
+ @param $extravars ?
+ */
+ function set_link($align,$img,$link,$alt,$extravars)
+ {
+ global $phpgw, $phpgw_info;
+
+ $hidden = '';
+ while(list($var,$value) = each($extravars))
{
- global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
- $start = $localstart;
-
- $cats = CreateObject('phpgwapi.categories');
-
- $extravars = Array();
- $extravars = $this->split_extras($extravars,$extra);
-
- $var = array(
- 'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
- 'lang_category' => lang('Category'),
- 'lang_all' => lang('All'),
- 'lang_select' => lang('Select'),
- 'cat_field' => $cat_field,
- 'categories' => $cats->formated_list('select','all',$cat_id,'True'),
- 'filter_value' => $filter,
- 'qfield' => $qfield,
- 'start_value' => $start,
- 'order_value' => $order,
- 'sort_value' => $sort,
- 'query_value' => urlencode(stripslashes($query)),
- 'table_width' => $twidth,
- 'th_bg' => $phpgw_info['theme']['th_bg'],
- 'left' => $this->left($sn,$start,$total,$extra),
- 'search' => ($showsearch?$this->search($search_obj):''),
- 'filter' => ($filter_obj?$this->filter($filter_obj,$yours):''),
- 'right' => $this->right($sn,$start,$total,$extra)
- );
- $this->template->set_var($var);
- $this->template->parse('cats','cats');
- $this->template->parse('cats_search_filter_data','cats_search_filter');
- return $this->template->fp('out','nextmatchs');
- }
-
- function split_extras($extravars,$extradata)
- {
- if($extradata)
+ if(((is_int($value) && $value == 0) || $value))
{
- if(is_string($extradata))
+ if(is_int($value))
{
- $extraparams = explode('&',$extradata);
- $c_extraparams = count($extraparams) + 1;
- for($i=0;$i<$c_extraparams;$i++)
- {
- if($extraparams[$i])
- {
- list($var,$value) = explode('=',$extraparams[$i]);
- if($var != 'menuaction')
- {
- $extravars[$var] = $value;
- }
- else
- {
- $this->action = $value;
- }
- }
- }
+ $param = intval($value);
}
- elseif(is_array($extradata))
+ else
{
- while(list($var,$value) = each($extradata))
+ $param = '"'.$value.'"';
+ }
+ $hidden .= ' '."\n";
+ }
+ }
+ $border = 0;
+ $var = Array(
+ 'align' => $align,
+ 'action' => ($this->action?$this->page():$phpgw->link($link)),
+ 'form_name' => $img,
+ 'hidden' => substr($hidden,0,strlen($hidden)-1),
+ 'img' => $phpgw->common->image('phpgwapi',$img),
+ 'label' => $alt,
+ 'border' => $border,
+ 'start' => $extravars['start']
+ );
+ $this->template->set_var($var);
+ return $this->template->fp('out','form');
+ }
+
+ /*!
+ @function show_tpl
+ @abstract ?
+ @param $sn ?
+ @param $start ?
+ @param $total ?
+ @param $extra ?
+ @param $twidth ?
+ @param $bgtheme ?
+ @param $search_obj ?
+ @param $filter_obj ?
+ @param $showsearch ?
+ */
+ function show_tpl($sn,$localstart,$total,$extra, $twidth, $bgtheme,$search_obj=0,$filter_obj=1,$showsearch=1,$yours=0,$cat_id=0,$cat_field='fcat_id')
+ {
+ global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
+ $start = $localstart;
+
+ $cats = CreateObject('phpgwapi.categories');
+
+ $extravars = Array();
+ $extravars = $this->split_extras($extravars,$extra);
+
+ $var = array(
+ 'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
+ 'lang_category' => lang('Category'),
+ 'lang_all' => lang('All'),
+ 'lang_select' => lang('Select'),
+ 'cat_field' => $cat_field,
+ 'categories' => $cats->formated_list('select','all',$cat_id,'True'),
+ 'filter_value' => $filter,
+ 'qfield' => $qfield,
+ 'start_value' => $start,
+ 'order_value' => $order,
+ 'sort_value' => $sort,
+ 'query_value' => urlencode(stripslashes($query)),
+ 'table_width' => $twidth,
+ 'th_bg' => $phpgw_info['theme']['th_bg'],
+ 'left' => $this->left($sn,$start,$total,$extra),
+ 'search' => ($showsearch?$this->search($search_obj):''),
+ 'filter' => ($filter_obj?$this->filter($filter_obj,$yours):''),
+ 'right' => $this->right($sn,$start,$total,$extra)
+ );
+ $this->template->set_var($var);
+ $this->template->parse('cats','cats');
+ $this->template->parse('cats_search_filter_data','cats_search_filter');
+ return $this->template->fp('out','nextmatchs');
+ }
+
+ function split_extras($extravars,$extradata)
+ {
+ if($extradata)
+ {
+ if(is_string($extradata))
+ {
+ $extraparams = explode('&',$extradata);
+ $c_extraparams = count($extraparams) + 1;
+ for($i=0;$i<$c_extraparams;$i++)
+ {
+ if($extraparams[$i])
{
+ list($var,$value) = explode('=',$extraparams[$i]);
if($var != 'menuaction')
{
$extravars[$var] = $value;
@@ -257,48 +240,64 @@
}
}
}
- return $extravars;
- }
-
- function extras_to_string($extra)
- {
- if(is_array($extra))
+ elseif(is_array($extradata))
{
- @reset($extra);
- while(list($var,$value) = each($extra))
+ while(list($var,$value) = each($extradata))
{
- $t_extras[] = $var . '=' . $value;
+ if($var != 'menuaction')
+ {
+ $extravars[$var] = $value;
+ }
+ else
+ {
+ $this->action = $value;
+ }
}
- $extra_s = '&' . implode('&',$t_extras);
}
- return $extra_s;
}
+ return $extravars;
+ }
- /*!
- @function left
- @abstract ?
- @param $scriptname ?
- @param $start ?
- @param $total ?
- @param $extradate ?
- */
+ function extras_to_string($extra)
+ {
+ if(is_array($extra))
+ {
+ @reset($extra);
+ while(list($var,$value) = each($extra))
+ {
+ $t_extras[] = $var . '=' . $value;
+ }
+ $extra_s = '&' . implode('&',$t_extras);
+ }
+ return $extra_s;
+ }
+
+ /*!
+ @function left
+ @abstract ?
+ @param $scriptname ?
+ @param $start ?
+ @param $total ?
+ @param $extradate ?
+ */
function left($scriptname,$start,$total,$extradata = '')
{
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
$extravars = Array(
- 'order' => $order,
- 'filter' => $filter,
- 'q_field' => $qfield,
- 'sort' => $sort,
- 'query' => urlencode(stripslashes($query))
- );
+ 'order' => $order,
+ 'filter' => $filter,
+ 'q_field' => $qfield,
+ 'sort' => $sort,
+ 'query' => urlencode(stripslashes($query))
+ );
$extravars = $this->split_extras($extravars,$extradata);
$ret_str = '';
- if (($start != 0) && ($start > $this->maxmatches))
+ if (($start != 0)
+ && ($start > $this->maxmatches))
{
$extravars['start'] = 0;
$ret_str .= $this->set_link('left','first.gif',$scriptname,lang('First page'),$extravars);
@@ -310,7 +309,7 @@
if ($start != 0)
{
- // Changing the sorting order screaws up the starting number
+ // Changing the sorting order screaws up the starting number
if (($start - $this->maxmatches) < 0)
{
$extravars['start'] = 0;
@@ -319,42 +318,65 @@
{
$extravars['start'] = ($start - $this->maxmatches);
}
-
$ret_str .= $this->set_link('left','left.gif',$scriptname,lang('Previous page'),$extravars);
}
else
{
$ret_str .= $this->set_icon('left','left-grey.gif',lang('Previous page'));
}
-
return $ret_str;
} /* left() */
- /*!
- @function right
- @abstract ?
- @param $scriptname ?
- @param $start ?
- @param $total ?
- @param $extradate ?
- */
+ /*!
+ @function right
+ @abstract ?
+ @param $scriptname ?
+ @param $start ?
+ @param $total ?
+ @param $extradate ?
+ */
function right($scriptname,$start,$total,$extradata = '')
{
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
+ /*
+ $extravars = Array();
+ if ((isset($order)) && ($order != ''))
+ {
+ $extravars['order'] = $order;
+ }
+ if ((isset($filter)) && ($filter != ''))
+ {
+ $extravars['filter'] = $filter;
+ }
+ if ((isset($q_field)) && ($q_field != ''))
+ {
+ $extravars['q_field'] = $qfield;
+ }
+ if ((isset($sort)) && ($sort != ''))
+ {
+ $extravars['sort'] = $sort;
+ }
+ if ((isset($query)) && ($query != ''))
+ {
+ $extravars['query'] = urlencode(stripslashes($query));
+ }
+ */
+
$extravars = Array(
- 'order' => $order,
- 'filter' => $filter,
- 'q_field' => $qfield,
- 'sort' => $sort,
- 'query' => urlencode(stripslashes($query))
- );
+ 'order' => $order,
+ 'filter' => $filter,
+ 'q_field' => $qfield,
+ 'sort' => $sort,
+ 'query' => urlencode(stripslashes($query))
+ );
$extravars = $this->split_extras($extravars,$extradata);
$ret_str = '';
- if (($total > $this->maxmatches) && ($total > $start + $this->maxmatches))
+ if (($total > $this->maxmatches)
+ && ($total > $start + $this->maxmatches))
{
$extravars['start'] = ($start + $this->maxmatches);
$ret_str .= $this->set_link('right','right.gif',$scriptname,lang('Next page'),$extravars);
@@ -364,7 +386,8 @@
$ret_str .= $this->set_icon('right','right-grey.gif',lang('Next page'));
}
- if (($start != $total - $this->maxmatches) && (($total - $this->maxmatches) > ($start + $this->maxmatches)))
+ if (($start != $total - $this->maxmatches)
+ && (($total - $this->maxmatches) > ($start + $this->maxmatches)))
{
$extravars['start'] = ($total - $this->maxmatches);
$ret_str .= $this->set_link('right','last.gif',$scriptname,lang('Last page'),$extravars);
@@ -373,104 +396,100 @@
{
$ret_str .= $this->set_icon('right','last-grey.gif',lang('Last page'));
}
-
return $ret_str;
} /* right() */
- /*!
- @function search_filter
- @abstract ?
- @param $search_obj default 0
- */
+ /*!
+ @function search_filter
+ @abstract ?
+ @param $search_obj default 0
+ */
function search_filter($search_obj=0,$filter_obj=1,$yours=0,$link='',$extra='')
{
global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
- $start = $localstart;
+ $start = $localstart;
$var = array(
- 'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
- 'filter_value' => $filter,
- 'qfield' => $qfield,
- 'start_value' => $start,
- 'order_value' => $order,
- 'sort_value' => $sort,
- 'query_value' => urlencode(stripslashes($query)),
- 'th_bg' => $phpgw_info['theme']['th_bg'],
- 'search' => $this->search($search_obj),
- 'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
- );
+ 'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
+ 'filter_value' => $filter,
+ 'qfield' => $qfield,
+ 'start_value' => $start,
+ 'order_value' => $order,
+ 'sort_value' => $sort,
+ 'query_value' => urlencode(stripslashes($query)),
+ 'th_bg' => $phpgw_info['theme']['th_bg'],
+ 'search' => $this->search($search_obj),
+ 'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
+ );
$this->template->set_var($var);
return $this->template->fp('out','search_filter');
}
- /*!
- @function cats_search_filter
- @abstract ?
- @param $search_obj default 0
- */
+ /*!
+ @function cats_search_filter
+ @abstract ?
+ @param $search_obj default 0
+ */
function cats_search_filter($search_obj=0,$filter_obj=1,$yours=0,$cat_id=0,$cat_field='fcat_id',$link='',$extra='')
{
global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
+
$start = $localstart;
-
$cats = CreateObject('phpgwapi.categories');
-
$var = array(
- 'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
- 'lang_category'=> lang('Category'),
- 'lang_all' => lang('All'),
- 'lang_select' => lang('Select'),
- 'cat_field' => $cat_field,
- 'categories' => $cats->formated_list('select','all',$cat_id,'True'),
- 'filter_value' => $filter,
- 'qfield' => $qfield,
- 'start_value' => $start,
- 'order_value' => $order,
- 'sort_value' => $sort,
- 'query_value' => urlencode(stripslashes($query)),
- 'th_bg' => $phpgw_info['theme']['th_bg'],
- 'search' => $this->search($search_obj),
- 'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
- );
+ 'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
+ 'lang_category' => lang('Category'),
+ 'lang_all' => lang('All'),
+ 'lang_select' => lang('Select'),
+ 'cat_field' => $cat_field,
+ 'categories' => $cats->formated_list('select','all',$cat_id,'True'),
+ 'filter_value' => $filter,
+ 'qfield' => $qfield,
+ 'start_value' => $start,
+ 'order_value' => $order,
+ 'sort_value' => $sort,
+ 'query_value' => urlencode(stripslashes($query)),
+ 'th_bg' => $phpgw_info['theme']['th_bg'],
+ 'search' => $this->search($search_obj),
+ 'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
+ );
$this->template->set_var($var);
return $this->template->fp('out','cats_search_filter');
}
- /*!
- @function search
- @abstract ?
- @param $search_obj default 0
- */
+ /*!
+ @function search
+ @abstract ?
+ @param $search_obj default 0
+ */
function search($search_obj=0)
{
global $query;
$_query = stripslashes($query);
- // If the place a " in there search, it will mess everything up
- // Our only option is to remove it
+ // If the place a " in there search, it will mess everything up
+ // Our only option is to remove it
if (ereg('"',$_query))
{
$_query = ereg_replace('"','',$_query);
}
-
$var = array(
- 'query_value' => stripslashes($_query),
- 'searchby' => $this->searchby($search_obj),
- 'lang_search' => lang('Search')
- );
-
+ 'query_value' => stripslashes($_query),
+ 'searchby' => $this->searchby($search_obj),
+ 'lang_search' => lang('Search')
+ );
$this->template->set_var($var);
return $this->template->fp('out','search');
} /* search() */
- /*!
- @function filterobj
- @abstract ?
- @param $filtertable
- @param $indxfieldname ?
- @param $strfieldname ?
- */
+ /*!
+ @function filterobj
+ @abstract ?
+ @param $filtertable
+ @param $indxfieldname ?
+ @param $strfieldname ?
+ */
function filterobj($filtertable, $idxfieldname, $strfieldname)
{
global $phpgw;
@@ -489,11 +508,11 @@
return $filter_obj;
} /* filterobj() */
- /*!
- @function searchby
- @abstract ?
- @param $search_obj ?
- */
+ /*!
+ @function searchby
+ @abstract ?
+ @param $search_obj ?
+ */
function searchby($search_obj)
{
global $qfield, $phpgw, $phpgw_info;
@@ -508,7 +527,6 @@
{
$qfield = $search_obj[$index][0];
}
-
$str .= '';
}
$str = '' . "\n";
@@ -516,11 +534,11 @@
return $str;
} /* searchby() */
- /*!
- @function filter
- @abstract ?
- @param $filter_obj
- */
+ /*!
+ @function filter
+ @abstract ?
+ @param $filter_obj
+ */
function filter($filter_obj,$yours=0)
{
global $filter, $phpgw, $phpgw_info;
@@ -529,19 +547,23 @@
{
if ($filter_obj == 1)
{
-// $user_groups = $phpgw->accounts->membership($phpgw_info['user']['account_id']);
+ // $user_groups = $phpgw->accounts->membership($phpgw_info['user']['account_id']);
$indexlimit = count($user_groups);
if ($yours)
{
- $filter_obj = array(array('none',lang('Show all')),
+ $filter_obj = array(
+ array('none',lang('Show all')),
array('yours',lang('Only yours')),
- array('private',lang('private')));
+ array('private',lang('private'))
+ );
}
else
{
- $filter_obj = array(array('none',lang('Show all')),
- array('private',lang('private')));
+ $filter_obj = array(
+ array('none',lang('Show all')),
+ array('private',lang('private'))
+ );
}
for ($index=0; $index<$indexlimit; $index++)
{
@@ -563,7 +585,6 @@
{
$filter = $filter_obj[$index][0];
}
-
$str .= ' '."\n";
}
@@ -575,11 +596,11 @@
return $this->template->fp('out','filter');
} /* filter() */
- /*!
- @function alternate_row_color
- @abstract alternate row colour
- @param $currentcolor default ''
- */
+ /*!
+ @function alternate_row_color
+ @abstract alternate row colour
+ @param $currentcolor default ''
+ */
function alternate_row_color($currentcolor = '')
{
global $phpgw_info;
@@ -602,95 +623,131 @@
return $tr_color;
}
- // If you are using the common bgcolor="{tr_color}"
- // This function is a little cleanier approch
- /*!
- @function template_alternate_row_color
- @abstract ?
- @param $tpl ?
- */
+ // If you are using the common bgcolor="{tr_color}"
+ // This function is a little cleanier approch
+ /*!
+ @function template_alternate_row_color
+ @abstract ?
+ @param $tpl ?
+ */
function template_alternate_row_color(&$tpl)
{
$tpl->set_var('tr_color',$this->alternate_row_color());
}
- /*!
- @function show_sort_order
- @abstract ?
- @param $sort ?
- @param $var ?
- @param $order ?
- @param $program ?
- @param $text ?
- @param $extra default ''
- */
- function show_sort_order($sort,$var,$order,$program,$text,$extra='',$build_a_href=True)
- {
- global $phpgw, $filter, $qfield, $start, $query;
+ /*!
+ @function show_sort_order
+ @abstract ?
+ @param $sort ?
+ @param $var ?
+ @param $order ?
+ @param $program ?
+ @param $text ?
+ @param $extra default ''
+ */
+ function show_sort_order($sort,$var,$order,$program,$text,$extra='',$build_a_href=True)
+ {
+ global $phpgw, $filter, $qfield, $start, $query;
- if (($order == $var) && ($sort == 'ASC'))
+ if (($order == $var) && ($sort == 'ASC'))
+ {
+ $sort = 'DESC';
+ }
+ else if (($order == $var) && ($sort == 'DESC'))
+ {
+ $sort = 'ASC';
+ }
+ else
+ {
+ $sort = 'ASC';
+ }
+
+ if (is_array($extra))
+ {
+ $extra = $this->extras_to_string($extra);
+ }
+
+ $extravar = 'order='.$var.'&sort='.$sort.'&filter='.$filter.'&qfield='.$qfield.'&start='.$start.'&query='.urlencode(stripslashes($query)).$extra;
+
+ $link = ($this->action?$this->page($extravar):$phpgw->link($program,$extravar));
+
+ if ($build_a_href)
+ {
+ return '' . $text . '';
+ }
+ else
+ {
+ return $link;
+ }
+ }
+
+ /*!
+ @function show_sort_order_imap
+ @abstract ?
+ @param $old_sort : the current sort value
+ @param $new_sort : the sort value you want if you click on this
+ @param $default_order : user's preference for ordering list items (force this when a new [different] sorting is requested)
+ @param $order : the current order (will be flipped if old_sort = new_sort)
+ @param $program : script file name
+ @param $text : Text the link will show
+ @param $extra : any extra stuff you want to pass, url style
+ */
+ function show_sort_order_imap($old_sort,$new_sort,$default_order,$order,$program,$text,$extra='')
+ {
+ global $phpgw;
+
+ if (is_array($extra))
+ {
+ $extra = $this->extras_to_string($extra);
+ }
+ if ($old_sort == $new_sort)
+ {
+ // alternate order, like on outkrook, click on present sorting reverses order
+ if ((int)$order == 1)
{
- $sort = 'DESC';
+ $our_order = 0;
}
- else if (($order == $var) && ($sort == 'DESC'))
+ elseif ((int)$order == 0)
{
- $sort = 'ASC';
+ $our_order = 1;
}
else
{
- $sort = 'ASC';
+ // we should never get here
+ $our_order = 1;
}
+ }
+ else
+ {
+ //user has selected a new sort scheme, reset the order to user's default
+ $our_order = $default_order;
+ }
+
+ $extravar = 'order='.$our_order.'&sort='.$new_sort.$extra;
- if (is_array($extra))
+ $link = ($this->action?$this->page($extravar):$phpgw->link($program,$extravar));
+ return '' .$text .'';
+ }
+
+ function show_hits($total_records='',$start=0)
+ {
+ if ($total_records > $this->maxmatches)
+ {
+ if ($start + $this->maxmatches > $total_records)
{
- $extra = $this->extras_to_string($extra);
- }
-
- $extravar = 'order='.$var.'&sort='.$sort.'&filter='.$filter.'&qfield='.$qfield.'&start='.$start.'&query='.urlencode(stripslashes($query)).$extra;
-
- $link = ($this->action?$this->page($extravar):$phpgw->link($program,$extravar));
-
- if ($build_a_href)
- {
- return '' . $text . '';
+ $end = $total_records;
}
else
{
- return $link;
+ $end = $start + $this->maxmatches;
}
+ return lang('showing x - x of x',($start + 1),$end,$total_records);
}
-
- function show_sort_order_imap($sort,$order,$program,$text,$extra='')
+ else
{
- global $phpgw, $filter, $qfield, $start, $query;
-
- if (is_array($extra))
- {
- $extra = $this->extras_to_string($extra);
- }
-
- $extravar = 'sort='.$sort.'&order='.$order.'&filter='.$filter.'&qfield='.$qfield.'&start='.$start.$extra;
- return '' . $text . '';
+ return lang('showing x',$total_records);
}
-
- function show_hits($total_records='',$start=0)
- {
- if ($total_records > $this->maxmatches)
- {
- if ($start + $this->maxmatches > $total_records)
- {
- $end = $total_records;
- }
- else
- {
- $end = $start + $this->maxmatches;
- }
- return lang('showing x - x of x',($start + 1),$end,$total_records);
- }
- else
- {
- return lang('showing x',$total_records);
- }
- }
- } // End of nextmatchs class
+ }
+ }
+ // End of nextmatchs class
?>
diff --git a/phpgwapi/templates/default/nextmatchs.tpl b/phpgwapi/templates/default/nextmatchs.tpl
index ebd0cbfe4c..aca80bf0aa 100644
--- a/phpgwapi/templates/default/nextmatchs.tpl
+++ b/phpgwapi/templates/default/nextmatchs.tpl
@@ -21,18 +21,18 @@
-
-
- |
+
@@ -42,15 +42,15 @@
-
-
-
-
-
- |
-
-
- |
+
+
+
+
+
+ |
+
+
+ |