[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * 10 ********************************************************************************/ 11 12 function get_world_clock($image_path) { 13 global $log; 14 log->debug("Entering get_world_clock(".$image_path.") method ..."); 15 $the_clock = <<<EOQ 16 17 <style type="text/css"> 18 <!-- 19 .citystyle{ 20 position:absolute;top:0px;left:0px; 21 } 22 #theClockLayer{ 23 position:relative;height:180px;left:20px;text-align:center; 24 } 25 .handsanddotsstyle{ 26 margin-top:10px;position:absolute;top:0px;left:0px;width:2px;height:2px;font-size:2px;background-color:#000000; 27 } 28 .facestyle{ 29 margin-top:10px;position:absolute;top:0px;left:0px;width:15px;height:15px;text-align:center;font-family:arial,sans-serif;font-size:10px;color:#000000; 30 } 31 .datestyle{ 32 margin-top:20px;position:absolute;top:0px;left:0px;width:100px;text-align:center;font-family:arial,sans-serif;font-size:10px;color:#000000; 33 } 34 .ampmstyle{ 35 margin-top:23px;position:absolute;top:0px;left:0px;width:20px;text-align:center;font-family:arial,sans-serif;font-size:10px;color:#000000; 36 } 37 --> 38 </style> 39 <div id="theClockLayer"> 40 <div id="theCities" class="citystyle"> 41 <form action="" name="frmtimezone"> 42 <select id="city" name="city" onchange="lcl(this.selectedIndex,this.options[0].selected)" class="select" style="width:140;position:relative;left:-13px"> 43 <option value="0" selected>Local time</option> 44 <OPTION VALUE="4.30">Afghanistan</OPTION> 45 <OPTION VALUE="1">Algeria</OPTION> 46 <OPTION VALUE="-3">Argentina</OPTION> 47 <OPTION VALUE="9.30">Australia - Adelaide</OPTION> 48 <OPTION VALUE="8">Australia - Perth</OPTION> 49 <OPTION VALUE="10">Australia - Sydney</OPTION> 50 <OPTION VALUE="1">Austria</OPTION> 51 <OPTION VALUE="3">Bahrain</OPTION> 52 <OPTION VALUE="6">Bangladesh</OPTION> 53 <OPTION VALUE="1">Belgium</OPTION> 54 <OPTION VALUE="-4">Bolivia</OPTION> 55 <OPTION VALUE="-5">Brazil - Andes</OPTION> 56 <OPTION VALUE="-3">Brazil - East</OPTION> 57 <OPTION VALUE="-4">Brazil - West</OPTION> 58 <OPTION VALUE="2">Bulgaria</OPTION> 59 <OPTION VALUE="6.30">Burma (Myanmar)</OPTION> 60 <OPTION VALUE="-5">Chile</OPTION> 61 <OPTION VALUE="-7">Canada - Calgary</OPTION> 62 <OPTION VALUE="-3.30">Canada - Newfoundland</OPTION> 63 <OPTION VALUE="-4">Canada - Nova Scotia</OPTION> 64 <OPTION VALUE="-5">Canada - Toronto</OPTION> 65 <OPTION VALUE="-8">Canada - Vancouver</OPTION> 66 <OPTION VALUE="-6">Canada - Winnipeg</OPTION> 67 <OPTION VALUE="8">China - Mainland</OPTION> 68 <OPTION VALUE="8">China - Taiwan</OPTION> 69 <OPTION VALUE="-5">Colombia</OPTION> 70 <OPTION VALUE="-5">Cuba</OPTION> 71 <OPTION VALUE="1">Denmark</OPTION> 72 <OPTION VALUE="-5">Ecuador</OPTION> 73 <OPTION VALUE="2">Egypt</OPTION> 74 <OPTION VALUE="12">Fiji</OPTION> 75 <OPTION VALUE="2">Finland</OPTION> 76 <OPTION VALUE="1">France</OPTION> 77 <OPTION VALUE="1">Germany</OPTION> 78 <OPTION VALUE="0">Ghana</OPTION> 79 <OPTION VALUE="2">Greece</OPTION> 80 <OPTION VALUE="-3">Greenland</OPTION> 81 <OPTION VALUE="1">Hungary</OPTION> 82 <OPTION VALUE="5.30">India</OPTION> 83 <OPTION VALUE="8">Indonesia - Bali, Borneo</OPTION> 84 <OPTION VALUE="9">Indonesia - Irian Jaya</OPTION> 85 <OPTION VALUE="7">Indonesia - Sumatra, Java</OPTION> 86 <OPTION VALUE="3.30">Iran</OPTION> 87 <OPTION VALUE="3">Iraq</OPTION> 88 <OPTION VALUE="2">Israel</OPTION> 89 <OPTION VALUE="1">Italy</OPTION> 90 <OPTION VALUE="-5">Jamaica</OPTION> 91 <OPTION VALUE="9">Japan</OPTION> 92 <OPTION VALUE="3">Kenya</OPTION> 93 <OPTION VALUE="9">Korea (North & South)</OPTION> 94 <OPTION VALUE="3">Kuwait</OPTION> 95 <OPTION VALUE="1">Libya</OPTION> 96 <OPTION VALUE="8">Malaysia</OPTION> 97 <OPTION VALUE="5">Maldives</OPTION> 98 <OPTION VALUE="1">Mali</OPTION> 99 <OPTION VALUE="4">Mauritius</OPTION> 100 <OPTION VALUE="-6">Mexico</OPTION> 101 <OPTION VALUE="0">Morocco</OPTION> 102 <OPTION VALUE="5.45">Nepal</OPTION> 103 <OPTION VALUE="1">Netherlands</OPTION> 104 <OPTION VALUE="12">New Zealand</OPTION> 105 <OPTION VALUE="1">Nigeria</OPTION> 106 <OPTION VALUE="1">Norway</OPTION> 107 <OPTION VALUE="4">Oman</OPTION> 108 <OPTION VALUE="5">Pakistan</OPTION> 109 <OPTION VALUE="-5">Peru</OPTION> 110 <OPTION VALUE="8">Philippines</OPTION> 111 <OPTION VALUE="1">Poland</OPTION> 112 <OPTION VALUE="1">Portugal</OPTION> 113 <OPTION VALUE="3">Qatar</OPTION> 114 <OPTION VALUE="2">Romania</OPTION> 115 <OPTION VALUE="11">Russia - Kamchatka</OPTION> 116 <OPTION VALUE="3">Russia - Moscow</OPTION> 117 <OPTION VALUE="9">Russia - Vladivostok</OPTION> 118 <OPTION VALUE="4">Seychelles</OPTION> 119 <OPTION VALUE="3">Saudi Arabia</OPTION> 120 <OPTION VALUE="8">Singapore</OPTION> 121 <OPTION VALUE="2">South Africa</OPTION> 122 <OPTION VALUE="1">Spain</OPTION> 123 <OPTION VALUE="3">Syria</OPTION> 124 <OPTION VALUE="5.30">Sri Lanka</OPTION> 125 <OPTION VALUE="1">Sweden</OPTION> 126 <OPTION VALUE="1">Switzerland</OPTION> 127 <OPTION VALUE="7">Thailand</OPTION> 128 <OPTION VALUE="12">Tonga</OPTION> 129 <OPTION VALUE="2">Turkey</OPTION> 130 <OPTION VALUE="3">Ukraine</OPTION> 131 <OPTION VALUE="5">Uzbekistan</OPTION> 132 <OPTION VALUE="7">Vietnam</OPTION> 133 <OPTION VALUE="4">UAE</OPTION> 134 <OPTION VALUE="0">UK</OPTION> 135 <OPTION VALUE="-9">USA - Alaska</OPTION> 136 <OPTION VALUE="-9">USA - Arizona</OPTION> 137 <OPTION VALUE="-6">USA - Central</OPTION> 138 <OPTION VALUE="-5">USA - Eastern</OPTION> 139 <OPTION VALUE="-10">USA - Hawaii</OPTION> 140 <OPTION VALUE="-5">USA - Indiana East</OPTION> 141 <OPTION VALUE="-7">USA - Mountain</OPTION> 142 <OPTION VALUE="-8">USA - Pacific</OPTION> 143 <OPTION VALUE="3">Yemen</OPTION> 144 <OPTION VALUE="1">Yugoslavia</OPTION> 145 <OPTION VALUE="2">Zambia</OPTION> 146 <OPTION VALUE="2">Zimbabwe</OPTION> 147 <!-- 148 <option value="0">GMT</option> 149 <option value="1">Rome</option> 150 <option value="2">Cairo</option> 151 <option value="3">Moscow</option> 152 <option value="3.30">Tehran</option> 153 <option value="5">Karachi</option> 154 <option value="5.30">Bombay</option> 155 <option value="7">Bangkok</option> 156 <option value="8">Hong Kong</option> 157 <option value="9">Tokyo</option> 158 <option value="9.30">Darwin</option> 159 <option value="10">Sydney</option> 160 <option value="12">Fiji</option> 161 <option value="-10">Hawaii</option> 162 <option value="-8">San Francisco</option> 163 <option value="-7">Arizona</option> 164 <option value="-5">New York</option> 165 <option value="-3.30">Newfoundland</option> 166 <option value="-3">Greenland</option> 167 --> 168 </select> 169 </form> 170 </div> 171 <script type="text/javascript"> 172 <!-- World Clock (No DST, standard time only!) http://www.btinternet.com/~kurt.grigg/javascript 173 174 if (document.getElementById){ 175 176 fCol='#000000'; //face/number colour. 177 dCol='#cccccc'; //dot colour. 178 hCol='#000000'; //hours colour. 179 mCol='#000000'; //minutes colour. 180 sCol='#ff0000'; //seconds colour. 181 cCol='#000000'; //date colour. 182 aCol='#999999'; //am-pm colour. 183 bCol='#ffffff'; //select/form background colour. 184 tCol='#000000'; //select/form text colour. 185 186 //Alter nothing below! Alignments will be lost! 187 y=87; 188 xpos=60; 189 h=4; 190 m=5; 191 s=6; 192 cf=new Array(); 193 cd=new Array(); 194 ch=new Array(); 195 cm=new Array(); 196 cs=new Array(); 197 face="3 4 5 6 7 8 9 10 11 12 1 2"; 198 face=face.split(" "); 199 n=face.length; 200 e=360/n; 201 hDims=7; 202 zone=0; 203 isItLocal=true; 204 ampm=""; 205 daysInMonth=31; 206 todaysDate=""; 207 var addHours; 208 var oddMinutes; 209 var getOddMinutes; 210 var addOddMinutes; 211 plusMinus=false; 212 213 var mon=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); 214 215 document.write('<div id="theDate" class="datestyle" style="color:'+cCol+'">\!<\/div>'); 216 document.write('<div id="amOrPm" class="ampmstyle" style="color:'+aCol+'">\!<\/div>'); 217 for (i=0; i < n; i++){ 218 document.write('<div id="theFace'+i+'" class="facestyle" style="color:'+fCol+'">'+face[i]+'<\/div>'); 219 // if (i==0 || i==3 || i==6 || i==9) 220 // document.write('<div id="theFace'+i+'" class="facestyle" style="color:'+fCol+'"><img align="absmiddle" src="/crm/images/clock_face'+face[i]+'.gif"/><\/div>'); 221 // else 222 // document.write('<div id="theFace'+i+'" class="facestyle" style="color:'+fCol+'"><\/div>'); 223 cf[i]=document.getElementById("theFace"+i).style; 224 cf[i].top=y-6+30*1.4*Math.sin(i*e*Math.PI/180)+"px"; 225 cf[i].left=xpos-6+30*1.4*Math.cos(i*e*Math.PI/180)+"px"; 226 } 227 for (i=0; i < n; i++){ 228 /* 229 document.write('<div id="theDots'+i+'" class="handsanddotsstyle" style="background-color:'+dCol+'"><\/div>'); 230 cd[i]=document.getElementById("theDots"+i).style; 231 cd[i].top=y+30*Math.sin(i*e*Math.PI/180)+"px"; 232 cd[i].left=xpos+30*Math.cos(i*e*Math.PI/180)+"px"; 233 */ 234 } 235 for (i=0; i < h; i++){ 236 document.write('<div id="H'+i+'" class="handsanddotsstyle" style="background-color:'+hCol+'"><\/div>'); 237 ch[i]=document.getElementById("H"+i).style; 238 } 239 for (i=0; i < m; i++){ 240 document.write('<div id="M'+i+'" class="handsanddotsstyle" style="background-color:'+mCol+'"><\/div>'); 241 cm[i]=document.getElementById("M"+i).style; 242 } 243 for (i=0; i < s; i++){ 244 document.write('<div id="S'+i+'" class="handsanddotsstyle" style="background-color:'+sCol+'"><\/div>'); 245 cs[i]=document.getElementById("S"+i).style; 246 } 247 248 var dsp1=document.getElementById("amOrPm").style; 249 var dsp2=document.getElementById("theCities").style; 250 var dsp3=document.getElementById("theDate").style; 251 //var dsp4=document.getElementById("city").style; 252 var dsp5=document.getElementById("theClockLayer").style; 253 dsp1.top=y+"px"; 254 dsp1.left=xpos-8+"px"; 255 dsp2.top=y-80+"px"; 256 dsp2.left=xpos-55+"px"; 257 dsp3.top=y+55+"px"; 258 dsp3.left=xpos-60+"px"; 259 //dsp4.backgroundColor=bCol; 260 //dsp4.color=tCol; 261 //var currSkin="<%=skintype%>" 262 263 //var currSkin="aqua" 264 265 //dsp5.backgroundImage="url(/crm/images/"+currSkin+"/clock_bg.gif)" 266 dsp5.backgroundImage="url($image_path/clock_bg.gif)" 267 dsp5.backgroundRepeat="no-repeat" 268 dsp5.backgroundPosition="4px 38px" 269 270 function lcl(currIndex,localState){ 271 //zone=z.options[z.selectedIndex].value; 272 //isItLocal=(z.options[0].selected)?true:false; 273 zone=document.frmtimezone.city.options[currIndex].value; 274 isItLocal=localState; 275 plusMinus=(zone.charAt(0) == "-")?true:false; 276 oddMinutes=(zone.indexOf(".") != -1)?true:false; 277 if (oddMinutes){ 278 getOddMinutes=zone.substring(zone.indexOf(".")+1,zone.length) 279 } 280 281 addHours=(oddMinutes)?parseInt(zone.substring(0,zone.indexOf("."))):parseInt(zone) 282 if (plusMinus){ 283 addOddMinutes=(oddMinutes)?parseInt(-getOddMinutes):0; 284 } else{ 285 addOddMinutes=(oddMinutes)?parseInt(getOddMinutes):0; 286 } 287 288 set_cookie("timezone",currIndex) 289 } 290 291 function ClockAndAssign(){ 292 hourAdjust=0; 293 dayAdjust=0; 294 monthAdjust=0; 295 now=new Date(); 296 //ofst=now.getTimezoneOffset()/60; 297 298 secs=now.getSeconds(); 299 sec=Math.PI*(secs-15)/30; 300 301 mins=(isItLocal)?now.getMinutes():now.getUTCMinutes(); 302 if (oddMinutes){ 303 mins=eval(mins+addOddMinutes); 304 } 305 min=Math.PI*(mins-15)/30; 306 if (mins<0){ 307 mins+=60;hourAdjust=-1; 308 } 309 if (mins>59){ 310 mins-=60;hourAdjust=1; 311 } 312 313 //hr=(isItLocal)?now.getHours()+hourAdjust:(now.getHours()+parseInt(ofst))+parseInt(zone)+hourAdjust; 314 hr=(isItLocal)?now.getHours()+hourAdjust:now.getUTCHours()+addHours+hourAdjust 315 hrs=Math.PI*(hr-3)/6+Math.PI*parseInt(now.getMinutes())/360; 316 317 /* 318 if (hr<0){ 319 hr+=24; 320 dayAdjust=-1; 321 } 322 if (hr>23){ 323 hr-=24; 324 dayAdjust=1; 325 } 326 */ 327 328 if (!isItLocal){ 329 if (addHours<0){ 330 if(now.getUTCHours()+parseInt(addHours)<0) 331 dayAdjust-=1 332 } else{ 333 if(now.getUTCHours()+parseInt(addHours)>23) 334 dayAdjust+=1 335 } 336 } 337 338 day=now.getDate()+dayAdjust; 339 340 if (day<1){ 341 day+=daysInMonth; 342 monthAdjust=-1; 343 } 344 if (day>daysInMonth){ 345 day-=daysInMonth; 346 monthAdjust=1; 347 } 348 349 month=parseInt(now.getMonth()+1+monthAdjust); 350 351 if (month==2){ 352 daysInMonth=28; 353 } 354 year=now.getYear(); 355 if (year<2000){ 356 year=year+1900; 357 } 358 leap_year=(eval(year%4)==0)?true:false; 359 if (leap_year&&month==2){ 360 daysInMonth=29; 361 } 362 if (month<1){ 363 month+=12; 364 year--; 365 } 366 if (month>12){ 367 month-=12; 368 year++; 369 } 370 //todaysDate=day+"/"+month+"/"+year; 371 todaysDate=mon[month-1]+" "+day+", "+year; 372 373 if (hr<0) hr+=24; 374 if (hr>23) hr-=24; 375 376 ampm=(hr>11)?"PM":"AM"; 377 378 for (i=0;i<s;i++){ 379 cs[i].top=y+(i*hDims)*Math.sin(sec)+"px"; 380 cs[i].left=xpos+(i*hDims)*Math.cos(sec)+"px"; 381 } 382 for (i=0;i<m;i++){ 383 cm[i].top=y+(i*hDims)*Math.sin(min)+"px"; 384 cm[i].left=xpos+(i*hDims)*Math.cos(min)+"px"; 385 } 386 for (i=0;i<h;i++){ 387 ch[i].top=y+(i*hDims)*Math.sin(hrs)+"px"; 388 ch[i].left=xpos+(i*hDims)*Math.cos(hrs)+"px"; 389 } 390 391 document.getElementById("amOrPm").firstChild.data=ampm; 392 393 // if (hr.toString().length==1) hr="0"+hr 394 if (hr==0) 395 { 396 hr=12 397 } 398 else if (hr>12) 399 { 400 hr-=12; 401 } 402 403 404 if (mins.toString().length==1) mins="0"+mins; 405 406 document.getElementById("theDate").firstChild.data=todaysDate+" "+hr+":"+mins+" "+ampm; 407 setTimeout('ClockAndAssign()',100); 408 } 409 ClockAndAssign(); 410 } 411 412 // Setting cookies 413 function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure ) 414 { 415 var cookie_string = name + "=" + escape ( value ); 416 417 if (exp_y) //delete_cookie(name) 418 { 419 var expires = new Date ( exp_y, exp_m, exp_d ); 420 cookie_string += "; expires=" + expires.toGMTString(); 421 } 422 423 if (path) cookie_string += "; path=" + escape ( path ); 424 if (domain) cookie_string += "; domain=" + escape ( domain ); 425 if (secure) cookie_string += "; secure"; 426 427 document.cookie = cookie_string; 428 } 429 430 // Retrieving cookies 431 function get_cookie(cookie_name) 432 { 433 var results = document.cookie.match(cookie_name + '=(.*?)(;|$)'); 434 if (results) return (unescape(results[1])); 435 else return null; 436 } 437 438 // Delete cookies 439 function delete_cookie( cookie_name ) 440 { 441 var cookie_date = new Date ( ); // current date & time 442 cookie_date.setTime ( cookie_date.getTime() - 1 ); 443 document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString(); 444 } 445 446 if (get_cookie("timezone")==null || get_cookie("timezone")==false || get_cookie("timezone")<0 || get_cookie("timezone")=="1") { 447 lcl(0,true) 448 } else { 449 lcl(get_cookie("timezone"),false) 450 document.frmtimezone.city.options[get_cookie("timezone")].selected=true 451 } 452 453 454 //--> 455 </script> 456 </div> 457 EOQ; 458 $log->debug("Exiting get_world_clock method ..."); 459 return $the_clock; 460 } 461 ?>
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 |