📄 chart_outcome_by_month.php
字号:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Id: Chart_outcome_by_month.php,v 1.13 2006/08/30 02:26:03 wayne Exp $
* Description: returns HTML for client-side image map.
********************************************************************************/
require_once('config.php');
require_once('modules/Opportunities/Opportunity.php');
require_once('include/charts/Charts.php');
require_once('include/utils.php');
class Chart_outcome_by_month
{
var $modules = array('Opportunities');
var $order = 0;
function Chart_outcome_by_month()
{
}
function draw($extra_tools)
{
require_once('include/utils.php');
require_once("modules/Dashboard/Forms.php");
global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $theme;
$current_module_strings = return_module_language($current_language, 'Charts');
if (isset($_REQUEST['obm_refresh'])) { $refresh = $_REQUEST['obm_refresh']; }
else { $refresh = false; }
$date_start = array();
$datax = array();
//get the dates to display
global $current_user;
$user_date_start = $current_user->getPreference('obm_date_start');
if (!empty($user_date_start) && !isset($_REQUEST['obm_date_start'])) {
$date_start =$user_date_start;
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_start'] is:");
$GLOBALS['log']->debug($user_date_start);
}
elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
$date_start = $_REQUEST['obm_year'].'-01-01';
$current_user->setPreference('obm_date_start', $date_start);
$GLOBALS['log']->debug("_REQUEST['obm_date_start'] is:");
$GLOBALS['log']->debug($_REQUEST['obm_date_start']);
$GLOBALS['log']->debug("_SESSION['obm_date_start'] is:");
$GLOBALS['log']->debug($current_user->getPreference('obm_date_start'));
}
else {
$date_start = date('Y').'-01-01';
}
$user_date_end = $current_user->getPreference('obm_date_end');
if (!empty($user_date_end) && !isset($_REQUEST['obm_date_end'])) {
$date_end =$user_date_end;
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_end'] is:");
$GLOBALS['log']->debug($date_end);
}
elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
$date_end = $_REQUEST['obm_year'].'-12-31';
$current_user->setPreference('obm_date_end', $date_end );
$GLOBALS['log']->debug("_REQUEST['obm_date_end'] is:");
$GLOBALS['log']->debug($_REQUEST['obm_date_end']);
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_end'] is:");
$GLOBALS['log']->debug($current_user->getPreference('obm_date_end'));
}
else {
$date_end = date('Y').'-12-31';
}
$ids = array();
//get list of user ids for which to display data
$user_ids = $current_user->getPreference('obm_ids');
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['obm_ids'])) {
$ids = $user_ids;
$GLOBALS['log']->debug("USER PREFERENCES['obm_ids'] is:");
$GLOBALS['log']->debug($user_ids);
}
elseif (isset($_REQUEST['obm_ids']) && count($_REQUEST['obm_ids']) > 0) {
$ids = $_REQUEST['obm_ids'];
$current_user->setPreference('obm_ids', $_REQUEST['obm_ids']);
$GLOBALS['log']->debug("_REQUEST['obm_ids'] is:");
$GLOBALS['log']->debug($_REQUEST['obm_ids']);
$GLOBALS['log']->debug("USER PREFRENCES['obm_ids'] is:");
$GLOBALS['log']->debug($current_user->getPreference('obm_ids'));
}
else {
$ids = get_user_array(false);
$ids = array_keys($ids);
}
//create unique prefix based on selected users for image files
$id_hash = '1';
if (isset($ids)) {
sort($ids);
$id_hash = crc32(implode('',$ids));
if($id_hash < 0)
{
$id_hash = $id_hash * -1;
}
}
$GLOBALS['log']->debug("ids is:");
$GLOBALS['log']->debug($ids);
$id_md5 = substr(md5($current_user->id),0,9);
// cn: format date_start|end to user's preferred
global $timedate;
$dateDisplayStart = strftime($timedate->get_user_date_format(), strtotime($date_start));
$dateDisplayEnd = strftime($timedate->get_user_date_format(), strtotime($date_end));
$seps = array("-", "/");
$dates = array($date_start, $date_end);
$dateFileNameSafe = str_replace($seps, "_", $dates);
$cache_file_name = $current_user->getUserPrivGuid()."_outcome_by_month_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
global $image_path,$app_strings;
$tools='<div align="right"><a href="index.php?module='.$currentModule.'&action='. $action .'&obm_refresh=true" class="chartToolsLink">'.get_image($image_path.'refresh','alt="Refresh" border="0" align="absmiddle"').' '.$current_module_strings['LBL_REFRESH'].'</a> <a href="javascript: toggleDisplay(\'outcome_by_month_edit\');" class="chartToolsLink">'.get_image($image_path.'edit','alt="Edit" border="0" align="absmiddle"').' '. $current_module_strings['LBL_EDIT'].'</a> '.$extra_tools.'</div>';
?>
<?php echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_YEAR_BY_OUTCOME'],$tools,false) . '</span>';?>
<?php
$cal_lang = "en";
$cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
if (empty($_SESSION['obm_ids'])) $_SESSION['obm_ids'] = "";
?>
<p>
<div id='outcome_by_month_edit' style='display: none;'>
<form name="outcome_by_month" action="index.php" method="post" >
<input type="hidden" name="module" value="<?php echo $currentModule;?>">
<input type="hidden" name="action" value="<?php echo $action;?>">
<input type="hidden" name="obm_refresh" value="true">
<input type="hidden" name="obm_date_start" value="<?php if (isset($_SESSION['obm_date_start'])) echo $_SESSION['obm_date_start']?>">
<input type="hidden" name="obm_date_end" value="<?php if (isset($_SESSION['obm_date_end'])) echo $_SESSION['obm_date_end']?>">
<table cellpadding="0" cellspacing="0" border="0" class="chartForm" align="center">
<tr>
<td valign='top' nowrap ><b><?php echo $current_module_strings['LBL_YEAR']?></b><br><span class="dateFormat"><?php echo $app_strings['NTC_YEAR_FORMAT']?></span></td>
<td valign='top' ><input class="text" name="obm_year" size='12' maxlength='10' id='obm_year' value='<?php if (isset($date_start)) echo substr($date_start,0,4)?>'> </td>
<td valign='top'><b><?php echo $current_module_strings['LBL_USERS'];?></b></td>
<td valign='top'><select name="obm_ids[]" multiple size='3'><?php echo get_select_options_with_id(get_user_array(false),$ids); ?></select></td>
<td align="right" valign="top"><input class="button" onclick="return verify_chart_data_outcome_by_month();" type="submit" title="<?php echo $app_strings['LBL_SELECT_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_SELECT_BUTTON_KEY']; ?>" value="<?php echo $app_strings['LBL_SELECT_BUTTON_LABEL']?>" /><input class="button" onClick="javascript: toggleDisplay('outcome_by_month_edit');" type="button" title="<?php echo $app_strings['LBL_CANCEL_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_CANCEL_BUTTON_KEY'];?>" value="<?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL']?>"/></td>
</tr>
</table>
</form>
</div>
</p>
<?php
// draw chart
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -