sugarwidgetfielddate.php

来自「SugarCRM5.1 开源PHP客户关系管理系统」· PHP 代码 · 共 505 行 · 第 1/2 页

PHP
505
字号
<?phpif(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');/********************************************************************************* * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc. *  * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. *  * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more * details. *  * You should have received a copy of the GNU General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. *  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. *  * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. *  * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/require_once('include/generic/SugarWidgets/SugarWidgetFielddatetime.php');class SugarWidgetFieldDate extends SugarWidgetFieldDateTime{        function & displayList($layout_def)        {            global $timedate;            // i guess qualifier and column_function are the same..            if (! empty($layout_def['column_function']))             {                $func_name = 'displayList'.$layout_def['column_function'];                if ( method_exists($this,$func_name))                {                        $display = $this->$func_name($layout_def);                        return $display;                }            }            $content = $this->displayListPlain($layout_def);    		return $content;                 }function get_date_part($date_time_value){	$date_parts=explode(' ', $date_time_value);	if (count($date_parts) == 2) {		$date=$date_parts[0];	} else {		$date=$date_time_value;	}                	return $date;}function get_db_date($days,$time) {    global $timedate;    $begin = date('Y-m-d H:i:s', time()+(86400 * $days));  //gmt date with day adjustment applied.//	$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);        if ($time=='start') {        $begin_parts = explode(' ', $begin);        $begin = $begin_parts[0] . ' 00:00:00';    }    else if ($time=='end') {        $begin_parts = explode(' ', $begin);        $begin = $begin_parts[0] . ' 23:59:59';    }     return $begin;}function get_time_part($date_time_value) {	$date_parts=explode(' ', $date_time_value);	if (count($date_parts) == 2) {		$time=$date_parts[1];	} else {		$time=$date_time_value;	}                	return $time;} function queryFilterBefore_old(&$layout_def) {  global $timedate;			return $this->_get_column_select($layout_def)."<'".PearDatabase::quote($layout_def['input_name0'])."'\n"; } function queryFilterAfter_old(&$layout_def) {  global $timedate;  		return $this->_get_column_select($layout_def).">'".PearDatabase::quote($layout_def['input_name0'])."'\n"; } function queryFilterBetween_Dates_old(&$layout_def) {  global $timedate;			return "(".$this->_get_column_select($layout_def).">='".PearDatabase::quote($layout_def['input_name0'])."' AND \n".  $this->_get_column_select($layout_def)."<='".PearDatabase::quote($layout_def['input_name1'])."')\n"; }    function queryFilterNot_Equals_str(& $layout_def) {        global $timedate;                $begin = $layout_def['input_name0'];        if ($this->reporter->db->dbType == 'oci8') {        } elseif($this->reporter->db->dbType == 'mssql') {            return "".$this->_get_column_select($layout_def)."!='".PearDatabase :: quote($begin)."'\n";        }else{            return "ISNULL(".$this->_get_column_select($layout_def).") OR \n(".$this->_get_column_select($layout_def)."!='".PearDatabase :: quote($begin)."')\n";        }    }        function queryFilterOn(& $layout_def) {        global $timedate;                $begin = $layout_def['input_name0'];            return $this->_get_column_select($layout_def)."='".PearDatabase :: quote($begin)."'\n";    }    function queryFilterBefore(& $layout_def) {        global $timedate;                $begin = $layout_def['input_name0'];            return $this->_get_column_select($layout_def)."<'".PearDatabase :: quote($begin)."'\n";    }        function queryFilterAfter(& $layout_def) {        global $timedate;        $begin = $layout_def['input_name0'];            return $this->_get_column_select($layout_def).">'".PearDatabase :: quote($begin)."'\n";    }    function queryFilterBetween_Dates(& $layout_def) {        global $timedate;                $begin = $layout_def['input_name0'];        $end = $layout_def['input_name1'];            return "(".$this->_get_column_select($layout_def).">='".PearDatabase :: quote($begin)."' AND \n".$this->_get_column_select($layout_def)."<='".PearDatabase :: quote($end)."')\n";    }    	function queryFilterTP_yesterday(& $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_today(& $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);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?