[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 4 * ("License"); You may not use this file except in compliance with the 5 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL 6 * Software distributed under the License is distributed on an "AS IS" basis, 7 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 8 * the specific language governing rights and limitations under the License. 9 * The Original Code is: SugarCRM Open Source 10 * The Initial Developer of the Original Code is SugarCRM, Inc. 11 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; 12 * All Rights Reserved. 13 * Contributor(s): ______________________________________. 14 ********************************************************************************/ 15 /********************************************************************************* 16 * $Header$ 17 * Description: returns HTML for client-side image map. 18 ********************************************************************************/ 19 20 require_once ('include/utils/utils.php'); 21 require_once ('include/logging.php'); 22 require_once ("modules/Potentials/Charts.php"); 23 require_once ("modules/Dashboard/Forms.php"); 24 global $app_list_strings, $current_language, $tmp_dir, $currentModule, $action, $theme; 25 $current_module_strings = return_module_language($current_language, 'Dashboard'); 26 27 $log = LoggerManager::getLogger('outcome_by_month'); 28 29 if (isset($_REQUEST['obm_refresh'])) { $refresh = $_REQUEST['obm_refresh']; } 30 else { $refresh = false; } 31 32 // added for auto refresh 33 $refresh = true; 34 // 35 36 $date_start = array(); 37 $datax = array(); 38 //get the dates to display 39 if (isset($_SESSION['obm_date_start']) && $_SESSION['obm_date_start'] != '' && !isset($_REQUEST['obm_date_start'])) { 40 $date_start = $_SESSION['obm_date_start']; 41 $log->debug("_SESSION['obm_date_start'] is:"); 42 $log->debug($_SESSION['obm_date_start']); 43 } 44 elseif (isset($_REQUEST['obm_date_start']) && $_REQUEST['obm_date_start'] != '') { 45 $date_start = $_REQUEST['obm_date_start']; 46 $current_user->setPreference('obm_date_start', $_REQUEST['obm_date_start']); 47 $log->debug("_REQUEST['obm_date_start'] is:"); 48 $log->debug($_REQUEST['obm_date_start']); 49 $log->debug("_SESSION['obm_date_start'] is:"); 50 $log->debug($_SESSION['obm_date_start']); 51 } 52 else { 53 $date_start = '2000-01-01'; 54 } 55 56 if (isset($_SESSION['obm_date_end']) && $_SESSION['obm_date_end'] != '' && !isset($_REQUEST['obm_date_end'])) { 57 $date_end = $_SESSION['obm_date_end']; 58 $log->debug("_SESSION['obm_date_end'] is:"); 59 $log->debug($_SESSION['obm_date_end']); 60 } 61 elseif (isset($_REQUEST['obm_date_end']) && $_REQUEST['obm_date_end'] != '') { 62 $date_end = $_REQUEST['obm_date_end']; 63 $current_user->setPreference('obm_date_end', $_REQUEST['obm_date_end']); 64 $log->debug("_REQUEST['obm_date_end'] is:"); 65 $log->debug($_REQUEST['obm_date_end']); 66 $log->debug("_SESSION['obm_date_end'] is:"); 67 $log->debug($_SESSION['obm_date_end']); 68 } 69 else { 70 $date_end = '2100-01-01'; 71 } 72 73 $ids = array(); 74 //get list of user ids for which to display data 75 if (isset($_SESSION['obm_ids']) && count($_SESSION['obm_ids']) != 0 && !isset($_REQUEST['obm_ids'])) { 76 $ids = $_SESSION['obm_ids']; 77 $log->debug("_SESSION['obm_ids'] is:"); 78 $log->debug($_SESSION['obm_ids']); 79 } 80 elseif (isset($_REQUEST['obm_ids']) && count($_REQUEST['obm_ids']) > 0) { 81 $ids = $_REQUEST['obm_ids']; 82 $current_user->setPreference('obm_ids', $_REQUEST['obm_ids']); 83 $log->debug("_REQUEST['obm_ids'] is:"); 84 $log->debug($_REQUEST['obm_ids']); 85 $log->debug("_SESSION['obm_ids'] is:"); 86 $log->debug($_SESSION['obm_ids']); 87 } 88 else { 89 $ids = get_user_array(false); 90 $ids = array_keys($ids); 91 } 92 93 //create unique prefix based on selected vtiger_users for image vtiger_files 94 $id_hash = ''; 95 if (isset($ids)) { 96 sort($ids); 97 $id_hash = crc32(implode('',$ids)); 98 } 99 $log->debug("ids is:"); 100 $log->debug($ids); 101 102 $cache_file_name = $id_hash."_outcome_by_month_".$current_language."_".crc32($date_start.$date_end).".png"; 103 $log->debug("cache file name is: $cache_file_name"); 104 105 if(isPermitted('Potentials','index')=="yes") 106 { 107 $draw_this = new jpgraph(); 108 $width = 850; 109 $height = 500; 110 if(isset($_REQUEST['display_view']) && $_REQUEST['display_view'] == 'MATRIX') 111 { 112 $width = 350; 113 $height = 250; 114 } 115 116 echo $draw_this->outcome_by_month($date_start, $date_end, $ids, $tmp_dir.$cache_file_name, $refresh,$width,$height); 117 echo "<P><font size='1'><em>".$current_module_strings['LBL_MONTH_BY_OUTCOME_DESC']."</em></font></P>"; 118 if (isset($_REQUEST['obm_edit']) && $_REQUEST['obm_edit'] == 'true') { 119 $cal_lang = "en"; 120 $cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']); 121 $cal_dateformat = '%Y-%m-%d'; // fix providedd by Jlee for date bug in Dashboard 122 123 ?> 124 <link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css"> 125 <script type="text/javascript" src="jscalendar/calendar.js"></script> 126 <script type="text/javascript" src="jscalendar/lang/calendar-<?php echo $cal_lang ?>.js"></script> 127 <script type="text/javascript" src="jscalendar/calendar-setup.js"></script> 128 <form name="outcome_by_month" action="index.php" method="post" > 129 <input type="hidden" name="module" value="<?php echo $currentModule;?>"> 130 <input type="hidden" name="action" value="<?php echo $action;?>"> 131 <input type="hidden" name="obm_refresh" value="true"> 132 <table cellpadding="2" border="0"><tbody> 133 <tr> 134 <td valign='top' nowrap><?php echo $current_module_strings['LBL_DATE_START']?> <br><em><?php echo $app_strings['NTC_DATE_FORMAT']?></em></td> 135 <td valign='top' ><input class="text" name="obm_date_start" size='12' maxlength='10' id='date_start' value='<?php if (isset($_SESSION['obm_date_start'])) echo $_SESSION['obm_date_start']?>'> <img src="themes/<?php echo $theme ?>/images/calendar.gif" id="date_start_trigger"> </td> 136 </tr><tr> 137 <tr> 138 <td valign='top' nowrap><?php echo $current_module_strings['LBL_DATE_END'];?><br><em><?php echo $app_strings['NTC_DATE_FORMAT']?></em></td> 139 <td valign='top' ><input class="text" name="obm_date_end" size='12' maxlength='10' id='date_end' value='<?php if (isset($_SESSION['obm_date_end'])) echo $_SESSION['obm_date_end']?>'> <img src="themes/<?php echo $theme ?>/images/calendar.gif" id="date_end_trigger"> </td> 140 </tr><tr> 141 <td nowrap><?php echo $current_module_strings['LBL_USERS'];?></td> 142 <td valign='top' ><select name="obm_ids[]" multiple size='3'><?php echo get_select_options_with_id(get_user_array(false),$_SESSION['obm_ids']); ?></select></td> 143 </tr><tr> 144 <td align="right"><br /> <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']?>" /></td> 145 </tr></table> 146 </form> 147 <script type="text/javascript"> 148 Calendar.setup ({ 149 inputField : "date_start", ifFormat : "<?php echo $cal_dateformat ?>", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1 150 }); 151 Calendar.setup ({ 152 inputField : "date_end", ifFormat : "<?php echo $cal_dateformat ?>", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1 153 }); 154 </script> 155 156 <?php } 157 else { 158 if (file_exists($tmp_dir.$cache_file_name)) { 159 $file_date = getDisplayDate(date('Y-m-d H:i', filemtime($tmp_dir.$cache_file_name))); 160 } 161 else { 162 $file_date = ''; 163 } 164 ?> 165 <div align=right><FONT size='1'> 166 <em><?php echo $current_module_strings['LBL_CREATED_ON'].' '.$file_date; ?> 167 </em>[<a href="javascript:;" onClick="changeView('DashboardHome','NORMAL');"><?php echo $current_module_strings['LBL_REFRESH'];?></a>] 168 [<a href="index.php?module=<?php echo $currentModule;?>&action=index&obm_edit=true"><?php echo $current_module_strings['LBL_EDIT'];?></a>] 169 </FONT></div> 170 <?php } 171 } 172 else 173 { 174 echo $mod_strings['LBL_NO_PERMISSION']; 175 } 176 echo get_validate_chart_js(); 177 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |