⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chart_pipeline_by_sales_stage.php

📁 用php开发的crm系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
if(empty($GLOBALS['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_pipeline_by_sales_stage.php,v 1.4.4.1 2006/01/08 04:35:45 majed Exp $
 * Description:  returns HTML for client-side image map.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/

require_once('config.php');
require_once('log4php/LoggerManager.php');
require_once('modules/Opportunities/Opportunity.php');
require_once('include/charts/Charts.php');
require_once('include/utils.php');
require_once('log4php/LoggerManager.php');

class Chart_pipeline_by_sales_stage
{
	  var $modules = array('Opportunities');

function Chart_pipeline_by_sales_stage()
{
}

function draw($extra_tools)
{

require_once('include/utils.php');
require_once('log4php/LoggerManager.php');
require_once("include/TimeDate.php");


global $action;
global $app_list_strings;
global $app_strings;
global $current_language;
global $current_user;
global $image_path;
global $currentModule;
global $sugar_config;
global $theme;

$timedate = new TimeDate();

$user_dateFormat = $timedate->get_date_format();
$current_module_strings = return_module_language($current_language, 'Charts');


if (isset($_REQUEST['pbss_refresh'])) { $refresh = $_REQUEST['pbss_refresh']; }
else { $refresh = false; }

//get the dates to display
$user_date_start = $current_user->getPreference('pbss_date_start');

if (!empty($user_date_start) && !isset($_REQUEST['pbss_date_start'])) {
	$date_start = $user_date_start;
	$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_start'] is:");
	$GLOBALS['log']->debug($user_date_start);
}
elseif (isset($_REQUEST['pbss_date_start']) && $_REQUEST['pbss_date_start'] != '') {
	$date_start = $_REQUEST['pbss_date_start'];
	$current_user->setPreference('pbss_date_start', $_REQUEST['pbss_date_start']);
	$GLOBALS['log']->debug("_REQUEST['pbss_date_start'] is:");
	$GLOBALS['log']->debug($_REQUEST['pbss_date_start']);
	$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_start'] is:");
	$GLOBALS['log']->debug($current_user->getPreference('pbss_date_start'));
}
else {
	$date_start = date($timedate->get_date_format(), time());
}
$user_date_end = $current_user->getPreference('pbss_date_end');

if (!empty($user_date_end) && !isset($_REQUEST['pbss_date_end'])) {
	$date_end = $user_date_end;
	$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] is:");
	$GLOBALS['log']->debug($user_date_end);
}
elseif (isset($_REQUEST['pbss_date_end']) && $_REQUEST['pbss_date_end'] != '') {
	$date_end = $_REQUEST['pbss_date_end'];
	$current_user->setPreference('pbss_date_end', $_REQUEST['pbss_date_end']);
	$GLOBALS['log']->debug("_REQUEST['pbss_date_end'] is:");
	$GLOBALS['log']->debug($_REQUEST['pbss_date_end']);
	$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] is:");
	$GLOBALS['log']->debug( $current_user->getPreference('pbss_date_end'));
}
else {
	$date_end = date($timedate->get_date_format(), strtotime('2010-01-01'));
	$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] not found. Using: ".$date_end);
}

// cn: format date_start|end to user's preferred
$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);
$dateXml[0]			= $timedate->swap_formats($date_start, $user_dateFormat, $timedate->dbDayFormat);
$dateXml[1]			= $timedate->swap_formats($date_end, $user_dateFormat, $timedate->dbDayFormat);

$tempx = array();
$datax = array();
$datax_selected= array();
$user_tempx = $current_user->getPreference('pbss_sales_stages');
//get list of sales stage keys to display
if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbss_sales_stages'])) {
	$tempx = $user_tempx ;
	$GLOBALS['log']->debug("USER PREFERENCES['pbss_sales_stages'] is:");
	$GLOBALS['log']->debug($user_tempx );
}
elseif (isset($_REQUEST['pbss_sales_stages']) && count($_REQUEST['pbss_sales_stages']) > 0) {
	$tempx = $_REQUEST['pbss_sales_stages'];
	$current_user->setPreference('pbss_sales_stages', $_REQUEST['pbss_sales_stages']);
	$GLOBALS['log']->debug("_REQUEST['pbss_sales_stages'] is:");
	$GLOBALS['log']->debug($_REQUEST['pbss_sales_stages']);
	$GLOBALS['log']->debug("USER PREFERENCES['pbss_sales_stages'] is:");
	$GLOBALS['log']->debug($current_user->getPreference('pbss_sales_stages'));
}

//set $datax using selected sales stage keys
if (count($tempx) > 0) {
	foreach ($tempx as $key) {
		$datax[$key] = $app_list_strings['sales_stage_dom'][$key];
		array_push($datax_selected,$key);
	}
}
else {
	$datax = $app_list_strings['sales_stage_dom'];
	$datax_selected = array_keys($app_list_strings['sales_stage_dom']);
}
$GLOBALS['log']->debug("datax is:");
$GLOBALS['log']->debug($datax);

$ids = array();
$new_ids = array();
$user_ids = $current_user->getPreference('pbss_ids');
//get list of user ids for which to display data
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbss_ids'])) {
	$ids = $user_ids;

	$GLOBALS['log']->debug("USER PREFERENCES['pbss_ids'] is:");
	$GLOBALS['log']->debug($user_ids);
}
elseif (isset($_REQUEST['pbss_ids']) && count($_REQUEST['pbss_ids']) > 0) {
	$ids = $_REQUEST['pbss_ids'];
	$current_user->setPreference('pbss_ids', $_REQUEST['pbss_ids']);
	$GLOBALS['log']->debug("_REQUEST['pbss_ids'] is:");
	$GLOBALS['log']->debug($_REQUEST['pbss_ids']);
	$GLOBALS['log']->debug("USER PREFERENCES['pbss_ids'] is:");
	$GLOBALS['log']->debug($current_user->getPreference('pbss_ids'));
}
else {
	//changed by dingjianting on 2006-6-4 for trac#13
	$ids = get_all_assigned_users_array($current_user->id);
	$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);

$cache_file_name	= $current_user->getUserPrivGuid()."_lead_source_by_outcome_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";

$GLOBALS['log']->debug("cache file name is: $cache_file_name");

$tools='<div align="right"><a href="index.php?module='.$currentModule.'&action='. $action .'&pbss_refresh=true" class="chartToolsLink">'.get_image($image_path.'refresh','alt="Refresh"  border="0" align="absmiddle"').'&nbsp;'.$current_module_strings['LBL_REFRESH'].'</a>&nbsp;&nbsp;<a href="javascript: toggleDisplay(\'pipeline_by_sales_stage_edit\');" class="chartToolsLink">'.get_image($image_path.'edit','alt="Edit"  border="0"  align="absmiddle"').'&nbsp;'. $current_module_strings['LBL_EDIT'].'</a>&nbsp;&nbsp;'.$extra_tools.'</div>';

echo get_form_header($current_module_strings['LBL_SALES_STAGE_FORM_TITLE'], $tools , false); ?>

<?php
	$cal_lang = "en";
	$cal_dateformat = $timedate->get_cal_date_format();
if (empty($_SESSION['pbss_sales_stages'])) $_SESSION['pbss_sales_stages'] = "";
if (empty($_SESSION['pbss_ids'])) $_SESSION['pbss_ids'] = "";


// set populate values
$puser_date_start = $current_user->getPreference('user_date_start');

?>
<p>
	<div id='pipeline_by_sales_stage_edit' style='display: none;'>
<form name='pipeline_by_sales_stage' 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="pbss_refresh" value="true">
<table cellpadding="0" cellspacing="0" border="0" class="chartForm" align="center">
<tr>
	<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_DATE_START']?></b> <br><span class="dateFormat"><?php echo "(".$timedate->get_user_date_format().")"; ?></span></td>
	<td valign='top' ><input class="text" name="pbss_date_start" size='12' maxlength='10' id='date_start' value='<?php if (isset($date_start)) echo $date_start; ?>'>  <img src="themes/<?php echo $theme ?>/images/jscalendar.gif" alt="<?php echo $app_strings['LBL_ENTER_DATE']; ?>"  id="date_start_trigger" align="absmiddle"> </td>
</tr>
<tr>
	<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_DATE_END'];?></b><br><span class="dateFormat"><?php echo "(".$timedate->get_user_date_format().")"; ?></span></td>

⌨️ 快捷键说明

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