<?
class admin
{//DigiHex Systems\\


	function init() {
		define('HOVER',' onmouseover="row_hover(this)"');
	}


	function listbox($OBJ, $table, $data=false, $split=false) {
		global $X;

		if(!empty($split['navi']) && empty($table['bottom_center'])) $table['bottom_center']=$split['navi'];
		if(!empty($split['navi']) && !empty($split['go'])) $table['bottom_left'].='<div style="position:absolute; right:20px;">'.$split['go'].'</div>';

		if(!empty($table['bottom_left'])) $bottom.='<div class="fleft">'.$table['bottom_left'].'</div>';
		if(!empty($table['bottom_center'])) $bottom.='<div class="center">'.$table['bottom_center'].'</div>';
		if(!empty($table['bottom_right'])) $bottom.='<div class="fright">'.$table['bottom_right'].'</div>';

		if(count($X->PATH)>1) $table['top_left']=$X->FORM->button('Do góry',$X->URL->get('parent_id='.($X->PATH[count($X->PATH)-2]!==0 ? $X->PATH[count($X->PATH)-2]:'')),false,'button button_big').'&nbsp;&nbsp;'.$table['top_left'];


		if($OBJ->MULTILANG==true) {
			if(count($X->LANGS)>1) {
				foreach($X->LANGS as $L => $T) $lang_opts.='<option value="'.$L.'"'.(LANG==$L ? ' selected="selected"':'').'>'.$T.'</option>';
				$lang='<img src="'.ROOT.'/admin/images/flags/'.strtolower(LANG).'.gif" alt="" style="padding:1px; border:2px solid #fff;" />&nbsp;&nbsp;'.$X->FORM->select('lang',$lang_opts,false,false,'go(\''.$X->URL->get('lang').'&lang=\'+this.value)');
			}
		}


		if($split['split_by']>0) {
			$navi='
				<form action="" method="get" onsubmit="if(this.split_by.value==\'\' || isNaN(this.split_by.value) || this.split_by.value=='.(int)$_GET['split_by'].') { this.split_by.focus(); return false;}">
					'.$X->FORM->vars2hidden($_GET, 'page&split_by').'
					<span style="margin-left:20px;">Ilość: </span><input type="text" name="split_by" class="input" value="'.$split['split_by'].'" style="width:32px; text-align:center" maxlength="4" autocomplete="off" />
					'.$X->FORM->submit_link('<span class="ico w_yes"></span>',false,'button button_gfx_small').'
				</form>
			';
			if(!empty($table['navi_right_location'])) {
				$table[$table['navi_right_location']].=$navi;
			} else {
				$table['navi_right']=$table['navi_right'].$navi;
			}
		}


		if(empty($data)) {
			$empty_table=true;
			$data=$X->ADMIN->empty_table('brak pozycji'.($_GET['page']>1 ? ' na tej stronie':''));
		} else {
			$data=str_replace('<tr','<tr'.HOVER, $data);
		}


		if(!empty($table['sortable_table_id']) && $table['allow_sort']==true) {
			$X->JS[]=JS.'/jquery.sort/jquery.tablesort.js';
			$sort_js='<script type="text/javascript">table_sort("'.$table['sortable_table_id'].'","'.$_GET['module'].'","'.(count($X->PATH)>0 ? (int)$_GET['parent_id']:-1).'");</script>';
		}


		return '
			<div class="mainbox_border">
				<div class="mainbox">
					<div class="mainbox_header">
						<div class="mainbox_gear"></div>
						<div class="mainbox_header_navi"><h3>'.@implode(' <span class="sep">&raquo;</span> ',$X->NAVI).'</h3></div>
						<div class="mainbox_header_buttons fright">'.$lang.$table['navi_right'].'</div>
						<div class="clear"></div>
					</div>

					<div class="mainbox_content_table_wide">
						<div style="float:left; width:1px; height:32px; font-size:0px;"></div>
						<div class="mainbox_table_buttons fleft">'.$table['top_left'].'</div>
						<div class="mainbox_table_buttons fright">'.$table['top_right'].'</div>
						<div class="clr" style="padding-bottom:7px;"></div>

						<table'.(!empty($table['sortable_table_id']) ? ' id="table_'.$table['sortable_table_id'].'"':'').' class="listing">
						'.($empty_table!=true ? '
							<thead>
								<tr>
									'.$table['head'].'
								</tr>
							</thead>
						':'').'
						<tbody>
							'.$data.'
						</tbody>
						<tfoot>
							<tr>
								<td colspan="20"'.($empty_table==true ? ' class="empty"':'').'>
								<div class="tfoot'.(empty($bottom) ? ' tfoot_empty':'').'">
									'.$bottom.'
									<div class="clear"></div>
								</div>
								</td>
							</tr>
						</tfoot>
						</table>
					</div>
					'.$sort_js.'
				</div>
			</div>
		';
	}


	function tree_path(&$OBJ, $parent_col=false, $title_col='title', $cond=false) {
		global $X;
		if(empty($parent_col)) $parent_col='parent_id';
		if(empty($title_col)) $title_col='title';

		$X->PATH[]=0;
		$X->NAVI[count($X->NAVI)-1]='<a href="'.$X->URL->get('action&page&parent_id='.$starting_parent).'">'.$X->NAVI[count($X->NAVI)-1].'</a>'; //override2link

		if($X->DB->fast(' SELECT id FROM '.$OBJ->TABLE.' WHERE id="'.$_GET[$parent_col].'" '.$cond.' ')!=$_GET[$parent_col]) $X->URL->go2('parent_id='.$X->PATH[$OBJ->PARENT_DEPTH-1]);

		if(!empty($_GET[$parent_col])) $this->tree_path_navi($OBJ->TABLE, $parent_col, $title_col, $_GET[$parent_col], $cond);
		if($OBJ->PARENT_DEPTH>0 && count($X->PATH)>$OBJ->PARENT_DEPTH) $X->URL->go2('parent_id='.$X->PATH[$OBJ->PARENT_DEPTH-1]);
		if(!@in_array($_GET[$parent_col],$X->PATH)) $X->URL->go2('parent_id='.$X->PATH[$OBJ->PARENT_DEPTH-1]);
	}


	function tree_path_navi($table, $parent_col, $title_col, $starting_parent, $cond) {
		global $X;

		$dane=$X->DB->fast(' SELECT '.$parent_col.', '.$title_col.' FROM '.$table.' WHERE id="'.$starting_parent.'" '.$cond.' ');
		if(!empty($dane[$parent_col])>0) $this->tree_path_navi($table, $parent_col, $title_col, $dane[$parent_col], $cond);
		if(!empty($dane[$title_col])) $X->NAVI[]='<a href="'.$X->URL->get('action&page&parent_id='.$starting_parent).'">'.$X->STR->outt($dane[$title_col]).'</a>';
		$X->PATH[]=$starting_parent;
	}


	function sortable_col(&$table, $split, $tag) {
		global $X;

		if(empty($table['sortable_table_id'])) return false;
		if($tag=='th') {
			if($_GET['order_by']=='pozycja' && $_GET['order_dir']=='asc' && empty($split['navi']) && empty($_GET['filter'])) $table['allow_sort']=true;

			if($table['allow_sort']!=true && empty($table['table_sort_reason']) && ($_GET['order_by']!='pozycja' || $_GET['order_dir']!='asc')) $table['table_sort_reason']='Aby zmienić kolejność, lista musi być posortwana po tej kolumnie';
			if($table['allow_sort']!=true && empty($table['table_sort_reason']) && (!empty($split['navi']))) $table['table_sort_reason']='Aby zmienić kolejność, wszystkie rekordy muszą być na jednej stronie';
			if($table['allow_sort']!=true && empty($table['table_sort_reason']) && (!empty($_GET['filter']))) $table['table_sort_reason']='Nie można sortować podczas filtrowania';
		}


		if(!empty($table['sortable_table_id']) && $table['allow_sort']==true) {
			return '<'.$tag.' class="drag2sort"><i></i></'.$tag.'>';
		} else {
			if($tag=='th') {
				return '<'.$tag.' class="drag2sort"><a href="'.$X->URL->get('order_by=pozycja&order_dir=asc').'"><span class="ico b_warn" '.$X->FORM->tip($table['table_sort_reason'],true,-8).'></span></a></'.$tag.'>';
			} else {
				return '<'.$tag.' class="drag2sort_dis"><i></i></'.$tag.'>';
			}
		}
	}


	function head_col($title, $col=false, $width=false, $class=false, $tip=false, $colspan=false) {
		global $X;

		if($col==$_GET['order_by']) {
			if($_GET['order_dir']=='asc') {
				$order_dir='order_dir=desc';
				$arrow='<span class="ico b_up3 sort_arrow"></span>';
			} else {
				$order_dir='order_dir=asc';
				$arrow='<span class="ico b_down3 sort_arrow"></span>';
			}

			$class=trim($class.' sel');
		} else {
			$order_dir='order_by='.$col.'&order_dir=asc';
		}

		if(empty($col)) {
			$label=$title.$arrow;
		} else {
			$label='<a href="'.$X->URL->get($order_dir).'">'.$title.'</a>'.$arrow;
		}

		return '<th'.(!empty($class) ? ' class="'.$class.'"':'').(!empty($width) ? ' width="'.$width.'"':'').(!empty($colspan) ? ' colspan="'.$colspan.'"':'').(!empty($tip) ? ' '.$X->FORM->tip($tip,true):'').'>'.$label.'</th>';
	}


	function batch_col($tag, $param=false) {
		if($tag=='th') {
			if(empty($param)) $param=16;
			return '<th width="'.$param.'" class="center"><input type="checkbox" class="checkbox del_on_list_main" id="del_on_list_sel_all" /></th>';
		} else {
			return '<td class="center"><input type="checkbox" class="del_on_list" name="del[]" value="'.$param.'" /></td>';
		}
	}



	function go_parent($link, $title, $subs=0, $parent_depth=0, $disabled=false, $special=false) {
		global $X;

		if($parent_depth==0 || count($X->PATH)>=$parent_depth) {
			return $title;
		} else {
			if($disabled==false) {
				return '<a class="exp_link'.($special==true ? ' special':'').'" href="'.$X->URL->get($link).'"><span'.($subs==0 ? ' class="empty"':'').'></span>'.$title.'</a>';
			} else {
				return '<span class="exp_link'.($special==true ? ' special':'').'"><span class="'.($special==true ? 'special':'disabled').'"></span>'.$title.'</span>';
			}
		}
	}


	function text_filter(&$OBJ, $col, $label, $operator=false) {
		$_GET['filter']=trim($_GET['filter']);
		if(empty($operator)) $operator='%LIKE%';

		switch($operator) {
			case '=':
			case '>':
			case '>=':
			case '<':
			case '<=':		$OBJ->FILTER_FIELDS[] = array('text', $col.$operator.'"'.str_replace('%','',$_GET['filter']).'"'); 	break;
			case '%LIKE':	$OBJ->FILTER_FIELDS[] = array('text', $col.' LIKE "%'.str_replace('%','',$_GET['filter']).'"'); 		break;
			case 'LIKE%':	$OBJ->FILTER_FIELDS[] = array('text', $col.' LIKE "'.str_replace('%','',$_GET['filter']).'%"'); 		break;
			case '%LIKE%':	$OBJ->FILTER_FIELDS[] = array('text', $col.' LIKE "%'.str_replace('%','',$_GET['filter']).'%"');		break;
		}
		$OBJ->FILTER_LABEL[]=$label;
		$OBJ->FILTER_SKIP_GET_VAR[]='filter_'.$col;
	}


	function checkbox_filter(&$OBJ, $col, $label, $value, $tip=false, $skip_OC=false) {
		global $X;
		$_GET['filter']=trim($_GET['filter']);
		if($OBJ->FILTER_CURRENT_LINE==0) $OBJ->FILTER_CURRENT_LINE=1;

		if($_GET['filter_'.$col]==$value) $OBJ->FILTER_FIELDS[] = array('checkbox', $col.'="'.$value.'"');
		$OBJ->FILTER_SKIP_GET_VAR[]='filter_'.$col;
		$OBJ->FILTER_ADDITIONAL_CONTROLS[$OBJ->FILTER_CURRENT_LINE].='<div style="display:inline-block; margin:0px 0px 0px 17px" '.$X->FORM->tip($tip,true).'><label for="filter_'.$col.'">'.$X->STR->out($label).'</label><input type="checkbox" class="checkbox" value="'.$value.'" id="filter_'.$col.'" name="filter_'.$col.'" '.(!empty($_GET['filter_'.$col]) ? ' checked="checked"':'').($skip_OC!=true ? ' onchange="$(this).closest(\'form\').submit()"':'').' /></div>';
	}


	function select_filter(&$OBJ, $col, $label, $value, $tip=false, $skip_OC=false, $width=false, $custom_cond=false) {
		global $X;
		$_GET['filter']=trim($_GET['filter']);
		if($OBJ->FILTER_CURRENT_LINE==0) $OBJ->FILTER_CURRENT_LINE=1;

		$OBJ->FILTER_SKIP_GET_VAR[]='filter_'.$col;
		if(count($value)>0) foreach($value as $V => $L) {
			$sel=(strlen($_GET['filter_'.$col])==0 ? $_GET['filter_'.$col]===$V : $_GET['filter_'.$col]==$V);
			$options.='<option value="'.$V.'"'.($sel==true ? ' selected="selected"':'').'>'.$L.'</option>';
			if($sel==true && strlen($_GET['filter_'.$col])>0) {
				if(!empty($custom_cond)) {
//					$OBJ->FILTER_FIELDS[] = array('select', $col.'="'.$V.'"');
					$OBJ->FILTER_FIELDS[] = array('select', $custom_cond);
				} else {
					$OBJ->FILTER_FIELDS[] = array('select', $col.'="'.$V.'"');
				}
			}
		}
		$OBJ->FILTER_ADDITIONAL_CONTROLS[$OBJ->FILTER_CURRENT_LINE].='<div style="display:inline-block; margin:0px 0px 0px 17px" '.$X->FORM->tip($tip,true).'><label for="filter_'.$col.'">'.$X->STR->out($label).'&nbsp;&nbsp;</label><select name="filter_'.$col.'" id="filter_'.$col.'"'.(!empty($width) ? ' style="width:'.$width.'px"':'').($skip_OC!=true ? ' onchange="$(this).closest(\'form\').submit()"':'').'>'.$options.'</select></div>';
	}


	function straight_select_filter(&$OBJ, $col, $label, $options, $tip=false, $skip_OC=false, $width=false) {
		global $X;
		$_GET['filter']=trim($_GET['filter']);
		if($OBJ->FILTER_CURRENT_LINE==0) $OBJ->FILTER_CURRENT_LINE=1;

		$OBJ->FILTER_SKIP_GET_VAR[]='filter_'.$col;
		$options.='<option value="'.$V.'"'.($sel==true ? ' selected="selected"':'').'>'.$L.'</option>';
		if(strlen($_GET['filter_'.$col])>0) $OBJ->FILTER_FIELDS[] = array('select', $col.'="'.$_GET['filter_'.$col].'"');

		$OBJ->FILTER_ADDITIONAL_CONTROLS[$OBJ->FILTER_CURRENT_LINE].='<div style="display:inline-block; margin:0px 0px 0px 17px" '.$X->FORM->tip($tip,true).'><label for="filter_'.$col.'">'.$X->STR->out($label).'&nbsp;&nbsp;</label><select name="filter_'.$col.'" id="filter_'.$col.'"'.(!empty($width) ? ' style="width:'.$width.'px"':'').($skip_OC!=true ? ' onchange="$(this).closest(\'form\').submit()"':'').'>'.$options.'</select></div>';
	}


	function date_filter(&$OBJ, $col, $label, $operator=false, $tip=false, $custom_col=false) {
		global $X;
		$_GET['filter']=trim($_GET['filter']);
		if($OBJ->FILTER_CURRENT_LINE==0) $OBJ->FILTER_CURRENT_LINE=1;
		if(empty($operator)) $operator='=';

		if(strlen($_GET['filter_'.$col])>0) {
			$S=str_replace('%','',$_GET['filter_'.$col]);
			$sql_col=(!empty($custom_col) ? $custom_col : $col);

			switch($operator) {
				case '=':
				case '>':
				case '>=':
				case '<':
				case '<=':		$OBJ->FILTER_FIELDS[] = array('date', $sql_col.$operator.'"'.$S.'"'); 	break;
				case '%LIKE':	$OBJ->FILTER_FIELDS[] = array('date', $sql_col.' LIKE "%'.$S.'"'); 		break;
				case 'LIKE%':	$OBJ->FILTER_FIELDS[] = array('date', $sql_col.' LIKE "'.$S.'%"'); 		break;
				case '%LIKE%':	$OBJ->FILTER_FIELDS[] = array('date', $sql_col.' LIKE "%'.$S.'%"');		break;
			}
		}
		$OBJ->FILTER_SKIP_GET_VAR[]='filter_'.$col;
		$OBJ->FILTER_ADDITIONAL_CONTROLS[$OBJ->FILTER_CURRENT_LINE].='<div style="display:inline-block; margin:0px 0px 0px 17px" '.$X->FORM->tip($tip,true).'><label for="filter_'.$col.'">'.$X->STR->out($label).'&nbsp;</label>'.$X->FORM->calendar('filter_'.$col, $_GET['filter_'.$col], 'Y-m-d', false, false, false, 68).'</div>';
	}


	function dual_date_filter(&$OBJ, $col, $label, $operator=false, $tip=false) {
		global $X;
		$_GET['filter']=trim($_GET['filter']);
		if($OBJ->FILTER_CURRENT_LINE==0) $OBJ->FILTER_CURRENT_LINE=1;
		if(empty($operator)) $operator=array('>=','<=');

		if(strlen($_GET['filter_'.$col])>0) {
			$S=str_replace('%','',$_GET['filter_'.$col]);
			switch($operator[0]) {
				case '=':
				case '>':
				case '>=':
				case '<':
				case '<=':		$OBJ->FILTER_FIELDS[] = array('date', $col.$operator[0].'"'.$S.'"'); break;
				case '%LIKE':	$OBJ->FILTER_FIELDS[] = array('date', $col.' LIKE "%'.$S.'"'); 		break;
				case 'LIKE%':	$OBJ->FILTER_FIELDS[] = array('date', $col.' LIKE "'.$S.'%"'); 		break;
				case '%LIKE%':	$OBJ->FILTER_FIELDS[] = array('date', $col.' LIKE "%'.$S.'%"');		break;
			}
		}

		if(strlen($_GET['filter_'.$col.'_'.$col])>0) {
			$S=str_replace('%','',$_GET['filter_'.$col.'_'.$col]);
			switch($operator[1]) {
				case '=':
				case '>':
				case '>=':
				case '<':
				case '<=':		$OBJ->FILTER_FIELDS[] = array('date', $col.$operator[1].'"'.$S.'"'); break;
				case '%LIKE':	$OBJ->FILTER_FIELDS[] = array('date', $col.' LIKE "%'.$S.'"'); 		break;
				case 'LIKE%':	$OBJ->FILTER_FIELDS[] = array('date', $col.' LIKE "'.$S.'%"'); 		break;
				case '%LIKE%':	$OBJ->FILTER_FIELDS[] = array('date', $col.' LIKE "%'.$S.'%"');		break;
			}
		}
		$OBJ->FILTER_SKIP_GET_VAR[]='filter_'.$col;
		$OBJ->FILTER_ADDITIONAL_CONTROLS[$OBJ->FILTER_CURRENT_LINE].='<div style="display:inline-block; margin:0px 0px 0px 17px" '.$X->FORM->tip($tip,true).'><label for="filter_'.$col.'">'.$X->STR->out($label).'&nbsp;</label>'.$X->FORM->calendar('filter_'.$col, $_GET['filter_'.$col], 'Y-m-d', false, false, false, 68).'&nbsp;-'.$X->FORM->calendar('filter_'.$col.'_'.$col, $_GET['filter_'.$col.'_'.$col], 'Y-m-d', false, false, false, 68).'</div>';
	}


	function dual_filter(&$OBJ, $col, $label, $operator=false, $tip=false, $input_width=40) {
		global $X;
		$_GET['filter']=trim($_GET['filter']);
		if($OBJ->FILTER_CURRENT_LINE==0) $OBJ->FILTER_CURRENT_LINE=1;
		if(empty($operator)) $operator=array('>=','<=');

		if(strlen($_GET['filter_'.$col])>0) {
			$S=str_replace('%','',$_GET['filter_'.$col]);
			switch($operator[0]) {
				case '=':
				case '>':
				case '>=':
				case '<':
				case '<=':		$OBJ->FILTER_FIELDS[] = array('number', $col.$operator[0].'"'.$S.'"'); break;
				case '%LIKE':	$OBJ->FILTER_FIELDS[] = array('number', $col.' LIKE "%'.$S.'"'); 		break;
				case 'LIKE%':	$OBJ->FILTER_FIELDS[] = array('number', $col.' LIKE "'.$S.'%"'); 		break;
				case '%LIKE%':	$OBJ->FILTER_FIELDS[] = array('date', $col.' LIKE "%'.$S.'%"');		break;
			}
		}

		if(strlen($_GET['filter_'.$col.'_'.$col])>0) {
			$S=str_replace('%','',$_GET['filter_'.$col.'_'.$col]);
			switch($operator[1]) {
				case '=':
				case '>':
				case '>=':
				case '<':
				case '<=':		$OBJ->FILTER_FIELDS[] = array('number', $col.$operator[1].'"'.$S.'"'); break;
				case '%LIKE':	$OBJ->FILTER_FIELDS[] = array('number', $col.' LIKE "%'.$S.'"'); 		break;
				case 'LIKE%':	$OBJ->FILTER_FIELDS[] = array('number', $col.' LIKE "'.$S.'%"'); 		break;
				case '%LIKE%':	$OBJ->FILTER_FIELDS[] = array('number', $col.' LIKE "%'.$S.'%"');		break;
			}
		}
		$OBJ->FILTER_SKIP_GET_VAR[]='filter_'.$col;
		$OBJ->FILTER_ADDITIONAL_CONTROLS[$OBJ->FILTER_CURRENT_LINE].='<div style="display:inline-block; margin:0px 0px 0px 17px" '.$X->FORM->tip($tip,true).'><label for="filter_'.$col.'">'.$X->STR->out($label).'&nbsp;</label>'.$X->FORM->input_center('filter_'.$col, $input_width, $_GET['filter_'.$col]).'&nbsp;-'.$X->FORM->input_center('filter_'.$col.'_'.$col, $input_width, $_GET['filter_'.$col.'_'.$col]).'</div>';
	}


	function custom_filter(&$OBJ, $cond, $label) {
		$_GET['filter']=trim($_GET['filter']);
		$OBJ->FILTER_FIELDS[] = array('text', $cond);
		$OBJ->FILTER_LABEL[]=$label;
	}


	function filter_change_line(&$OBJ, $line) {
		$OBJ->FILTER_CURRENT_LINE=$line;
	}


	function filter_html(&$OBJ, $html) {
		global $X;
		if($OBJ->FILTER_CURRENT_LINE==0) $OBJ->FILTER_CURRENT_LINE=1;
		$OBJ->FILTER_ADDITIONAL_CONTROLS[$OBJ->FILTER_CURRENT_LINE].='<div style="display:inline-block; margin:0px 0px 0px 17px">'.$html.'</div>';
	}


	function filter_form($OBJ, &$table, $width=250, $submit_at_end=false, $extra=false) {
		global $X;
		$_GET['filter']=trim($_GET['filter']);

		if(count($OBJ->FILTER_LABEL)>0) $fields=@implode(',&nbsp; ', $OBJ->FILTER_LABEL);

		if(count($OBJ->FILTER_FIELDS)>0) {
			foreach($OBJ->FILTER_FIELDS as $F) {
				$type=$F[0];
				$f=$F[1];

				if($type=='text') {
					$text_filter_enabled=true;
					if(!empty($_GET['filter'])) $conds['text'].=' OR '.$f;
				}
				if($type=='checkbox') $conds['checkbox'].=' AND '.$f;
				if($type=='select') $conds['select'].=' AND '.$f;
				if($type=='date') $conds['date'].=' AND '.$f;
				if($type=='number') $conds['number'].=' AND '.$f;
			}

			if(!empty($conds['text'])) $OBJ->FILTER_SQL.=' AND (0 '.$conds['text'].')';
			if(!empty($conds['checkbox'])) $OBJ->FILTER_SQL.=$conds['checkbox'];
			if(!empty($conds['select'])) $OBJ->FILTER_SQL.=$conds['select'];
			if(!empty($conds['date'])) $OBJ->FILTER_SQL.=$conds['date'];
			if(!empty($conds['number'])) $OBJ->FILTER_SQL.=$conds['number'];
		}

		$OBJ->FILTER='
			<form action="index.php" method="get">
				'.$X->FORM->vars2hidden($_GET, 'strona&filter&parent_id&'.@implode('&',$OBJ->FILTER_SKIP_GET_VAR)).'
				'.($text_filter_enabled==true ? '
					<span class="ico b_search"></span>&nbsp;&nbsp;<b style="display:inline-block; height:26px;" '.$X->FORM->tip($fields,true).'>'.$X->FORM->input('filter',$width,$X->STR->get_var('filter')).'</b>'.($submit_at_end==false ? '&nbsp;'.$X->FORM->submit('Filtruj',false,'button button_small2'):'').'&nbsp;
				':'').'
				'.$extra.$OBJ->FILTER_ADDITIONAL_CONTROLS[1].($submit_at_end==true ? '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$X->FORM->submit('Filtruj',false,'button button_small2'):'').'
				'.(!empty($OBJ->FILTER_ADDITIONAL_CONTROLS[2]) ? '<div class="clr"></div><div style="padding-top:8px; margin-left:-17px;">'.$OBJ->FILTER_ADDITIONAL_CONTROLS[2].'</div>':'').'
				'.(!empty($OBJ->FILTER_ADDITIONAL_CONTROLS[3]) ? '<div class="clr"></div><div style="padding-top:8px; margin-left:-17px;">'.$OBJ->FILTER_ADDITIONAL_CONTROLS[3].'</div>':'').'
			</form>
		';
	}


	function batch_actions($split=false, $actions=false) {
		global $X;
		if($split['total']==0) return false;
		if(empty($actions) || !is_array($actions) || count($actions)==0) {
			$select=$X->FORM->hidden('batch_action','delete').'<a class="button button_small" href="#" onclick="do_batch_action(this); return false;">Usuń</a>';
		} else {
			foreach($actions as $type => $label) $options.='<option value="'.$type.'">'.$label.'</option>';
			$select='<select name="batch_action" id="batch_action"><option value="">-- Akcja --</option>'.$options.'</select>&nbsp;<a class="button button_small" href="#" onclick="do_batch_action(this); return false;">OK</a>';
		}

		return '
			<div class="abs" style="margin-left:-5px;">
				<span class="ico b_up_l" id="del_on_list_bottom_sel_all" style="cursor:pointer; margin-right:3px;"></span>
				<form id="batch_form" name="batch_form" action="'.$X->URL->get('action=batch').'" method="post">'.$select.'</form>
			</div>
		';
	}


}//DigiHex Systems\\
?>