[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 3 /********************************************************************************* 4 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 5 * ("License"); You may not use this file except in compliance with the License 6 * The Original Code is: vtiger CRM Open Source 7 * The Initial Developer of the Original Code is vtiger. 8 * Portions created by vtiger are Copyright (C) vtiger. 9 * All Rights Reserved. 10 * 11 ********************************************************************************/ 12 13 // TTF Font names 14 DEFINE("FF_COURIER",'Courier New'); 15 DEFINE("FF_VERDANA",'Verdana'); 16 DEFINE("FF_TIMES",'Times New Roman'); 17 DEFINE("FF_COMIC",'Comic'); 18 DEFINE("FF_ARIAL",'Arial'); 19 DEFINE("FF_GEORGIA",'Georgia'); 20 DEFINE("FF_TREBUCHE",'Trebuc'); 21 DEFINE("FF_DEJAVUSAN",'DejaVuSans'); 22 23 // Chinese font 24 DEFINE("FF_SIMSUN",'Simsun'); 25 DEFINE("FF_CHINESE",'Chinese'); 26 DEFINE("FF_BIG5",'Big5'); 27 28 DEFINE("FF_FONT1",'Vera'); 29 30 /**This function is used to get the font name when a language code is given 31 * Param $locale - language code 32 * Return type string - font name 33 */ 34 function calculate_font_name($locale) 35 36 { 37 global $log; 38 $log->debug("Entering calculate_font_name(".$locale.") method ..."); 39 40 switch($locale) 41 { 42 case 'cn_zh': 43 $log->debug("Exiting calculate_font_name method ..."); 44 return FF_SIMSUN; 45 case 'tw_zh': 46 if(!function_exists('iconv')){ 47 echo " Unable to display traditional Chinese on the graphs.<BR>The function iconv does not exists please read more about <a href='http://us4.php.net/iconv'>iconv here</a><BR>"; 48 $log->debug("Exiting calculate_font_name method ..."); 49 return FF_DEJAVUSAN; 50 51 } 52 else 53 { 54 $log->debug("Exiting calculate_font_name method ..."); 55 return FF_CHINESE; 56 } 57 default: 58 $log->debug("Exiting calculate_font_name method ..."); 59 return FF_DEJAVUSAN; 60 } 61 62 $log->debug("Exiting calculate_font_name method ..."); 63 return FF_DEJAVUSAN; 64 } 65 66 /**This function is used to generate the n colors. 67 * Param $count - number of colors to generate 68 * Param $start - value of first color 69 * Param $step - color increment to apply 70 * Return type array - array of n colors values 71 */ 72 73 function color_generator($count = 1, $start = '33CCFF', $step = '221133') 74 { 75 global $log; 76 $log->debug("Entering color_generator(".$count.",".$start.",".$step.") method ..."); 77 // explode color strings to RGB array 78 if($start{0} == "#") $start = substr($start,1); 79 if($step{0} == "#") $step = substr($step,1); 80 // pad shorter strings with 0 81 $start = substr($start."000000",0,6); 82 $step = substr($step."000000",0,6); 83 $colors = array(hexdec(substr($start,0,2)),hexdec(substr($start,2,2)),hexdec(substr($start,4,2))); 84 $steps = array(hexdec(substr($step,0,2)),hexdec(substr($step,2,2)),hexdec(substr($step,4,2))); 85 // buils $count colours adding $step to $start 86 $result = array(); 87 for($i=1; $i<=$count; $i++){ 88 array_push($result,"#".dechex($colors[0]).dechex($colors[1]).dechex($colors[2])); 89 for($j=0; $j<3; $j++) { 90 $colors[$j] += $steps[$j]; 91 if($colors[$j] > 0xFF) $colors[$j] -= 0xFF; 92 } 93 } 94 $log->debug("Exiting color_generator method ..."); 95 return $result; 96 } 97 98 /**This function is used to define the optimum spacin for tick marks on an axis 99 * Param $max - maximum value of axis 100 * Return type array - array of 2 values major and minor spacing 101 */ 102 103 function get_tickspacing($max = 10) 104 { 105 global $log,$app_strings; 106 $log->debug("Entering get_tickspacing(".$max.") method ..."); 107 $result = array(1,1); 108 109 // normalize $max to get value between 1 and 10 110 $coef = pow(10,floor(log10($max))); 111 if($coef == 0) 112 { 113 $data=0; 114 echo "<h3>".$app_strings['NO_DATA_AVAILABLE_WITH_SPECIFIED_PERIOD']."</h3>"; 115 $log->debug("Exiting get_tickspacing method ..."); 116 return $data; 117 } 118 $normalized = $max / $coef; 119 120 if($normalized < 1.5){ 121 $result[0] = 0.2; 122 $result[1] = 0.1; 123 } 124 elseif($normalized < 5){ 125 $result[0] = 0.5; 126 $result[1] = 0.1; 127 } 128 elseif($normalized < 10){ 129 $result[0] = 1.0; 130 $result[1] = 0.5; 131 } 132 $result[0] *= $coef; 133 $result[1] *= $coef; 134 $log->debug("Exiting get_tickspacing method ..."); 135 return $result; 136 } 137 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |