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
|
||||
@abstract
|
||||
*/
|
||||
class nextmatchs
|
||||
class nextmatchs
|
||||
{
|
||||
var $maxmatches;
|
||||
var $action;
|
||||
var $template;
|
||||
|
||||
function nextmatchs()
|
||||
{
|
||||
var $maxmatches;
|
||||
var $action;
|
||||
var $template;
|
||||
global $phpgw_info, $menuaction;
|
||||
|
||||
function nextmatchs()
|
||||
{
|
||||
global $phpgw_info, $menuaction;
|
||||
|
||||
$this->template = createobject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
|
||||
$this->template->set_file(array(
|
||||
$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');
|
||||
$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']) &&
|
||||
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;
|
||||
}
|
||||
|
||||
if(isset($menuaction))
|
||||
{
|
||||
$this->action = $menuaction;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@function set_icon
|
||||
@ -73,55 +73,55 @@
|
||||
@param $img_src ?
|
||||
@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':
|
||||
$border = 2;
|
||||
break;
|
||||
default:
|
||||
$border = 0;
|
||||
break;
|
||||
}
|
||||
$border = 2;
|
||||
break;
|
||||
default:
|
||||
$border = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
$var = array(
|
||||
$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');
|
||||
}
|
||||
$this->template->set_var($var);
|
||||
return $this->template->fp('out','link');
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
@function page
|
||||
@abstract ?
|
||||
*/
|
||||
function page($extravars='')
|
||||
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;
|
||||
}
|
||||
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
|
||||
@ -131,42 +131,30 @@
|
||||
@param $link ?
|
||||
@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;
|
||||
|
||||
$hidden = '';
|
||||
while(list($var,$value) = each($extravars))
|
||||
if(((is_int($value) && $value == 0) || $value))
|
||||
{
|
||||
if(((is_int($value) && $value == 0) || $value))
|
||||
if(is_int($value))
|
||||
{
|
||||
if(is_int($value))
|
||||
{
|
||||
$param = intval($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$param = '"'.$value.'"';
|
||||
}
|
||||
$hidden .= ' <input type="hidden" name="'.$var.'" value='.$param.'>'."\n";
|
||||
$param = intval($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$param = '"'.$value.'"';
|
||||
}
|
||||
$hidden .= ' <input type="hidden" name="'.$var.'" value='.$param.'>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
switch(strtolower($phpgw_info['user']['account_lid']))
|
||||
{
|
||||
case 'seek3r':
|
||||
srand($time());
|
||||
$border = rand(1,200);
|
||||
break;
|
||||
case 'ceb':
|
||||
$border = 2;
|
||||
break;
|
||||
default:
|
||||
$border = 0;
|
||||
break;
|
||||
}
|
||||
$border = 0;
|
||||
|
||||
$var = Array(
|
||||
$var = Array(
|
||||
'align' => $align,
|
||||
'action' => ($this->action?$this->page():$phpgw->link($link)),
|
||||
'form_name' => $img,
|
||||
@ -176,9 +164,9 @@
|
||||
'border' => $border,
|
||||
'start' => $extravars['start']
|
||||
);
|
||||
$this->template->set_var($var);
|
||||
return $this->template->fp('out','form');
|
||||
}
|
||||
$this->template->set_var($var);
|
||||
return $this->template->fp('out','form');
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
@ -194,17 +182,17 @@
|
||||
@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;
|
||||
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');
|
||||
$cats = CreateObject('phpgwapi.categories');
|
||||
|
||||
$extravars = Array();
|
||||
$extravars = $this->split_extras($extravars,$extra);
|
||||
$extravars = Array();
|
||||
$extravars = $this->split_extras($extravars,$extra);
|
||||
|
||||
$var = array(
|
||||
$var = array(
|
||||
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
|
||||
'lang_category'=> lang('Category'),
|
||||
'lang_all' => lang('All'),
|
||||
@ -224,40 +212,25 @@
|
||||
'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');
|
||||
}
|
||||
$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)
|
||||
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);
|
||||
$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))
|
||||
if($extraparams[$i])
|
||||
{
|
||||
list($var,$value) = explode('=',$extraparams[$i]);
|
||||
if($var != 'menuaction')
|
||||
{
|
||||
$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
|
||||
@abstract ?
|
||||
@ -279,11 +267,11 @@
|
||||
@param $total ?
|
||||
@param $extradate ?
|
||||
*/
|
||||
function left($scriptname,$start,$total,$extradata = '')
|
||||
{
|
||||
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
|
||||
function left($scriptname,$start,$total,$extradata = '')
|
||||
{
|
||||
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
|
||||
|
||||
$extravars = Array(
|
||||
$extravars = Array(
|
||||
'order' => $order,
|
||||
'filter' => $filter,
|
||||
'q_field' => $qfield,
|
||||
@ -291,41 +279,41 @@
|
||||
'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;
|
||||
$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'));
|
||||
$extravars['start'] = ($start - $this->maxmatches);
|
||||
}
|
||||
|
||||
if ($start != 0)
|
||||
{
|
||||
// Changing the sorting order screaws up the starting number
|
||||
if (($start - $this->maxmatches) < 0)
|
||||
{
|
||||
$extravars['start'] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
$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() */
|
||||
return $ret_str;
|
||||
} /* left() */
|
||||
|
||||
/*!
|
||||
@function right
|
||||
@ -335,11 +323,11 @@
|
||||
@param $total ?
|
||||
@param $extradate ?
|
||||
*/
|
||||
function right($scriptname,$start,$total,$extradata = '')
|
||||
{
|
||||
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
|
||||
function right($scriptname,$start,$total,$extradata = '')
|
||||
{
|
||||
global $filter, $qfield, $order, $sort, $query, $phpgw_info, $phpgw;
|
||||
|
||||
$extravars = Array(
|
||||
$extravars = Array(
|
||||
'order' => $order,
|
||||
'filter' => $filter,
|
||||
'q_field' => $qfield,
|
||||
@ -347,44 +335,44 @@
|
||||
'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))
|
||||
{
|
||||
$extravars['start'] = ($start + $this->maxmatches);
|
||||
$ret_str .= $this->set_link('right','right.gif',$scriptname,lang('Next page'),$extravars);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret_str .= $this->set_icon('right','right-grey.gif',lang('Next page'));
|
||||
}
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret_str .= $this->set_icon('right','right-grey.gif',lang('Next page'));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret_str .= $this->set_icon('right','last-grey.gif',lang('Last page'));
|
||||
}
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret_str .= $this->set_icon('right','last-grey.gif',lang('Last page'));
|
||||
}
|
||||
|
||||
return $ret_str;
|
||||
} /* right() */
|
||||
return $ret_str;
|
||||
} /* right() */
|
||||
|
||||
/*!
|
||||
@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;
|
||||
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;
|
||||
|
||||
$var = array(
|
||||
$var = array(
|
||||
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
|
||||
'filter_value' => $filter,
|
||||
'qfield' => $qfield,
|
||||
@ -396,23 +384,23 @@
|
||||
'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');
|
||||
}
|
||||
|
||||
$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($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;
|
||||
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');
|
||||
$cats = CreateObject('phpgwapi.categories');
|
||||
|
||||
$var = array(
|
||||
$var = array(
|
||||
'form_action' => ($this->action?$this->page($extra):$phpgw->link($sn, $extra)),
|
||||
'lang_category'=> lang('Category'),
|
||||
'lang_all' => lang('All'),
|
||||
@ -429,37 +417,37 @@
|
||||
'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');
|
||||
}
|
||||
|
||||
$this->template->set_var($var);
|
||||
return $this->template->fp('out','cats_search_filter');
|
||||
}
|
||||
|
||||
/*!
|
||||
@function search
|
||||
@abstract ?
|
||||
@param $search_obj default 0
|
||||
*/
|
||||
function search($search_obj=0)
|
||||
{
|
||||
global $query;
|
||||
function search($search_obj=0)
|
||||
{
|
||||
global $query;
|
||||
|
||||
$_query = stripslashes($query);
|
||||
$_query = stripslashes($query);
|
||||
|
||||
// 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);
|
||||
}
|
||||
if (ereg('"',$_query))
|
||||
{
|
||||
$_query = ereg_replace('"','',$_query);
|
||||
}
|
||||
|
||||
$var = array(
|
||||
$var = array(
|
||||
'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() */
|
||||
$this->template->set_var($var);
|
||||
return $this->template->fp('out','search');
|
||||
} /* search() */
|
||||
|
||||
/*!
|
||||
@function filterobj
|
||||
@ -468,137 +456,137 @@
|
||||
@param $indxfieldname ?
|
||||
@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'));
|
||||
$index = 0;
|
||||
|
||||
$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() */
|
||||
return $filter_obj;
|
||||
} /* filterobj() */
|
||||
|
||||
/*!
|
||||
@function searchby
|
||||
@abstract ?
|
||||
@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;
|
||||
|
||||
$str = '';
|
||||
if (is_array($search_obj))
|
||||
$indexlimit = count($search_obj);
|
||||
for ($index=0; $index<$indexlimit; $index++)
|
||||
{
|
||||
$indexlimit = count($search_obj);
|
||||
for ($index=0; $index<$indexlimit; $index++)
|
||||
if ($qfield == '')
|
||||
{
|
||||
if ($qfield == '')
|
||||
{
|
||||
$qfield = $search_obj[$index][0];
|
||||
}
|
||||
|
||||
$str .= '<option value="' . $search_obj[$index][0] . '"' . ($qfield == $search_obj[$index][0]?' selected':'') . '>' . lang($search_obj[$index][1]) . '</option>';
|
||||
$qfield = $search_obj[$index][0];
|
||||
}
|
||||
$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;
|
||||
} /* searchby() */
|
||||
$str = '<select name="qfield">' . $str . '</select>' . "\n";
|
||||
}
|
||||
return $str;
|
||||
} /* searchby() */
|
||||
|
||||
/*!
|
||||
@function filter
|
||||
@abstract ?
|
||||
@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 (is_long($filter_obj))
|
||||
if ($filter_obj == 1)
|
||||
{
|
||||
if ($filter_obj == 1)
|
||||
{
|
||||
// $user_groups = $phpgw->accounts->membership($phpgw_info['user']['account_id']);
|
||||
$indexlimit = count($user_groups);
|
||||
$indexlimit = count($user_groups);
|
||||
|
||||
if ($yours)
|
||||
{
|
||||
$filter_obj = array(array('none',lang('Show all')),
|
||||
if ($yours)
|
||||
{
|
||||
$filter_obj = array(array('none',lang('Show all')),
|
||||
array('yours',lang('Only yours')),
|
||||
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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($filter_obj))
|
||||
{
|
||||
$str = '';
|
||||
|
||||
$indexlimit = count($filter_obj);
|
||||
|
||||
else
|
||||
{
|
||||
$filter_obj = array(array('none',lang('Show all')),
|
||||
array('private',lang('private')));
|
||||
}
|
||||
for ($index=0; $index<$indexlimit; $index++)
|
||||
{
|
||||
if ($filter == '')
|
||||
{
|
||||
$filter = $filter_obj[$index][0];
|
||||
}
|
||||
$filter_obj[2+$index][0] = $user_groups[$index]['account_id'];
|
||||
$filter_obj[2+$index][1] = 'Group - ' . $user_groups[$index]['account_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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>';
|
||||
$this->template->set_var('select',$str);
|
||||
$this->template->set_var('lang_filter',lang('Filter'));
|
||||
$str .= ' <option value="' . $filter_obj[$index][0] . '"'.($filter == $filter_obj[$index][0]?' selected':'') . '>' . $filter_obj[$index][1] . '</option>'."\n";
|
||||
}
|
||||
|
||||
return $this->template->fp('out','filter');
|
||||
} /* filter() */
|
||||
$str = ' <select name="filter" onChange="this.form.submit()">'."\n" . $str . ' </select>';
|
||||
$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
|
||||
@abstract alternate row colour
|
||||
@param $currentcolor default ''
|
||||
*/
|
||||
function alternate_row_color($currentcolor = '')
|
||||
function alternate_row_color($currentcolor = '')
|
||||
{
|
||||
global $phpgw_info;
|
||||
|
||||
if (! $currentcolor)
|
||||
{
|
||||
global $phpgw_info;
|
||||
|
||||
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;
|
||||
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 you are using the common bgcolor="{tr_color}"
|
||||
// This function is a little cleanier approch
|
||||
/*!
|
||||
@ -606,10 +594,10 @@
|
||||
@abstract ?
|
||||
@param $tpl ?
|
||||
*/
|
||||
function template_alternate_row_color(&$tpl)
|
||||
{
|
||||
$tpl->set_var('tr_color',$this->alternate_row_color());
|
||||
}
|
||||
function template_alternate_row_color(&$tpl)
|
||||
{
|
||||
$tpl->set_var('tr_color',$this->alternate_row_color());
|
||||
}
|
||||
|
||||
/*!
|
||||
@function show_sort_order
|
||||
@ -621,63 +609,63 @@
|
||||
@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($sort,$var,$order,$program,$text,$extra='',$build_a_href=True)
|
||||
{
|
||||
global $phpgw, $filter, $qfield, $start, $query;
|
||||
|
||||
if (($order == $var) && ($sort == 'ASC'))
|
||||
{
|
||||
$sort = 'DESC';
|
||||
}
|
||||
else if (($order == $var) && ($sort == 'DESC'))
|
||||
if (($order == $var) && ($sort == 'ASC'))
|
||||
{
|
||||
$sort = 'DESC';
|
||||
}
|
||||
else if (($order == $var) && ($sort == 'DESC'))
|
||||
{
|
||||
$sort = 'ASC';
|
||||
}
|
||||
else
|
||||
{
|
||||
$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
|
||||
{
|
||||
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;
|
||||
|
||||
$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>';
|
||||
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
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user