📄 chart_lead_source_by_outcome.php
字号:
<?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". ********************************************************************************//********************************************************************************* * Description: returns HTML for client-side image map. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/require_once('modules/Opportunities/Opportunity.php');require_once('include/charts/Charts.php');require_once('include/utils.php');class Chart_lead_source_by_outcome{ var $modules = array('Opportunities'); var $order = 0;function Chart_lead_source_by_outcome(){}function draw($extra_tools){require_once('include/utils.php');global $app_list_strings, $current_language, $sugar_config, $currentModule, $action,$theme;$current_module_strings = return_module_language($current_language, 'Charts');if (isset($_REQUEST['lsbo_refresh'])) { $refresh = $_REQUEST['lsbo_refresh']; }else { $refresh = false; }$tempx = array();$datax = array();$selected_datax = array();//get list of sales stage keys to displayglobal $current_user;$tempx = $current_user->getPreference('lsbo_lead_sources');if (!empty($lsbo_lead_sources) && count($lsbo_lead_sources) > 0 && !isset($_REQUEST['lsbo_lead_sources'])) { $GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:"); $GLOBALS['log']->fatal($tempx);}elseif (isset($_REQUEST['lsbo_lead_sources']) && count($_REQUEST['lsbo_lead_sources']) > 0) { $tempx = $_REQUEST['lsbo_lead_sources']; $current_user->setPreference('lsbo_lead_sources', $_REQUEST['lsbo_lead_sources']); $GLOBALS['log']->fatal("_REQUEST['lsbo_lead_sources'] is:"); $GLOBALS['log']->fatal($_REQUEST['lsbo_lead_sources']); $GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:"); $GLOBALS['log']->fatal($current_user->getPreference('lsbo_lead_sources'));}//set $datax using selected sales stage keysif (!empty($tempx) && sizeof($tempx) > 0) { foreach ($tempx as $key) { $datax[$key] = $app_list_strings['lead_source_dom'][$key]; array_push($selected_datax,$key); }}else { $datax = $app_list_strings['lead_source_dom']; $selected_datax = array_keys($app_list_strings['lead_source_dom']);}$ids =$current_user->getPreference('lsbo_ids');//get list of user ids for which to display dataif (!empty($ids) && count($ids) != 0 && !isset($_REQUEST['lsbo_ids'])) { $GLOBALS['log']->debug("_SESSION['lsbo_ids'] is:"); $GLOBALS['log']->debug($ids);}elseif (isset($_REQUEST['lsbo_ids']) && count($_REQUEST['lsbo_ids']) > 0) { $ids = $_REQUEST['lsbo_ids']; $current_user->setPreference('lsbo_ids', $_REQUEST['lsbo_ids']); $GLOBALS['log']->debug("_REQUEST['lsbo_ids'] is:"); $GLOBALS['log']->debug($_REQUEST['lsbo_ids']); $GLOBALS['log']->debug("user->getPreference('lsbo_ids') is:"); $GLOBALS['log']->debug($current_user->getPreference('lsbo_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);$seps = array("-", "/");$dates = array(date('Y-m-d'), date('Y-m-d'));$dateFileNameSafe = str_replace($seps, "_", $dates);$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");global $image_path;$tools='<div align="right"><a href="index.php?module='.$currentModule.'&action='. $action .'&lsbo_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(\'lsbo_edit\');" class="chartToolsLink">'.get_image($image_path.'edit','alt="Edit" border="0" align="absmiddle"').' '. $current_module_strings['LBL_EDIT'].'</a> '.$extra_tools.'</div>';?><?phpecho '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_LEAD_SOURCE_BY_OUTCOME'],$tools,false) . '</span>';if (empty($_SESSION['lsbo_ids'])) $_SESSION['lsbo_ids'] = "";?><p><div id='lsbo_edit' style='display: none;'><form 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="lsbo_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_LEAD_SOURCES'];?></b></td> <td valign='top'><select name="lsbo_lead_sources[]" multiple size='3'><?php echo get_select_options_with_id($app_list_strings['lead_source_dom'],$selected_datax); ?></select></td></tr><tr> <td valign='top' nowrap><b><?php echo $current_module_strings['LBL_USERS'];?></b></td> <td valign='top'><select name="lsbo_ids[]" multiple size='3'><?php echo get_select_options_with_id(get_user_array(false),$ids); ?></select></td></tr><tr><?phpglobal $app_strings;?> <td align="right" colspan="2"> <input class="button" 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('lsbo_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><?phpecho "<p align='center'>".$this->gen_xml($datax, $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,$current_module_strings)."</p>";echo "<P align='center'><span class='chartFootnote'>".$current_module_strings['LBL_LEAD_SOURCE_BY_OUTCOME_DESC']."</span></P>"; if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {global $timedate; $file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name)); } else { $file_date = ''; }?><span class='chartFootnote'><p align="right"><i><?php echo $current_module_strings['LBL_CREATED_ON'].' '.$file_date; ?></i></p></span><?php} /** * Creates lead_source_by_outcome pipeline image as a HORIZONAL accumlated bar graph for multiple users. * param $datay- the lead source data to display in the x-axis * param $ids - list of assigned users of opps to find * param $cache_file_name - file name to write image to * param $refresh - boolean whether to rebuild image if exists * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.. * All Rights Reserved.. * Contributor(s): ______________________________________.. */ function gen_xml($datay=array('foo','bar'), $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$current_module_strings) { global $app_strings, $charset, $lang, $barChartColors,$app_list_strings, $current_user; require_once('modules/Currencies/Currency.php'); $kDelim = $current_user->getPreference('num_grp_sep'); if (!file_exists($cache_file_name) || $refresh == true) { $GLOBALS['log']->debug("datay is:"); $GLOBALS['log']->debug($datay); $GLOBALS['log']->debug("user_id is: "); $GLOBALS['log']->debug($user_id); $GLOBALS['log']->debug("cache_file_name is: $cache_file_name"); $opp = new Opportunity(); $where=""; //build the where clause for the query that matches $user $count = count($user_id);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -