sugarwidgetfielddate.php
来自「SugarCRM5.1 开源PHP客户关系管理系统」· PHP 代码 · 共 505 行 · 第 1/2 页
PHP
505 行
$begin_parts = explode(' ', $begin); $begin = $begin_parts[0] . ' 00:00:00'; $end = $begin_parts[0] . ' 23:59:59'; return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_tomorrow(& $layout_def) { global $timedate, $current_user; $begin_timestamp = time() + 86400; $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $begin = $begin_parts[0] . ' 00:00:00'; $end = $begin_parts[0] . ' 23:59:59'; return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_last_7_days(& $layout_def) { global $timedate, $current_user; $begin_timestamp = time() - (6 * 86400); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $end_timestamp = time(); $end = gmdate('Y-m-d H:i:s', $end_timestamp); $end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $begin = $begin_parts[0] . ' 00:00:00'; $end_parts = explode(' ', $end); $end = $end_parts[0] . ' 23:59:59'; return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_next_7_days(& $layout_def) { global $timedate, $current_user; $begin_timestamp = time(); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $end_timestamp = time() + (86400*6); $end = gmdate('Y-m-d H:i:s', $end_timestamp); $end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $begin = $begin_parts[0] . ' 00:00:00'; $end_parts = explode(' ', $end); $end = $end_parts[0] . ' 23:59:59'; return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_last_month(& $layout_def) { global $timedate; $begin_timestamp = time(); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $curr_date = explode('-',$begin_parts[0]); //Get year and month from time stamp. $curr_year=$curr_date[0]; $curr_month=$curr_date[1]; //get start date for last month and convert it to gmt and db format. $begin=date('Y-m-d H:i:s',strtotime("-1 month",mktime(0,0,0,$curr_month,1,$curr_year))); //get end date for last month and convert it to gmt and db format. $end=date('Y-m-d H:i:s',strtotime("-1 day",mktime(23,59,59,$curr_month,1,$curr_year))); return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_this_month(& $layout_def) { global $timedate; $begin_timestamp = time(); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $curr_date = explode('-',$begin_parts[0]); //Get year and month from time stamp. $curr_year=$curr_date[0]; $curr_month=$curr_date[1]; //get start date for this month and convert it to gmt and db format. $begin=date('Y-m-d H:i:s',mktime(0,0,0,$curr_month,1,$curr_year)); //get end date for this month and convert it to gmt and db format. //first get the first day of next month and move back by one day. if ($curr_month==12) { $curr_month=1; $curr_year+=1; } else { $curr_month+=1; } $end=date('Y-m-d H:i:s',strtotime("-1 day",mktime(23,59,59,$curr_month,1,$curr_year))); return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_next_month(& $layout_def) { global $timedate; $begin_timestamp = time(); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $curr_date = explode('-',$begin_parts[0]); //Get year and month from time stamp. $curr_year=$curr_date[0]; $curr_month=$curr_date[1]; if ($curr_month==12) { $curr_month=1; $curr_year+=1; } else { $curr_month+=1; } //get start date for next month and convert it to gmt and db format. $begin=date('Y-m-d H:i:s',mktime(0,0,0,$curr_month,1,$curr_year)); $end=date('Y-m-d H:i:s',strtotime("-1 day",(strtotime("1 month",mktime(23,59,59,$curr_month,1,$curr_year))))); return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_last_30_days(& $layout_def) { global $timedate; $begin_timestamp = time() - (29 * 86400); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $end_timestamp = time(); $end = gmdate('Y-m-d H:i:s', $end_timestamp); $end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $begin = $begin_parts[0] . ' 00:00:00'; $end_parts = explode(' ', $end); $end = $end_parts[0] . ' 23:59:59'; return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_next_30_days(& $layout_def) { global $timedate; $begin_timestamp = time(); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $end_timestamp = time() + (29 * 86400); $end = gmdate('Y-m-d H:i:s', $end_timestamp); $end = $timedate->handle_offset($end, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $begin = $begin_parts[0] . ' 00:00:00'; $end_parts = explode(' ', $end); $end = $end_parts[0] . ' 23:59:59'; return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_this_quarter(& $layout_def) { } function queryFilterTP_last_year(& $layout_def) { global $timedate; $begin_timestamp = time(); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $curr_date = explode('-',$begin_parts[0]); //Get year and month from time stamp. $curr_year=$curr_date[0]-1; //get start date for last year and convert it to gmt and db format. $begin=date('Y-m-d H:i:s',mktime(0,0,0,1,1,$curr_year)); //get end date for last year and convert it to gmt and db format. $end=date('Y-m-d H:i:s',mktime(23,59,59,12,31,$curr_year)); return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_this_year(& $layout_def) { global $timedate; $begin_timestamp = time(); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $curr_date = explode('-',$begin_parts[0]); //Get year and month from time stamp. $curr_year=$curr_date[0]; //get start date for this year and convert it to gmt and db format. $begin=date('Y-m-d H:i:s',mktime(0,0,0,1,1,$curr_year)); //get end date for this year and convert it to gmt and db format. $end=date('Y-m-d H:i:s',mktime(23,59,59,12,31,$curr_year)); return $this->get_start_end_date_filter($layout_def,$begin,$end); } function queryFilterTP_next_year(& $layout_def) { global $timedate; $begin_timestamp = time(); $begin = gmdate('Y-m-d H:i:s', $begin_timestamp); $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), true, $this->assigned_user); $begin_parts = explode(' ', $begin); $curr_date = explode('-',$begin_parts[0]); //Get year and month from time stamp. $curr_year=$curr_date[0]+1; //get start date for this year and convert it to gmt and db format. $begin=date('Y-m-d H:i:s',mktime(0,0,0,1,1,$curr_year)); //get end date for this year and convert it to gmt and db format. $end=date('Y-m-d H:i:s',mktime(23,59,59,12,31,$curr_year)); return $this->get_start_end_date_filter($layout_def,$begin,$end); } }?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?