mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:05:16 +01:00
removed hoax
This commit is contained in:
parent
2d6ad81655
commit
f5166ce4d1
@ -26,45 +26,45 @@
|
|||||||
@class nextmatchs
|
@class nextmatchs
|
||||||
@abstract
|
@abstract
|
||||||
*/
|
*/
|
||||||
class nextmatchs
|
class nextmatchs
|
||||||
|
{
|
||||||
|
var $maxmatches;
|
||||||
|
var $action;
|
||||||
|
var $template;
|
||||||
|
|
||||||
|
function nextmatchs()
|
||||||
{
|
{
|
||||||
var $maxmatches;
|
global $phpgw_info, $menuaction;
|
||||||
var $action;
|
|
||||||
var $template;
|
|
||||||
|
|
||||||
function nextmatchs()
|
$this->template = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
|
||||||
{
|
$this->template->set_file(array(
|
||||||
global $phpgw_info, $menuaction;
|
|
||||||
|
|
||||||
$this->template = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
|
|
||||||
$this->template->set_file(array(
|
|
||||||
'_nextmatchs' => 'nextmatchs.tpl'
|
'_nextmatchs' => 'nextmatchs.tpl'
|
||||||
));
|
));
|
||||||
$this->template->set_block('_nextmatchs','nextmatchs');
|
$this->template->set_block('_nextmatchs','nextmatchs');
|
||||||
$this->template->set_block('_nextmatchs','filter');
|
$this->template->set_block('_nextmatchs','filter');
|
||||||
$this->template->set_block('_nextmatchs','form');
|
$this->template->set_block('_nextmatchs','form');
|
||||||
$this->template->set_block('_nextmatchs','icon');
|
$this->template->set_block('_nextmatchs','icon');
|
||||||
$this->template->set_block('_nextmatchs','link');
|
$this->template->set_block('_nextmatchs','link');
|
||||||
$this->template->set_block('_nextmatchs','search');
|
$this->template->set_block('_nextmatchs','search');
|
||||||
$this->template->set_block('_nextmatchs','cats');
|
$this->template->set_block('_nextmatchs','cats');
|
||||||
$this->template->set_block('_nextmatchs','search_filter');
|
$this->template->set_block('_nextmatchs','search_filter');
|
||||||
$this->template->set_block('_nextmatchs','cats_search_filter');
|
$this->template->set_block('_nextmatchs','cats_search_filter');
|
||||||
|
|
||||||
if(isset($phpgw_info['user']['preferences']['common']['maxmatchs']) &&
|
if(isset($phpgw_info['user']['preferences']['common']['maxmatchs']) &&
|
||||||
intval($phpgw_info['user']['preferences']['common']['maxmatchs']) > 0)
|
intval($phpgw_info['user']['preferences']['common']['maxmatchs']) > 0)
|
||||||
{
|
{
|
||||||
$this->maxmatches = intval($phpgw_info['user']['preferences']['common']['maxmatchs']);
|
$this->maxmatches = intval($phpgw_info['user']['preferences']['common']['maxmatchs']);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->maxmatches = 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($menuaction))
|
|
||||||
{
|
|
||||||
$this->action = $menuaction;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->maxmatches = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($menuaction))
|
||||||
|
{
|
||||||
|
$this->action = $menuaction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function set_icon
|
@function set_icon
|
||||||
@ -73,55 +73,55 @@
|
|||||||
@param $img_src ?
|
@param $img_src ?
|
||||||
@param $label ?
|
@param $label ?
|
||||||
*/
|
*/
|
||||||
function set_icon($align,$img,$label)
|
function set_icon($align,$img,$label)
|
||||||
|
{
|
||||||
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
|
switch(strtolower($phpgw_info['user']['account_lid']))
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
|
||||||
|
|
||||||
switch(strtolower($phpgw_info['user']['account_lid']))
|
|
||||||
{
|
|
||||||
case 'ceb':
|
case 'ceb':
|
||||||
$border = 2;
|
$border = 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$border = 0;
|
$border = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$var = array(
|
$var = array(
|
||||||
'align' => $align,
|
'align' => $align,
|
||||||
'img' => $phpgw->common->image('phpgwapi',$img),
|
'img' => $phpgw->common->image('phpgwapi',$img),
|
||||||
'label' => lang($label),
|
'label' => lang($label),
|
||||||
'border' => $border
|
'border' => $border
|
||||||
);
|
);
|
||||||
$this->template->set_var($var);
|
$this->template->set_var($var);
|
||||||
return $this->template->fp('out','link');
|
return $this->template->fp('out','link');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function page
|
@function page
|
||||||
@abstract ?
|
@abstract ?
|
||||||
*/
|
*/
|
||||||
function page($extravars='')
|
function page($extravars='')
|
||||||
|
{
|
||||||
|
global $phpgw;
|
||||||
|
|
||||||
|
if($extravars && is_string($extravars) && substr($extravars,0,1)!='&')
|
||||||
{
|
{
|
||||||
global $phpgw;
|
$extras = '&'.$extravars;
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function set_link
|
@function set_link
|
||||||
@ -131,42 +131,30 @@
|
|||||||
@param $link ?
|
@param $link ?
|
||||||
@param $extravars ?
|
@param $extravars ?
|
||||||
*/
|
*/
|
||||||
function set_link($align,$img,$link,$alt,$extravars)
|
function set_link($align,$img,$link,$alt,$extravars)
|
||||||
|
{
|
||||||
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
|
$hidden = '';
|
||||||
|
while(list($var,$value) = each($extravars))
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
if(((is_int($value) && $value == 0) || $value))
|
||||||
|
|
||||||
$hidden = '';
|
|
||||||
while(list($var,$value) = each($extravars))
|
|
||||||
{
|
{
|
||||||
if(((is_int($value) && $value == 0) || $value))
|
if(is_int($value))
|
||||||
{
|
{
|
||||||
if(is_int($value))
|
$param = intval($value);
|
||||||
{
|
|
||||||
$param = intval($value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$param = '"'.$value.'"';
|
|
||||||
}
|
|
||||||
$hidden .= ' <input type="hidden" name="'.$var.'" value='.$param.'>'."\n";
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$param = '"'.$value.'"';
|
||||||
|
}
|
||||||
|
$hidden .= ' <input type="hidden" name="'.$var.'" value='.$param.'>'."\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch(strtolower($phpgw_info['user']['account_lid']))
|
$border = 0;
|
||||||
{
|
|
||||||
case 'seek3r':
|
|
||||||
srand($time());
|
|
||||||
$border = rand(1,200);
|
|
||||||
break;
|
|
||||||
case 'ceb':
|
|
||||||
$border = 2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$border = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$var = Array(
|
$var = Array(
|
||||||
'align' => $align,
|
'align' => $align,
|
||||||
'action' => ($this->action?$this->page():$phpgw->link($link)),
|
'action' => ($this->action?$this->page():$phpgw->link($link)),
|
||||||
'form_name' => $img,
|
'form_name' => $img,
|
||||||
@ -176,9 +164,9 @@
|
|||||||
'border' => $border,
|
'border' => $border,
|
||||||
'start' => $extravars['start']
|
'start' => $extravars['start']
|
||||||
);
|
);
|
||||||
$this->template->set_var($var);
|
$this->template->set_var($var);
|
||||||
return $this->template->fp('out','form');
|
return $this->template->fp('out','form');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -194,17 +182,17 @@
|
|||||||
@param $filter_obj ?
|
@param $filter_obj ?
|
||||||
@param $showsearch ?
|
@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 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;
|
global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
|
||||||
$start = $localstart;
|
$start = $localstart;
|
||||||
|
|
||||||
$cats = CreateObject('phpgwapi.categories');
|
$cats = CreateObject('phpgwapi.categories');
|
||||||
|
|
||||||
$extravars = Array();
|
$extravars = Array();
|
||||||
$extravars = $this->split_extras($extravars,$extra);
|
$extravars = $this->split_extras($extravars,$extra);
|
||||||
|
|
||||||
$var = array(
|
$var = array(
|
||||||
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
|
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
|
||||||
'lang_category'=> lang('Category'),
|
'lang_category'=> lang('Category'),
|
||||||
'lang_all' => lang('All'),
|
'lang_all' => lang('All'),
|
||||||
@ -224,40 +212,25 @@
|
|||||||
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):''),
|
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):''),
|
||||||
'right' => $this->right($sn,$start,$total,$extra)
|
'right' => $this->right($sn,$start,$total,$extra)
|
||||||
);
|
);
|
||||||
$this->template->set_var($var);
|
$this->template->set_var($var);
|
||||||
$this->template->parse('cats','cats');
|
$this->template->parse('cats','cats');
|
||||||
$this->template->parse('cats_search_filter_data','cats_search_filter');
|
$this->template->parse('cats_search_filter_data','cats_search_filter');
|
||||||
return $this->template->fp('out','nextmatchs');
|
return $this->template->fp('out','nextmatchs');
|
||||||
}
|
}
|
||||||
|
|
||||||
function split_extras($extravars,$extradata)
|
function split_extras($extravars,$extradata)
|
||||||
|
{
|
||||||
|
if($extradata)
|
||||||
{
|
{
|
||||||
if($extradata)
|
if(is_string($extradata))
|
||||||
{
|
{
|
||||||
if(is_string($extradata))
|
$extraparams = explode('&',$extradata);
|
||||||
|
$c_extraparams = count($extraparams) + 1;
|
||||||
|
for($i=0;$i<$c_extraparams;$i++)
|
||||||
{
|
{
|
||||||
$extraparams = explode('&',$extradata);
|
if($extraparams[$i])
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif(is_array($extradata))
|
|
||||||
{
|
|
||||||
while(list($var,$value) = each($extradata))
|
|
||||||
{
|
{
|
||||||
|
list($var,$value) = explode('=',$extraparams[$i]);
|
||||||
if($var != 'menuaction')
|
if($var != 'menuaction')
|
||||||
{
|
{
|
||||||
$extravars[$var] = $value;
|
$extravars[$var] = $value;
|
||||||
@ -269,8 +242,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $extravars;
|
elseif(is_array($extradata))
|
||||||
|
{
|
||||||
|
while(list($var,$value) = each($extradata))
|
||||||
|
{
|
||||||
|
if($var != 'menuaction')
|
||||||
|
{
|
||||||
|
$extravars[$var] = $value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->action = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return $extravars;
|
||||||
|
}
|
||||||
/*!
|
/*!
|
||||||
@function left
|
@function left
|
||||||
@abstract ?
|
@abstract ?
|
||||||
@ -279,11 +267,11 @@
|
|||||||
@param $total ?
|
@param $total ?
|
||||||
@param $extradate ?
|
@param $extradate ?
|
||||||
*/
|
*/
|
||||||
function left($scriptname,$start,$total,$extradata = '')
|
function left($scriptname,$start,$total,$extradata = '')
|
||||||
{
|
{
|
||||||
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
|
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
|
||||||
|
|
||||||
$extravars = Array(
|
$extravars = Array(
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'filter' => $filter,
|
'filter' => $filter,
|
||||||
'q_field' => $qfield,
|
'q_field' => $qfield,
|
||||||
@ -291,41 +279,41 @@
|
|||||||
'query' => urlencode(stripslashes($query))
|
'query' => urlencode(stripslashes($query))
|
||||||
);
|
);
|
||||||
|
|
||||||
$extravars = $this->split_extras($extravars,$extradata);
|
$extravars = $this->split_extras($extravars,$extradata);
|
||||||
|
|
||||||
$ret_str = '';
|
$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);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ret_str .= $this->set_icon('left','first-grey.gif',lang('First page'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($start != 0)
|
||||||
|
{
|
||||||
|
// Changing the sorting order screaws up the starting number
|
||||||
|
if (($start - $this->maxmatches) < 0)
|
||||||
{
|
{
|
||||||
$extravars['start'] = 0;
|
$extravars['start'] = 0;
|
||||||
$ret_str .= $this->set_link('left','first.gif',$scriptname,lang('First page'),$extravars);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret_str .= $this->set_icon('left','first-grey.gif',lang('First page'));
|
$extravars['start'] = ($start - $this->maxmatches);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($start != 0)
|
$ret_str .= $this->set_link('left','left.gif',$scriptname,lang('Previous page'),$extravars);
|
||||||
{
|
}
|
||||||
// Changing the sorting order screaws up the starting number
|
else
|
||||||
if (($start - $this->maxmatches) < 0)
|
{
|
||||||
{
|
$ret_str .= $this->set_icon('left','left-grey.gif',lang('Previous page'));
|
||||||
$extravars['start'] = 0;
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$extravars['start'] = ($start - $this->maxmatches);
|
|
||||||
}
|
|
||||||
|
|
||||||
$ret_str .= $this->set_link('left','left.gif',$scriptname,lang('Previous page'),$extravars);
|
return $ret_str;
|
||||||
}
|
} /* left() */
|
||||||
else
|
|
||||||
{
|
|
||||||
$ret_str .= $this->set_icon('left','left-grey.gif',lang('Previous page'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret_str;
|
|
||||||
} /* left() */
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function right
|
@function right
|
||||||
@ -335,11 +323,11 @@
|
|||||||
@param $total ?
|
@param $total ?
|
||||||
@param $extradate ?
|
@param $extradate ?
|
||||||
*/
|
*/
|
||||||
function right($scriptname,$start,$total,$extradata = '')
|
function right($scriptname,$start,$total,$extradata = '')
|
||||||
{
|
{
|
||||||
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
|
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
|
||||||
|
|
||||||
$extravars = Array(
|
$extravars = Array(
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'filter' => $filter,
|
'filter' => $filter,
|
||||||
'q_field' => $qfield,
|
'q_field' => $qfield,
|
||||||
@ -347,44 +335,44 @@
|
|||||||
'query' => urlencode(stripslashes($query))
|
'query' => urlencode(stripslashes($query))
|
||||||
);
|
);
|
||||||
|
|
||||||
$extravars = $this->split_extras($extravars,$extradata);
|
$extravars = $this->split_extras($extravars,$extradata);
|
||||||
|
|
||||||
$ret_str = '';
|
$ret_str = '';
|
||||||
|
|
||||||
if (($total > $this->maxmatches) && ($total > $start + $this->maxmatches))
|
if (($total > $this->maxmatches) && ($total > $start + $this->maxmatches))
|
||||||
{
|
{
|
||||||
$extravars['start'] = ($start + $this->maxmatches);
|
$extravars['start'] = ($start + $this->maxmatches);
|
||||||
$ret_str .= $this->set_link('right','right.gif',$scriptname,lang('Next page'),$extravars);
|
$ret_str .= $this->set_link('right','right.gif',$scriptname,lang('Next page'),$extravars);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret_str .= $this->set_icon('right','right-grey.gif',lang('Next page'));
|
$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);
|
$extravars['start'] = ($total - $this->maxmatches);
|
||||||
$ret_str .= $this->set_link('right','last.gif',$scriptname,lang('Last page'),$extravars);
|
$ret_str .= $this->set_link('right','last.gif',$scriptname,lang('Last page'),$extravars);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret_str .= $this->set_icon('right','last-grey.gif',lang('Last page'));
|
$ret_str .= $this->set_icon('right','last-grey.gif',lang('Last page'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret_str;
|
return $ret_str;
|
||||||
} /* right() */
|
} /* right() */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function search_filter
|
@function search_filter
|
||||||
@abstract ?
|
@abstract ?
|
||||||
@param $search_obj default 0
|
@param $search_obj default 0
|
||||||
*/
|
*/
|
||||||
function search_filter($search_obj=0,$filter_obj=1,$yours=0,$link='',$extra='')
|
function search_filter($search_obj=0,$filter_obj=1,$yours=0,$link='',$extra='')
|
||||||
{
|
{
|
||||||
global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
|
global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
|
||||||
$start = $localstart;
|
$start = $localstart;
|
||||||
|
|
||||||
$var = array(
|
$var = array(
|
||||||
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
|
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
|
||||||
'filter_value' => $filter,
|
'filter_value' => $filter,
|
||||||
'qfield' => $qfield,
|
'qfield' => $qfield,
|
||||||
@ -396,23 +384,23 @@
|
|||||||
'search' => $this->search($search_obj),
|
'search' => $this->search($search_obj),
|
||||||
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
|
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
|
||||||
);
|
);
|
||||||
$this->template->set_var($var);
|
$this->template->set_var($var);
|
||||||
return $this->template->fp('out','search_filter');
|
return $this->template->fp('out','search_filter');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function cats_search_filter
|
@function cats_search_filter
|
||||||
@abstract ?
|
@abstract ?
|
||||||
@param $search_obj default 0
|
@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='')
|
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;
|
global $filter, $qfield, $start, $order, $sort, $query, $phpgw, $phpgw_info;
|
||||||
$start = $localstart;
|
$start = $localstart;
|
||||||
|
|
||||||
$cats = CreateObject('phpgwapi.categories');
|
$cats = CreateObject('phpgwapi.categories');
|
||||||
|
|
||||||
$var = array(
|
$var = array(
|
||||||
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
|
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
|
||||||
'lang_category'=> lang('Category'),
|
'lang_category'=> lang('Category'),
|
||||||
'lang_all' => lang('All'),
|
'lang_all' => lang('All'),
|
||||||
@ -429,37 +417,37 @@
|
|||||||
'search' => $this->search($search_obj),
|
'search' => $this->search($search_obj),
|
||||||
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
|
'filter' => ($filter_obj?$this->filter($filter_obj,$yours):'')
|
||||||
);
|
);
|
||||||
$this->template->set_var($var);
|
$this->template->set_var($var);
|
||||||
return $this->template->fp('out','cats_search_filter');
|
return $this->template->fp('out','cats_search_filter');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function search
|
@function search
|
||||||
@abstract ?
|
@abstract ?
|
||||||
@param $search_obj default 0
|
@param $search_obj default 0
|
||||||
*/
|
*/
|
||||||
function search($search_obj=0)
|
function search($search_obj=0)
|
||||||
{
|
{
|
||||||
global $query;
|
global $query;
|
||||||
|
|
||||||
$_query = stripslashes($query);
|
$_query = stripslashes($query);
|
||||||
|
|
||||||
// If the place a " in there search, it will mess everything up
|
// If the place a " in there search, it will mess everything up
|
||||||
// Our only option is to remove it
|
// Our only option is to remove it
|
||||||
if (ereg('"',$_query))
|
if (ereg('"',$_query))
|
||||||
{
|
{
|
||||||
$_query = ereg_replace('"','',$_query);
|
$_query = ereg_replace('"','',$_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
$var = array(
|
$var = array(
|
||||||
'query_value' => stripslashes($_query),
|
'query_value' => stripslashes($_query),
|
||||||
'searchby' => $this->searchby($search_obj),
|
'searchby' => $this->searchby($search_obj),
|
||||||
'lang_search' => lang('Search')
|
'lang_search' => lang('Search')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->template->set_var($var);
|
$this->template->set_var($var);
|
||||||
return $this->template->fp('out','search');
|
return $this->template->fp('out','search');
|
||||||
} /* search() */
|
} /* search() */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function filterobj
|
@function filterobj
|
||||||
@ -468,137 +456,137 @@
|
|||||||
@param $indxfieldname ?
|
@param $indxfieldname ?
|
||||||
@param $strfieldname ?
|
@param $strfieldname ?
|
||||||
*/
|
*/
|
||||||
function filterobj($filtertable, $idxfieldname, $strfieldname)
|
function filterobj($filtertable, $idxfieldname, $strfieldname)
|
||||||
|
{
|
||||||
|
global $phpgw;
|
||||||
|
|
||||||
|
$filter_obj = array(array('none','show all'));
|
||||||
|
$index = 0;
|
||||||
|
|
||||||
|
$phpgw->db->query("SELECT $idxfieldname, $strfieldname from $filtertable",__LINE__,__FILE__);
|
||||||
|
while($phpgw->db->next_record())
|
||||||
{
|
{
|
||||||
global $phpgw;
|
$index++;
|
||||||
|
$filter_obj[$index][0] = $phpgw->db->f($idxfieldname);
|
||||||
|
$filter_obj[$index][1] = $phpgw->db->f($strfieldname);
|
||||||
|
}
|
||||||
|
|
||||||
$filter_obj = array(array('none','show all'));
|
return $filter_obj;
|
||||||
$index = 0;
|
} /* filterobj() */
|
||||||
|
|
||||||
$phpgw->db->query("SELECT $idxfieldname, $strfieldname from $filtertable",__LINE__,__FILE__);
|
|
||||||
while($phpgw->db->next_record())
|
|
||||||
{
|
|
||||||
$index++;
|
|
||||||
$filter_obj[$index][0] = $phpgw->db->f($idxfieldname);
|
|
||||||
$filter_obj[$index][1] = $phpgw->db->f($strfieldname);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $filter_obj;
|
|
||||||
} /* filterobj() */
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function searchby
|
@function searchby
|
||||||
@abstract ?
|
@abstract ?
|
||||||
@param $search_obj ?
|
@param $search_obj ?
|
||||||
*/
|
*/
|
||||||
function searchby($search_obj)
|
function searchby($search_obj)
|
||||||
|
{
|
||||||
|
global $qfield, $phpgw, $phpgw_info;
|
||||||
|
|
||||||
|
$str = '';
|
||||||
|
if (is_array($search_obj))
|
||||||
{
|
{
|
||||||
global $qfield, $phpgw, $phpgw_info;
|
$indexlimit = count($search_obj);
|
||||||
|
for ($index=0; $index<$indexlimit; $index++)
|
||||||
$str = '';
|
|
||||||
if (is_array($search_obj))
|
|
||||||
{
|
{
|
||||||
$indexlimit = count($search_obj);
|
if ($qfield == '')
|
||||||
for ($index=0; $index<$indexlimit; $index++)
|
|
||||||
{
|
{
|
||||||
if ($qfield == '')
|
$qfield = $search_obj[$index][0];
|
||||||
{
|
|
||||||
$qfield = $search_obj[$index][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$str .= '<option value="' . $search_obj[$index][0] . '"' . ($qfield == $search_obj[$index][0]?' selected':'') . '>' . lang($search_obj[$index][1]) . '</option>';
|
|
||||||
}
|
}
|
||||||
$str = '<select name="qfield">' . $str . '</select>' . "\n";
|
|
||||||
|
$str .= '<option value="' . $search_obj[$index][0] . '"' . ($qfield == $search_obj[$index][0]?' selected':'') . '>' . lang($search_obj[$index][1]) . '</option>';
|
||||||
}
|
}
|
||||||
return $str;
|
$str = '<select name="qfield">' . $str . '</select>' . "\n";
|
||||||
} /* searchby() */
|
}
|
||||||
|
return $str;
|
||||||
|
} /* searchby() */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function filter
|
@function filter
|
||||||
@abstract ?
|
@abstract ?
|
||||||
@param $filter_obj
|
@param $filter_obj
|
||||||
*/
|
*/
|
||||||
function filter($filter_obj,$yours=0)
|
function filter($filter_obj,$yours=0)
|
||||||
|
{
|
||||||
|
global $filter, $phpgw, $phpgw_info;
|
||||||
|
|
||||||
|
if (is_long($filter_obj))
|
||||||
{
|
{
|
||||||
global $filter, $phpgw, $phpgw_info;
|
if ($filter_obj == 1)
|
||||||
|
|
||||||
if (is_long($filter_obj))
|
|
||||||
{
|
{
|
||||||
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);
|
$indexlimit = count($user_groups);
|
||||||
|
|
||||||
if ($yours)
|
if ($yours)
|
||||||
{
|
{
|
||||||
$filter_obj = array(array('none',lang('Show all')),
|
$filter_obj = array(array('none',lang('Show all')),
|
||||||
array('yours',lang('Only yours')),
|
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')));
|
|
||||||
}
|
|
||||||
for ($index=0; $index<$indexlimit; $index++)
|
|
||||||
{
|
|
||||||
$filter_obj[2+$index][0] = $user_groups[$index]['account_id'];
|
|
||||||
$filter_obj[2+$index][1] = 'Group - ' . $user_groups[$index]['account_name'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
if (is_array($filter_obj))
|
$filter_obj = array(array('none',lang('Show all')),
|
||||||
{
|
array('private',lang('private')));
|
||||||
$str = '';
|
}
|
||||||
|
|
||||||
$indexlimit = count($filter_obj);
|
|
||||||
|
|
||||||
for ($index=0; $index<$indexlimit; $index++)
|
for ($index=0; $index<$indexlimit; $index++)
|
||||||
{
|
{
|
||||||
if ($filter == '')
|
$filter_obj[2+$index][0] = $user_groups[$index]['account_id'];
|
||||||
{
|
$filter_obj[2+$index][1] = 'Group - ' . $user_groups[$index]['account_name'];
|
||||||
$filter = $filter_obj[$index][0];
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$str .= ' <option value="' . $filter_obj[$index][0] . '"'.($filter == $filter_obj[$index][0]?' selected':'') . '>' . $filter_obj[$index][1] . '</option>'."\n";
|
if (is_array($filter_obj))
|
||||||
|
{
|
||||||
|
$str = '';
|
||||||
|
|
||||||
|
$indexlimit = count($filter_obj);
|
||||||
|
|
||||||
|
for ($index=0; $index<$indexlimit; $index++)
|
||||||
|
{
|
||||||
|
if ($filter == '')
|
||||||
|
{
|
||||||
|
$filter = $filter_obj[$index][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$str = ' <select name="filter" onChange="this.form.submit()">'."\n" . $str . ' </select>';
|
$str .= ' <option value="' . $filter_obj[$index][0] . '"'.($filter == $filter_obj[$index][0]?' selected':'') . '>' . $filter_obj[$index][1] . '</option>'."\n";
|
||||||
$this->template->set_var('select',$str);
|
|
||||||
$this->template->set_var('lang_filter',lang('Filter'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->template->fp('out','filter');
|
$str = ' <select name="filter" onChange="this.form.submit()">'."\n" . $str . ' </select>';
|
||||||
} /* filter() */
|
$this->template->set_var('select',$str);
|
||||||
|
$this->template->set_var('lang_filter',lang('Filter'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->template->fp('out','filter');
|
||||||
|
} /* filter() */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function alternate_row_color
|
@function alternate_row_color
|
||||||
@abstract alternate row colour
|
@abstract alternate row colour
|
||||||
@param $currentcolor default ''
|
@param $currentcolor default ''
|
||||||
*/
|
*/
|
||||||
function alternate_row_color($currentcolor = '')
|
function alternate_row_color($currentcolor = '')
|
||||||
|
{
|
||||||
|
global $phpgw_info;
|
||||||
|
|
||||||
|
if (! $currentcolor)
|
||||||
{
|
{
|
||||||
global $phpgw_info;
|
global $tr_color;
|
||||||
|
$currentcolor = $tr_color;
|
||||||
if (! $currentcolor)
|
|
||||||
{
|
|
||||||
global $tr_color;
|
|
||||||
$currentcolor = $tr_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($currentcolor == $phpgw_info['theme']['row_on'])
|
|
||||||
{
|
|
||||||
$tr_color = $phpgw_info['theme']['row_off'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$tr_color = $phpgw_info['theme']['row_on'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tr_color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($currentcolor == $phpgw_info['theme']['row_on'])
|
||||||
|
{
|
||||||
|
$tr_color = $phpgw_info['theme']['row_off'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tr_color = $phpgw_info['theme']['row_on'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tr_color;
|
||||||
|
}
|
||||||
|
|
||||||
// If you are using the common bgcolor="{tr_color}"
|
// If you are using the common bgcolor="{tr_color}"
|
||||||
// This function is a little cleanier approch
|
// This function is a little cleanier approch
|
||||||
/*!
|
/*!
|
||||||
@ -606,10 +594,10 @@
|
|||||||
@abstract ?
|
@abstract ?
|
||||||
@param $tpl ?
|
@param $tpl ?
|
||||||
*/
|
*/
|
||||||
function template_alternate_row_color(&$tpl)
|
function template_alternate_row_color(&$tpl)
|
||||||
{
|
{
|
||||||
$tpl->set_var('tr_color',$this->alternate_row_color());
|
$tpl->set_var('tr_color',$this->alternate_row_color());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function show_sort_order
|
@function show_sort_order
|
||||||
@ -621,63 +609,63 @@
|
|||||||
@param $text ?
|
@param $text ?
|
||||||
@param $extra default ''
|
@param $extra default ''
|
||||||
*/
|
*/
|
||||||
function show_sort_order($sort,$var,$order,$program,$text,$extra='',$build_a_href=True)
|
function show_sort_order($sort,$var,$order,$program,$text,$extra='',$build_a_href=True)
|
||||||
{
|
{
|
||||||
global $phpgw, $filter, $qfield, $start, $query;
|
global $phpgw, $filter, $qfield, $start, $query;
|
||||||
|
|
||||||
if (($order == $var) && ($sort == 'ASC'))
|
if (($order == $var) && ($sort == 'ASC'))
|
||||||
{
|
{
|
||||||
$sort = 'DESC';
|
$sort = 'DESC';
|
||||||
}
|
}
|
||||||
else if (($order == $var) && ($sort == 'DESC'))
|
else if (($order == $var) && ($sort == 'DESC'))
|
||||||
{
|
{
|
||||||
$sort = 'ASC';
|
$sort = 'ASC';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sort = 'ASC';
|
$sort = 'ASC';
|
||||||
}
|
}
|
||||||
|
|
||||||
$extravar = 'order='.$var.'&sort='.$sort.'&filter='.$filter.'&qfield='.$qfield.'&start='.$start.'&query='.urlencode(stripslashes($query)).$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));
|
$link = ($this->action?$this->page($extravar):$phpgw->link($program,$extravar));
|
||||||
|
|
||||||
if ($build_a_href)
|
if ($build_a_href)
|
||||||
|
{
|
||||||
|
return '<a href="' . $link . '">' . $text . '</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_sort_order_imap($sort,$order,$program,$text,$extra='')
|
||||||
|
{
|
||||||
|
global $phpgw, $filter, $qfield, $start, $query;
|
||||||
|
|
||||||
|
$extravar = 'sort='.$sort.'&order='.$order.'&filter='.$filter.'&qfield='.$qfield.'&start='.$start.$extra;
|
||||||
|
return '<a href="' . ($this->action?$this->page($extravar):$phpgw->link($program,$extravar)) . '">' . $text . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_hits($total_records='',$start=0)
|
||||||
|
{
|
||||||
|
if ($total_records > $this->maxmatches)
|
||||||
|
{
|
||||||
|
if ($start + $this->maxmatches > $total_records)
|
||||||
{
|
{
|
||||||
return '<a href="' . $link . '">' . $text . '</a>';
|
$end = $total_records;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $link;
|
$end = $start + $this->maxmatches;
|
||||||
}
|
}
|
||||||
|
return lang('showing x - x of x',($start + 1),$end,$total_records);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
function show_sort_order_imap($sort,$order,$program,$text,$extra='')
|
|
||||||
{
|
{
|
||||||
global $phpgw, $filter, $qfield, $start, $query;
|
return lang('showing x',$total_records);
|
||||||
|
|
||||||
$extravar = 'sort='.$sort.'&order='.$order.'&filter='.$filter.'&qfield='.$qfield.'&start='.$start.$extra;
|
|
||||||
return '<a href="' . ($this->action?$this->page($extravar):$phpgw->link($program,$extravar)) . '">' . $text . '</a>';
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function show_hits($total_records='',$start=0)
|
} // End of nextmatchs class
|
||||||
{
|
|
||||||
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
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user