<?php
    
class attr_input extends attr {


   function render_text( $crop = false ) {
	    return $this->getCurVal();
   }
   
   function getFilter( $sql_where = '' ) {
	 	
		$fname = $this->obj->obj_name . '_' . $this->attr_name;
	 	$html = '<input class="form-control form-control-sm" id="_f_'.$fname.'" name="'.$fname.'" value="'.htmlentities($_GET[$fname]).'" onkeypress="int13_filter_'.$fname.'();" onKeyUp>
	 		<script>
	 			function int13_filter_'.$fname.'() { 
	 				if (window.event.keyCode == 13 || window.event.keyCode == 9) { location.href="'._getCurl(array( $fname, 'curpage' )).'&'.$fname.'=" + $("#_f_'.$fname.'").val(); return true; }
   			}
	 		</script>';
	 		
	 	$sql = '';
	 	if ( $_GET[$fname] ) {
	 		$sql = ' AND `' . $this->attr_name . '` LIKE "%' . db_escape_string($_GET[$fname]) . '%" ';
	 	}
	 	
    	return array('html'=> $html, 'sql'=> $sql);
   }


}

?>