00001 <?PHP 00017 include_once("InputElement.php"); 00018 00027 class InputDateRangePicker extends InputText { 00028 00029 00030 public function getSearchRule(){ 00031 $value = BizSystem::clientProxy()->getFormInputs($this->m_Name); 00032 $field = $this->m_FieldName; 00033 00034 $dates = explode("-", $value); 00035 $date_start = str_replace("/","-",trim($dates[0]))." 00:00:00"; 00036 00037 if(count($dates)==2){ 00038 $date_end = str_replace("/","-",trim($dates[1]))." 23:59:59"; 00039 }else{ 00040 $date_end = str_replace("/","-",trim($dates[0]))." 23:59:59"; 00041 } 00042 $searchRule = "([$field] >'$date_start' AND [$field]<'$date_end')"; 00043 return $searchRule; 00044 } 00050 public function render() { 00051 $this->m_cssClass=null; 00052 $this->m_cssErrorClass = null; 00053 $this->m_cssHoverClass = null; 00054 00055 if($this->m_Value!=null){ 00056 $value = $this->m_Value; 00057 }else{ 00058 $value = $this->getText(); 00059 } 00060 00061 if($value==""){ 00062 $value = $this->getDefaultValue(); 00063 } 00064 $events = $this->getEvents(); 00065 00066 $event_onchange = $events['onchange']; 00067 00068 $sHTML = "<div class=\"input_daterangepicker\"> 00069 <div class=\"ui-daterangepicker-arrows\"> 00070 00071 <a href=\"#\" class=\"ui-daterangepicker-prev\" title=\"Prev\"><span class=\"ui-daterangepicker-prev\"></span></a> 00072 <a href=\"#\" class=\"ui-daterangepicker-next\" title=\"Next\"><span class=\"ui-daterangepicker-next\"></span></a> 00073 00074 <a class=\"ui-daterangepicker-inputbar\"> 00075 <INPUT NAME=\"" . $this->m_Name . "\" ID=\"" . $this->m_Name ."\" VALUE=\"" . $value . "\" class=\"ui-rangepicker-input ui-widget-content\" style=\"border:none\" /> 00076 </a> 00077 </div> 00078 "; 00079 00080 $sHTML .= " 00081 <script> 00082 //alert(\$j('#".$this->m_Name."').id); 00083 \$j('#".$this->m_Name."').daterangepicker( 00084 { arrows:true, 00085 onChange:function(){ 00086 $event_onchange 00087 } 00088 }); 00089 </script> 00090 </div> 00091 "; 00092 return $sHTML; 00093 } 00094 00095 } 00096 00097 ?>