buddhist_calendar.php 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110
  1. <?php
  2. require 'checklogin.inc';
  3. require 'config.php';
  4. if(isset($_GET["language"])){
  5. $currLanguage=$_GET["language"];
  6. $_COOKIE["language"]=$currLanguage;
  7. }
  8. else{
  9. if(isset($_COOKIE["language"])){
  10. $currLanguage=$_COOKIE["language"];
  11. }
  12. else{
  13. $currLanguage="en";
  14. $_COOKIE["language"]=$currLanguage;
  15. }
  16. }
  17. //load language file
  18. if(file_exists($dir_language.$currLanguage.".php")){
  19. require $dir_language.$currLanguage.".php";
  20. }
  21. else{
  22. include $dir_language."default.php";
  23. }
  24. if(isset($_GET["device"])){
  25. $currDevice=$_GET["device"];
  26. }
  27. else{
  28. if(isset($_COOKIE["device"])){
  29. $currDevice=$_COOKIE["device"];
  30. }
  31. else{
  32. $currDevice="computer";
  33. }
  34. }
  35. //修改页面编码
  36. //header("content-type:text/html;charset=utf-8");
  37. //获取当前年
  38. $year=$_GET['y']?$_GET['y']:date('Y');
  39. //获取当年月
  40. $month=$_GET['m']?$_GET['m']:date('m');
  41. //获取当前日
  42. //$selected_date=$_GET['d']?$_GET['d']:date('j');
  43. ?>
  44. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  45. <html>
  46. <head>
  47. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  48. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  49. <link type="text/css" rel="stylesheet" href="css/style.css"/>
  50. <link type="text/css" rel="stylesheet" href="css/color_day.css" id="colorchange" />
  51. <link type="text/css" rel="stylesheet" href="css/style_mobile.css" media="screen and (max-width:767px)">
  52. <link type="text/css" rel="stylesheet" href="<?php echo $dir_user_base.$userid.$dir_myApp; ?>/style.css"/>
  53. <title>PCD Studio</title>
  54. <script language="javascript" src="config.js"></script>
  55. <script language="javascript" src="js/common.js"></script>
  56. <script language="javascript" src="js/xml.js"></script>
  57. <script language="javascript" src="js/editor.js"></script>
  58. <script language="javascript" src="js/dict.js"></script>
  59. <script language="javascript" src="js/wizard.js"></script>
  60. <script language="javascript" src="js/search.js"></script>
  61. <script language="javascript" src="term_sys_list.js"></script>
  62. <script language="javascript" src="charcode/sinhala.js"></script>
  63. <script language="javascript" src="charcode/myanmar.js"></script>
  64. <script language="javascript" src="charcode/unicode.js"></script>
  65. <link type="text/css" rel="stylesheet" href="css/style.css"/>
  66. <script language="javascript" src="<?php echo $dir_user_base.$userid.$dir_myApp; ?>/userinfo.js"></script>
  67. <script language="javascript" src="module/editor/language/default.js"></script>
  68. <script language="javascript" src="module/editor/language/<?php echo $currLanguage; ?>.js"></script>
  69. <script src="js/jquery-3.3.1.min.js"></script>
  70. <script language="javascript" src="module/editor_palicannon/palicannon.js"></script>
  71. <script language="javascript" src="module/editor_palicannon/language/<?php echo $currLanguage; ?>.js"></script>
  72. <style type="text/css">
  73. .BE_icon_span{
  74. width: 10em;
  75. display: inline-block;
  76. }
  77. #BE_icon{
  78. font-size: 150%;
  79. }
  80. .td_today{
  81. margin: auto;
  82. background: silver;
  83. color: black;
  84. width: 2em;
  85. }
  86. .new_moon_uposatha{
  87. background:black;
  88. border-radius: 2em;
  89. width: 2em;
  90. margin: auto;
  91. }
  92. .full_moon_uposatha{
  93. background:orange;
  94. border-radius: 2em;
  95. width: 2em;
  96. margin: auto;
  97. }
  98. .table_body{
  99. width:700px;
  100. border:1px;
  101. font-size: 150%;
  102. width: 34em;
  103. line-height: 2em;
  104. text-align: center;
  105. margin: 20px 0px;
  106. border-collapse: collapse;
  107. }
  108. .table_line{
  109. display: flex;
  110. }
  111. .table_column{
  112. border:solid;
  113. border-width: thin;
  114. flex:1;
  115. }
  116. </style>
  117. <!--加载语言文件 -->
  118. <script language="javascript" src="language/default.js"></script>
  119. <?php
  120. if(file_exists("../user/App/language/$currLanguage.js")){
  121. echo("<script language=\"javascript\" src=\"../user/App/language/$currLanguage.js\"></script>");
  122. }
  123. else{
  124. echo("<script language=\"javascript\" src=\"language/$currLanguage.js\"></script>");
  125. }
  126. ?>
  127. <!--加载语言文件结束 -->
  128. <script src="js/jquery-3.3.1.min.js"></script>
  129. <script src="js/fixedsticky.js"></script>
  130. <script type="text/javascript">
  131. var g_device = "computer";
  132. var strSertch = location.search;
  133. if(strSertch.length>0){
  134. strSertch = strSertch.substr(1);
  135. var sertchList=strSertch.split('&');
  136. for ( i in sertchList){
  137. var item = sertchList[i].split('=');
  138. if(item[0]=="device"){
  139. g_device=item[1];
  140. }
  141. }
  142. }
  143. if(g_device=="mobile"){
  144. g_is_mobile=true;
  145. }
  146. else{
  147. g_is_mobile=false;
  148. }
  149. var g_langrage="en";
  150. var pali_num_str=[
  151. { "id":"1" , "value":"eka" },
  152. { "id":"2" , "value":"dve" },
  153. { "id":"3" , "value":"ti" },
  154. { "id":"4" , "value":"catu" },
  155. { "id":"5" , "value":"pañca" },
  156. { "id":"6" , "value":"cha" },
  157. { "id":"7" , "value":"satta" },
  158. { "id":"8" , "value":"aṭṭha" },
  159. { "id":"9" , "value":"nava" },
  160. { "id":"10" , "value":"dasa" },
  161. { "id":"11" , "value":"ekādasa" },
  162. { "id":"12" , "value":"dvādasa " },
  163. { "id":"13" , "value":"terasa" },
  164. { "id":"14" , "value":"cuddasa" },
  165. { "id":"15" , "value":"paṇṇarasa" },
  166. { "id":"16" , "value":"soḷasa" },
  167. { "id":"17" , "value":"sattarasa" },
  168. { "id":"18" , "value":"aṭṭharasa" },
  169. { "id":"19" , "value":"ekūna-vīsati" },
  170. { "id":"20" , "value":"vīsati" },
  171. { "id":"21" , "value":"eka-vīsati" },
  172. { "id":"22" , "value":"dve-vīsati" },
  173. { "id":"23" , "value":"te-vīsati" },
  174. { "id":"24" , "value":"catu-vīsati" },
  175. { "id":"25" , "value":"pañca-vīsati" },
  176. { "id":"26" , "value":"cha-bbīsati" },
  177. { "id":"27" , "value":"satta-vīsati" },
  178. { "id":"28" , "value":"aṭṭha-vīsati" },
  179. { "id":"29" , "value":"ekūna-tiṃsati" },
  180. { "id":"30" , "value":"tiṃsati" },
  181. { "id":"31" , "value":"eka-tiṃsati" },
  182. { "id":"32" , "value":"dvattiṃsati" },
  183. { "id":"33" , "value":"tettiṃsati" },
  184. { "id":"34" , "value":"catuttiṃsati" },
  185. { "id":"35" , "value":"pañcatiṃsati" },
  186. { "id":"36" , "value":"chattiṃsati" },
  187. { "id":"37" , "value":"sattatiṃsati" },
  188. { "id":"38" , "value":"aṭṭhatiṃsati" },
  189. { "id":"39" , "value":"ekūna-cattālīsati" },
  190. { "id":"40" , "value":"cattālīsati" },
  191. { "id":"41" , "value":"eka-cattālīsati" },
  192. { "id":"42" , "value":"dve-cattālīsati" },
  193. { "id":"43" , "value":"ti-cattālīsati" },
  194. { "id":"44" , "value":"catu-cattālīsati" },
  195. { "id":"45" , "value":"pañca-cattālīsati" },
  196. { "id":"46" , "value":"cha-cattālīsati" },
  197. { "id":"47" , "value":"satta-cattālīsati" },
  198. { "id":"48" , "value":"aṭṭha-cattālīsati" },
  199. { "id":"49" , "value":"ekūna-paññāsā" },
  200. { "id":"50" , "value":"paññāsā" },
  201. { "id":"51" , "value":"eka-paññāsā" },
  202. { "id":"52" , "value":"dve-paññāsā" },
  203. { "id":"53" , "value":"ti-paññāsā" },
  204. { "id":"54" , "value":"catu-paññāsā" },
  205. { "id":"55" , "value":"pañca-paññāsā" },
  206. { "id":"56" , "value":"cha-paññāsā" },
  207. { "id":"57" , "value":"satta-paññāsā" },
  208. { "id":"58" , "value":"aṭṭha-paññāsā" },
  209. { "id":"59" , "value":"ekūna-saṭṭhi" },
  210. { "id":"60" , "value":"saṭṭhi" },
  211. { "id":"61" , "value":"eka-saṭṭhi" },
  212. { "id":"62" , "value":"dve-saṭṭhi" },
  213. { "id":"63" , "value":"ti-saṭṭhi" },
  214. { "id":"64" , "value":"catu-saṭṭhi" },
  215. { "id":"65" , "value":"pañca-saṭṭhi" },
  216. { "id":"66" , "value":"cha-saṭṭhi" },
  217. { "id":"67" , "value":"satta-saṭṭhi" },
  218. { "id":"68" , "value":"aṭṭha-saṭṭhi" },
  219. { "id":"69" , "value":"ekūna-sattati" },
  220. { "id":"70" , "value":"sattati" },
  221. { "id":"71" , "value":"eka-sattati" },
  222. { "id":"72" , "value":"dve-sattati" },
  223. { "id":"73" , "value":"ti-sattati" },
  224. { "id":"74" , "value":"catu-sattati" },
  225. { "id":"75" , "value":"pañca-sattati" },
  226. { "id":"76" , "value":"cha-sattati" },
  227. { "id":"77" , "value":"satta-sattati" },
  228. { "id":"78" , "value":"aṭṭha-sattati" },
  229. { "id":"79" , "value":"ekūnāsīti" },
  230. { "id":"80" , "value":"asīti" },
  231. { "id":"81" , "value":"eka-asīti" },
  232. { "id":"82" , "value":"dve-asīti" },
  233. { "id":"83" , "value":"ti-asīti" },
  234. { "id":"84" , "value":"catu-asīti" },
  235. { "id":"85" , "value":"pañca-asīti" },
  236. { "id":"86" , "value":"cha-asīti" },
  237. { "id":"87" , "value":"satta-asīti" },
  238. { "id":"88" , "value":"aṭṭha-asīti" },
  239. { "id":"89" , "value":"ekūna-navuti" },
  240. { "id":"90" , "value":"navuti" },
  241. { "id":"91" , "value":"eka-navuti" },
  242. { "id":"92" , "value":"dve-navuti" },
  243. { "id":"93" , "value":"ti-navuti" },
  244. { "id":"94" , "value":"catu-navuti" },
  245. { "id":"95" , "value":"pañca-navuti" },
  246. { "id":"96" , "value":"cha-navuti" },
  247. { "id":"97" , "value":"satta-navuti" },
  248. { "id":"98" , "value":"aṭṭha-navuti" },
  249. { "id":"99" , "value":"ekūna-sata" },
  250. { "id":"100" , "value":"sata" },
  251. { "id":"200" , "value":"dvi-sata" },
  252. { "id":"300" , "value":"ti-sata" },
  253. { "id":"400" , "value":"catu-sata" },
  254. { "id":"500" , "value":"pañca-sata" },
  255. { "id":"600" , "value":"cha-sata" },
  256. { "id":"700" , "value":"satta-sata" },
  257. { "id":"800" , "value":"aṭṭha-sata" },
  258. { "id":"900" , "value":"nava-sata" },
  259. { "id":"1000" , "value":"sahassa" },
  260. { "id":"2000" , "value":"dve-sahassa" },
  261. { "id":"3000" , "value":"ti-sahassa" },
  262. { "id":"4000" , "value":"catu-sahassa" },
  263. { "id":"5000" , "value":"pañca-sahassa" }
  264. ]
  265. var pali_num_str_pl=[
  266. //{ "id":"0" , "value":"na" },
  267. //{ "id":"1" , "value":"eka" },
  268. { "id":"2" , "value":"dve" },
  269. { "id":"3" , "value":"tīṇi" },
  270. { "id":"4" , "value":"cattāri" },
  271. { "id":"5" , "value":"pañca" },
  272. { "id":"6" , "value":"cha" },
  273. { "id":"7" , "value":"satta" },
  274. { "id":"8" , "value":"aṭṭha" },
  275. { "id":"9" , "value":"nava" },
  276. { "id":"10" , "value":"dasa" },
  277. { "id":"11" , "value":"ekādasa" },
  278. { "id":"12" , "value":"dvādasa " },
  279. { "id":"13" , "value":"terasa" },
  280. { "id":"14" , "value":"cuddasa" },
  281. { "id":"15" , "value":"paṇṇarasa" },
  282. { "id":"16" , "value":"soḷasa" },
  283. { "id":"17" , "value":"sattarasa" },
  284. { "id":"18" , "value":"aṭṭharasa" },
  285. { "id":"19" , "value":"ekūna-vīsati" },
  286. { "id":"20" , "value":"vīsati" },
  287. { "id":"21" , "value":"eka-vīsati" },
  288. { "id":"22" , "value":"dve-vīsati" },
  289. { "id":"23" , "value":"te-vīsati" },
  290. { "id":"24" , "value":"catu-vīsati" },
  291. { "id":"25" , "value":"pañca-vīsati" },
  292. { "id":"26" , "value":"cha-bbīsati" },
  293. { "id":"27" , "value":"satta-vīsati" },
  294. { "id":"28" , "value":"aṭṭha-vīsati" },
  295. { "id":"29" , "value":"ekūna-tiṃsati" }
  296. ]
  297. var pali_year_name=[
  298. { "id":"0" , "value":"sappa" , "icon":"🐍"},
  299. //🐀🐃🐄🐏🐑
  300. //🐭🐮🐯🐰🐲🐍🐴🐵🐔🐶🐷
  301. { "id":"1" , "value":"assa" , "icon":"🐎"},
  302. { "id":"2" , "value":"aja" , "icon":"🐐"},
  303. { "id":"3" , "value":"kapi" , "icon":"🐒"},
  304. { "id":"4" , "value":"kukkuṭa" , "icon":"🐓"},
  305. { "id":"5" , "value":"soṇa" , "icon":"🐕"},
  306. { "id":"6" , "value":"sūkara" , "icon":"🐖"},
  307. { "id":"7" , "value":"mūsika" , "icon":"🐁"},
  308. { "id":"8" , "value":"vasabha" , "icon":"🐂"},
  309. { "id":"9" , "value":"vyaggaha" , "icon":"🐅"},
  310. { "id":"10" , "value":"sasa" , "icon":"🐇"},
  311. { "id":"11" , "value":"nāga" , "icon":"🐉"}
  312. ]
  313. var pali_month_name=[
  314. { "id":"1" , "value":"jeṭṭha" , "season":"gimhāna" , "season_icon":"☀"},//5.X-四-十五-心
  315. { "id":"2" , "value":"asāḷha" , "season":"gimhāna" , "season_icon":"☀"},//6.X-五-十五、十六-箕、斗
  316. { "id":"3" , "value":"sāvana" , "season":"vassāna" , "season_icon":"☔"},//7.X-六-十五-女
  317. { "id":"4" , "value":"poṭṭhapāda" , "season":"vassāna" , "season_icon":"☔"},//8.x-七-十五、十六-室、壁
  318. { "id":"5" , "value":"assajuja" , "season":"vassāna" , "season_icon":"☔"},//9.X-八-十五-樓
  319. { "id":"6" , "value":"kattika" , "season":"vassāna" , "season_icon":"☔"},//10.X-九-十五-昂
  320. { "id":"7" , "value":"māgasira" , "season":"hemanta" , "season_icon":"❄"},//11.X-十-十五-觜
  321. { "id":"8" , "value":"phussa" , "season":"hemanta" , "season_icon":"❄"},//12.X-十一-十五-鬼
  322. { "id":"9" , "value":"māgha" , "season":"hemanta" , "season_icon":"❄"},//1.X-十二-十五-星
  323. { "id":"10" , "value":"phagguna" , "season":"hemanta" , "season_icon":"❄"},//2.X-正月-十四、十五-張、異
  324. { "id":"11" , "value":"citta" , "season":"gimhāna" , "season_icon":"☀"},//3.X-二月-十五-角
  325. { "id":"12" , "value":"vesākha" , "season":"gimhāna" , "season_icon":"☀"}//4.X-三月-十五-氐
  326. ]
  327. var pali_date_name=[
  328. { "id":"1" , "value":"paṭhamaṃ" },
  329. { "id":"2" , "value":"dutiyaṃ" },
  330. { "id":"3" , "value":"tatiyaṃ" },
  331. { "id":"4" , "value":"catutthaṃ" },
  332. { "id":"5" , "value":"pañcamaṃ" },
  333. { "id":"6" , "value":"chaṭṭhamaṃ" },
  334. { "id":"7" , "value":"sattamaṃ" },
  335. { "id":"8" , "value":"aṭṭhamaṃ" },
  336. { "id":"9" , "value":"navamaṃ" },
  337. { "id":"10" , "value":"dasamaṃ" },
  338. { "id":"11" , "value":"ekādasamaṃ" },
  339. { "id":"12" , "value":"dvādasamaṃ" },
  340. { "id":"13" , "value":"terasamaṃ" },
  341. { "id":"14" , "value":"cuddasamaṃ" },
  342. { "id":"15" , "value":"paṇṇarasamaṃ" }
  343. ]
  344. var pali_week_day_name=[
  345. { "id":"0" , "value":"ravi" ,"icon":"☀"},
  346. { "id":"1" , "value":"canda" ,"icon":"🌙"},
  347. { "id":"2" , "value":"bhumma" ,"icon":""},//土
  348. { "id":"3" , "value":"budha" ,"icon":""},//水星
  349. { "id":"4" , "value":"guru" ,"icon":""},//木星
  350. { "id":"5" , "value":"sukka" ,"icon":"♀"},//金星
  351. { "id":"6" , "value":"sora" ,"icon":"♂"}//火星
  352. ]
  353. var g_Unix_now=0;
  354. function startTime(){
  355. var today=new Date()
  356. var h=today.getHours()
  357. var m=today.getMinutes()
  358. var s=today.getSeconds()
  359. // add a zero in front of numbers<10
  360. h=checkTime(h)
  361. m=checkTime(m)
  362. s=checkTime(s)
  363. document.getElementById('clock_string').innerHTML=h+":"+m+":"+s
  364. g_Unix_now=today.getTime()
  365. t=setTimeout('startTime()',500)
  366. }
  367. function checkTime(i){
  368. if (i<10)
  369. {i="0" + i}
  370. return i
  371. }
  372. </script>
  373. </head>
  374. <body class="indexbody" onload="startTime()">
  375. <!-- tool bar begin-->
  376. <div class='index_toolbar'>
  377. <div id="index_nav">
  378. <button><a href="index.php?language=<?php echo $currLanguage; ?>"><?php echo $module_gui_str['editor']['1018'];?></a></button>
  379. <button><a href="index_pc.php?language=<?php echo $currLanguage; ?>"><?php echo $module_gui_str['editor_wizard']['1002'];?></a></button>
  380. <button><a href="filenew.php?language=<?php echo $currLanguage; ?>"><?php echo $module_gui_str['editor']['1064'];?></a></button>
  381. <button class="selected"><?php echo $module_gui_str['editor']['1052'];?></button>
  382. </div>
  383. <div class="toolgroup1">
  384. <span><?php echo $module_gui_str['editor']['1050'];?></span>
  385. <?php
  386. echo "<select id='id_language' name='menu' onchange=\"menuLangrage(this,".$year.",".$month.")\">";
  387. echo "<option value='pali' >Pāḷi Roman</option>";
  388. echo "<option value='en' >English</option>";
  389. echo "<option value='sinhala' >සිංහල</option>";
  390. echo "<option value='myanmar' >myanmar</option>";
  391. echo "<option value='zh' >简体中文</option>";
  392. echo "<option value='tw' >繁體中文</option>";
  393. echo "</select>";
  394. echo $module_gui_str['editor']['1049'];
  395. echo "<a href=\"setting.php?item=account\">";
  396. echo $_COOKIE["nickname"];
  397. echo "</a>";
  398. echo $module_gui_str['editor']['1042'];
  399. echo "<a href='login.php?op=logout'>";
  400. echo $module_gui_str['editor']['1089'];
  401. echo "</a>";
  402. ?>
  403. </div>
  404. </div>
  405. <!--tool bar end -->
  406. <script>
  407. document.getElementById("id_language").value="<?php echo($currLanguage); ?>";
  408. </script>
  409. <?php
  410. //獲取今天是幾號
  411. $cur_date=date('j');
  412. //获取当前月多少天
  413. $days=date('t',strtotime("{$year}-{$month}-1"));
  414. //選定日
  415. if($cur_date>$days){
  416. $selected_date=1;
  417. }
  418. else{
  419. $selected_date=$cur_date;
  420. }
  421. //当前一号周几
  422. $week=date('w',strtotime("{$year}-{$month}-1"));
  423. //居中
  424. echo "<br/><br/><br/>";
  425. echo "<div style='display:flex;'>";
  426. echo "<center style='display: flex;flex: 3;flex-direction: column;padding: 40px;'>";
  427. //設定vesakha日
  428. $vesakha_day=date_create("2019-5-18");
  429. $vesakha_day_1=date_sub($vesakha_day,date_interval_create_from_date_string("-354 days"));
  430. $vesakha_day=date_create("2019-5-18");
  431. //當前日差值
  432. $diff=date_diff($vesakha_day,date_create("{$year}-{$month}-{$selected_date}"));
  433. $diff_1=date_diff($vesakha_day_1,date_create("{$year}-{$month}-{$selected_date}"));
  434. $days_diff=$diff->format("%R%a");
  435. $days_diff_1=$diff_1->format("%R%a");
  436. if($days_diff_1>0){
  437. $days_diff=$days_diff_1;
  438. }
  439. //當前年差值
  440. if($diff->format("%R")=="+" && $diff_1->format("%R")=="+"){
  441. $years_diff_total=544-1+date_format($vesakha_day_1,"Y");
  442. }
  443. else if($diff->format("%R")=="+" && $diff_1->format("%R")=="-"){
  444. $years_diff_total=544-1+date_format($vesakha_day,"Y");
  445. }
  446. else{
  447. $years_diff_total=544-2+date_format($vesakha_day,"Y");
  448. }
  449. //计算上个月
  450. if($month==1){
  451. $prevyear=$year-1;
  452. $prevmonth=12;
  453. }
  454. else{
  455. $prevyear=$year;
  456. $prevmonth=$month-1;
  457. }
  458. //计算下个月
  459. if($month==12){
  460. $nextyear=$year+1;
  461. $nextmonth=1;
  462. }
  463. else{
  464. $nextyear=$year;
  465. $nextmonth=$month+1;
  466. }
  467. //生成年份名稱
  468. if($currLanguage=="en"){
  469. $year_text=$year."/";
  470. }
  471. else{
  472. $year_text="{$year}".$module_gui_str['tools']['1018'];//年
  473. }
  474. //生成月份名稱
  475. if($currLanguage=="en"){
  476. $month_text=date('F',strtotime("{$year}-{$month}-1"));
  477. }
  478. else{
  479. $month_text="{$month}".$module_gui_str['tools']['1019'];//月
  480. }
  481. //输出表头
  482. echo "<h2 style='font-size: 150%;'>";
  483. echo "<a href='buddhist_calendar.php?y={$prevyear}&m={$prevmonth}'>";
  484. echo $module_gui_str['tools']['1027'];//上一月
  485. echo "</a>|";
  486. echo $year_text;
  487. echo $month_text;
  488. echo "|<a href='buddhist_calendar.php?y={$nextyear}&m={$nextmonth}'>";
  489. echo $module_gui_str['tools']['1028'];//下一月
  490. echo "</a></h2>";
  491. //输出日期表格
  492. echo "<table class='table_body' >";
  493. echo "<tr class='table_line'>";
  494. echo "<th class='table_column'>".$module_gui_str['tools']['1026']."</th>";
  495. echo "<th class='table_column'>".$module_gui_str['tools']['1020']."</th>";
  496. echo "<th class='table_column'>".$module_gui_str['tools']['1021']."</th>";
  497. echo "<th class='table_column'>".$module_gui_str['tools']['1022']."</th>";
  498. echo "<th class='table_column'>".$module_gui_str['tools']['1023']."</th>";
  499. echo "<th class='table_column'>".$module_gui_str['tools']['1024']."</th>";
  500. echo "<th class='table_column'>".$module_gui_str['tools']['1025']."</th>";
  501. echo "</tr>";
  502. //铺表格
  503. for($i=1-$week; $i <=$days ;){
  504. echo "<tr class='table_line'>";
  505. for ($j=0; $j < 7; $j++){
  506. if ($i>$days || $i<1){
  507. echo "<td class='table_column'>&nbsp;</td>";
  508. }
  509. else if($i==$cur_date && $month==date('m')){
  510. $days_diff_X=$days_diff-$selected_date+$i;
  511. $cur_years_diff_total=$years_diff_total;
  512. $cur_days_diff=$days_diff_X;
  513. $cur_week_day=$j;
  514. echo "<td class='table_column' id='td_{$i}' onclick=\"pali_date($i,$days,$years_diff_total,$days_diff_X,$j,'".$currLanguage."')\")' ><div class='td_today'>{$i}</div>";
  515. echo "</td>";
  516. if($i==$days){
  517. $key_days_num=$days_diff_X;
  518. }
  519. }
  520. else if($i==$selected_date){
  521. $days_diff_X=$days_diff-$selected_date+$i;
  522. $cur_years_diff_total=$years_diff_total;
  523. $cur_days_diff=$days_diff_X;
  524. $cur_week_day=$j;
  525. echo "<td class='table_column' id='td_{$i}' onclick=\"pali_date($i,$days,$years_diff_total,$days_diff,$j,'".$currLanguage."')\">{$i}</td>";
  526. if($i==$days){
  527. $key_days_num=$days_diff;
  528. }
  529. }
  530. else{
  531. $days_diff_X=$days_diff-$selected_date+$i;
  532. $cur_years_diff_total=$years_diff_total;
  533. $cur_days_diff=$days_diff_X;
  534. $cur_week_day=$j;
  535. echo "<td class='table_column' id='td_{$i}' onclick=\"pali_date($i,$days,$years_diff_total,$days_diff_X,$j,'".$currLanguage."')\">{$i}</td>";
  536. if($i==$days){
  537. $key_days_num=$days_diff_X;
  538. }
  539. }
  540. $i++;
  541. }
  542. echo "</tr>";
  543. }
  544. echo "</table>";
  545. echo "<div style='display:flex; margin: 20px;'>";
  546. echo "<div style='display:grid; flex:3'>";
  547. echo "<span id='time_A_string_X' style='font-size: 150%;'></span>";
  548. echo "<span id='clock_string_X' style='font-size: 150%;'></span>";
  549. echo "<span id='time_B_string_X' style='font-size: 150%; '></span>";
  550. echo "</div>";
  551. echo "<div style='display:grid; flex:2'>";
  552. echo "<span id='time_A_string' style='font-size: 150%; '></span>";
  553. echo "<span id='clock_string' style='font-size: 150%; '></span>";
  554. echo "<span id='time_B_string' style='font-size: 150%; '></span>";
  555. echo "</div>";
  556. echo "<div style='display:grid; flex:6'>";
  557. echo "<span id='kala_judge' style='font-size: 150%; '></span>";
  558. echo "<span id='kala_inst_1' style='font-size: 150%; '></span>";
  559. echo "<span id='kala_inst_2' style='font-size: 150%; '></span>";
  560. echo "</div>";
  561. echo "</div>";
  562. echo "<span id='key_num_string' style='display: none; '>{$key_days_num}-{$days}-{$year}</span>";
  563. if($cur_years_diff_total!=null && $cur_days_diff!=null && $cur_week_day!=null){
  564. echo "<span id='cur_day_string' style='display: none; '>{$cur_date}-{$days}-{$cur_years_diff_total}-{$cur_days_diff}-{$cur_week_day}-{$currLanguage}</span>";
  565. }
  566. echo "</center>";
  567. date_default_timezone_set("Asia/Rangoon");
  568. $Unix_now_time=strtotime("now");
  569. $sun_info=date_sun_info(strtotime("now"),14.150142,98.226393);//7.738562,80.519675
  570. $sun_info_1=date_sun_info(strtotime("+1 day"),7.738562,80.519675);
  571. $Unix_dawn=$sun_info['civil_twilight_begin']*1000;
  572. $Unix_dawn_1=$sun_info_1['civil_twilight_begin']*1000;
  573. $Unix_noon=($sun_info['sunrise']+$sun_info['sunset'])/2*1000;
  574. $Unix_noon_1=($sun_info_1['sunrise']+$sun_info_1['sunset'])/2*1000;
  575. echo "<span id='time_string' style='display: none; '>{$Unix_dawn}-{$Unix_noon}-{$Unix_dawn_1}-{$Unix_noon_1}</span>";
  576. //echo date("H:i:s",$Unix_dawn)."<br/>";
  577. //echo date("H:i:s",$Unix_noon)."<br/>";
  578. //太陽赤緯
  579. $diff_time=strtotime("now")-date_timestamp_get(date_create("{$year}-01-1"));
  580. $N=$diff_time/1000/3600/24;
  581. $year_day=366-ceil($year%4/4);
  582. $b=2*pi()*($N-1)/$year_day;
  583. $sun_angle=0.006918-0.399912*cos($b)+0.070257*sin($b)-0.006758*cos($b*2)+0.000907*sin($b*2)-0.002697*cos($b*3)+0.00148*sin($b*3);
  584. //echo "<button onclick='set_uposatha_day()'>set uposatha</button>";
  585. echo "<div id='pali_era' style='font-size: 150%;width: 40em;display: flex;flex: 7;padding: 40px;flex-direction: column;'>";
  586. echo "<div id='pali_era_graph' style='display:grid;flex:3;'></div>";
  587. echo "<div id='pali_era_pali' style='display:grid;flex:7;'></div>";
  588. echo "</div>";
  589. //echo date_format($vesakha_day,"Y-m-d")."|".date_format($vesakha_day_1,"Y-m-d")
  590. echo "</div>";
  591. ?>
  592. <script language="javascript">
  593. dwan_noon_display();
  594. function dwan_noon_display(){
  595. var Unix_string=document.getElementById('time_string').innerHTML
  596. var Unix_Array=Unix_string.split("-");
  597. var time_A=new Date();
  598. var time_B=new Date();
  599. $("#clock_string_X").html(local_gui.now_time+":")
  600. if(g_Unix_now<Unix_Array[0]){
  601. time_B.setTime(Unix_Array[0])
  602. $("#time_B_string_X").html(local_gui.twilight_time+":");
  603. $("#time_B_string").html(set_time_string(time_B));
  604. $("#kala_judge").html("【"+local_gui.vikala+"】");
  605. $("#kala_inst_1").html(local_gui.no_string+local_gui.eat);
  606. $("#kala_inst_2").html(local_gui.need_inform+local_gui.no_string+local_gui.gama_entry);
  607. }
  608. else if(g_Unix_now>=Unix_Array[0] && g_Unix_now<Unix_Array[1]){
  609. time_A.setTime(Unix_Array[0])
  610. time_B.setTime(Unix_Array[1])
  611. $("#time_A_string_X").html(local_gui.twilight_time+":");
  612. $("#time_A_string").html(set_time_string(time_A));
  613. $("#time_B_string_X").html(local_gui.noon_time+":");
  614. $("#time_B_string").html(set_time_string(time_B));
  615. $("#kala_judge").html("【"+local_gui.kala+"】");
  616. $("#kala_inst_1").html(local_gui.yes_string+local_gui.eat);
  617. $("#kala_inst_2").html(local_gui.need_inform+local_gui.yes_string+local_gui.gama_entry);
  618. }
  619. else if(g_Unix_now>=Unix_Array[1] && g_Unix_now<Unix_Array[2]){
  620. time_A.setTime(Unix_Array[1])
  621. time_B.setTime(Unix_Array[2])
  622. $("#time_A_string_X").html(local_gui.noon_time+":");
  623. $("#time_A_string").html(set_time_string(time_A));
  624. $("#time_B_string_X").html(local_gui.twilight_time+":");
  625. $("#time_B_string").html(set_time_string(time_B));
  626. $("#kala_judge").html("【"+local_gui.vikala+"】");
  627. $("#kala_inst_1").html(local_gui.no_string+local_gui.eat);
  628. $("#kala_inst_2").html(local_gui.need_inform+local_gui.no_string+local_gui.gama_entry);
  629. }
  630. t=setTimeout('dwan_noon_display()',1000)
  631. }
  632. function set_time_string(date_obj){
  633. var hh=date_obj.getHours()
  634. var mm=date_obj.getMinutes()
  635. var ss=date_obj.getSeconds()
  636. // add a zero in front of numbers<10
  637. hh=checkTime(hh)
  638. mm=checkTime(mm)
  639. ss=checkTime(ss)
  640. return(hh+":"+mm+":"+ss)
  641. }
  642. function menuLangrage(obj,year,month){
  643. g_langrage=obj.value;
  644. setCookie('language',g_langrage,365);
  645. window.location.assign("buddhist_calendar.php?language="+g_langrage+"&y="+year+"&m="+month);
  646. }
  647. set_uposatha_day();
  648. set_cur_day_era();
  649. function set_cur_day_era(){
  650. if(document.getElementById('cur_day_string')!=null){
  651. var cur_day_string=document.getElementById('cur_day_string').innerHTML;
  652. var cur_date=cur_day_string.split("-")[0];
  653. var cur_years_diff_total=cur_day_string.split("-")[1];
  654. var cur_days_diff=cur_day_string.split("-")[2];
  655. var cur_week_day=cur_day_string.split("-")[3];
  656. var currLanguage=cur_day_string.split("-")[4];
  657. pali_date(cur_date,cur_years_diff_total,cur_days_diff,cur_week_day,currLanguage);
  658. }
  659. }
  660. function set_uposatha_day(){
  661. var key_num=document.getElementById('key_num_string').innerHTML;
  662. var total_days=key_num.split("-")[0];
  663. var month_days=key_num.split("-")[1];
  664. var year=key_num.split("-")[2];
  665. for(i_uposatha=1;i_uposatha<=month_days;i_uposatha++){
  666. var pres_obj=pali_date_num(year,total_days-month_days+i_uposatha)[1];
  667. var uposatha_obj=uposatha_calculator(pres_obj.month,pres_obj.day);
  668. var day_id="td_"+i_uposatha;
  669. if(uposatha_obj.uposatha && uposatha_obj.pakkha=="kāla"){
  670. //document.getElementById(day_id).innerHTML+="<svg class='icon'><use xlink:href='svg/icon.svg#new_moon'></use></svg>";
  671. document.getElementById(day_id).innerHTML="<div class='new_moon_uposatha' >"+i_uposatha+"</div>";
  672. }
  673. else if(uposatha_obj.uposatha && uposatha_obj.pakkha=="sukka"){
  674. //document.getElementById(day_id).innerHTML+="<svg class='icon'><use xlink:href='svg/icon.svg#full_moon'></use></svg>";
  675. document.getElementById(day_id).innerHTML="<div class='full_moon_uposatha' >"+i_uposatha+"</div>";
  676. }
  677. }
  678. }
  679. function pali_date_num(year,days){
  680. var date_num_array=new Array;
  681. var past_obj=new Object;
  682. var pres_obj=new Object;
  683. var left_obj=new Object;
  684. past_obj.year=Number(year);
  685. pres_obj.year=Number(year)+1;
  686. left_obj.year=5000-Number(year)-1;
  687. if(days%59<=30 && days%59!=0){//奇數月
  688. past_obj.month=Math.floor(days/59)*2;
  689. pres_obj.month=past_obj.month+1
  690. past_obj.day=days%59-1;
  691. pres_obj.day=days%59;
  692. pres_obj.month_length=30;
  693. if(pres_obj.month>=13){
  694. pres_obj.month=pres_obj.month%12;
  695. past_obj.month=pres_obj.month-1;
  696. past_obj.year=past_obj.year+Math.floor(pres_obj.month/12);
  697. pres_obj.year=past_obj.year+1;
  698. }
  699. }
  700. else if(days%59>30){//偶數月
  701. past_obj.month=Math.floor(days/59)*2+1;
  702. pres_obj.month=past_obj.month+1
  703. past_obj.day=days%59-30-1;
  704. pres_obj.day=past_obj.day+1
  705. pres_obj.month_length=29;
  706. }
  707. else if(days%59==0){//偶數月最後一天
  708. past_obj.month=days/59*2-1;
  709. pres_obj.month=past_obj.month+1
  710. past_obj.day=28;
  711. pres_obj.day=29;
  712. pres_obj.month_length=29;
  713. }
  714. left_obj.month=12-past_obj.month-1;
  715. left_obj.day=pres_obj.month_length-past_obj.day-1;
  716. date_num_array.push(past_obj,pres_obj,left_obj);
  717. return(date_num_array);
  718. }
  719. function pali_date(id,m_days,year,days,week_day,currLanguage){
  720. //改變日曆中選中日的樣式
  721. for(var i_date=1;i_date<=m_days;i_date++){
  722. $("#td_"+i_date)[0].style="";
  723. }
  724. $("#td_"+id)[0].style="background:purple;";
  725. //佛曆數據解析
  726. var date_num_array=pali_date_num(year,days);
  727. var past=date_num_array[0];
  728. var pres=date_num_array[1];
  729. var left=date_num_array[2];
  730. //生成佛曆圖表外殻
  731. var pres_date_string ="<span>"+local_gui.today+local_gui.BE+"</span>";
  732. pres_date_string+="<span style='font-size: 400%;'>";
  733. pres_date_string+=pres.year+local_gui.year_1;
  734. pres_date_string+=pres.month+local_gui.month_1;
  735. pres_date_string+=pres.day+local_gui.day+"</span>";
  736. pres_date_string+="<span id='BE_icon'></span>";
  737. $("#pali_era_graph").html(pres_date_string);
  738. //生成佛曆巴利外殻
  739. var past_date_string_pali ="<span id='past_string'></span>";
  740. var pres_date_string_pali ="<span id='pres_string'></span>";
  741. var left_date_string_pali ="<span id='left_string'></span>";
  742. var output_string_pali = past_date_string_pali+left_date_string_pali+pres_date_string_pali;
  743. $("#pali_era_pali").html(output_string_pali);
  744. //寫入佛曆圖表數據
  745. var pres_language_string_0= "";
  746. pres_language_string_0+=get_year_name(pres.year).string_0;
  747. pres_language_string_0+=get_month_name(pres.month,pres.day).string_0;
  748. pres_language_string_0+=get_week_day_name(week_day).string_0;
  749. var past_date_string ="<div>"+local_gui.dhamma_time+"</div>"
  750. past_date_string+="<div><span class='BE_icon_span'>"+local_gui.past+":</span>";
  751. past_date_string+=past.year+local_gui.years;
  752. past_date_string+=past.month+local_gui.months;
  753. past_date_string+=past.day+local_gui.days+"</div>";
  754. var left_date_string= "<div><span class='BE_icon_span'>"+local_gui.left+":</span>";
  755. left_date_string+=left.year+local_gui.years
  756. left_date_string+=left.month+local_gui.months
  757. left_date_string+=left.day+local_gui.days+"</div>";
  758. $('#BE_icon').html(pres_language_string_0+"<br>"+past_date_string+left_date_string);
  759. //解析佛曆數據為文字
  760. var past_language_string="";
  761. var pres_language_string="";
  762. var left_language_string="";
  763. var pali_begin="idāni kho pana ";
  764. var pali_past_end=" atikkantāni.";
  765. var pali_left_end=" avasiṭṭhāni.";
  766. if(past.day==1 && past.month!=0){
  767. past_language_string+=pali_begin;
  768. past_language_string+=get_year_pali_string(past.year)+"ceva, ";
  769. past_language_string+=get_day_pali_string(past.day).pre;
  770. past_language_string+=get_month_pali_string(past.month).suff
  771. past_language_string+=pali_past_end;
  772. }
  773. else if(past.day==1 && past.month==0){
  774. past_language_string+=pali_begin;
  775. past_language_string+=get_day_pali_string(past.day).pre;
  776. past_language_string+=get_year_pali_string(past.year);
  777. past_language_string+=get_month_pali_string(past.month).suff
  778. past_language_string+=pali_past_end;
  779. }
  780. else if(past.day==0 && past.month==1){
  781. past_language_string+=pali_begin;
  782. past_language_string+=get_day_pali_string(past.month).pre;
  783. past_language_string+=get_year_pali_string(past.year)+"ceva, "
  784. past_language_string+=get_month_pali_string(past.day).suff
  785. past_language_string+=pali_past_end;
  786. }
  787. else if(past.day==0 && past.month>1){
  788. past_language_string+=pali_begin;
  789. past_language_string+=get_year_pali_string(past.year)
  790. past_language_string+=get_month_pali_string(past.month).suff;
  791. past_language_string+=get_day_pali_string(past.day).suff;
  792. past_language_string+=pali_past_end;
  793. }
  794. else{
  795. past_language_string+=pali_begin;
  796. past_language_string+=get_year_pali_string(past.year)
  797. past_language_string+=get_month_pali_string(past.month).suff+"ca, ";
  798. past_language_string+=get_day_pali_string(past.day).suff;
  799. past_language_string+=pali_past_end;
  800. }
  801. if(left.day==1 && left.month!=0){
  802. left_language_string+=get_year_pali_string(left.year)+"ceva, ";
  803. left_language_string+=get_day_pali_string(left.day).pre;
  804. left_language_string+=get_month_pali_string(left.month).suff;
  805. left_language_string+=pali_left_end;
  806. }
  807. else if(left.day==1 && left.month==0){
  808. left_language_string+=get_day_pali_string(left.day).pre;
  809. left_language_string+=get_year_pali_string(left.year);
  810. left_language_string+=get_month_pali_string(left.month).suff
  811. left_language_string+=pali_left_end;
  812. }
  813. else if(left.day==0 && left.month==1){
  814. left_language_string+=get_day_pali_string(left.month).pre;
  815. left_language_string+=get_year_pali_string(left.year)+"ceva, ";
  816. left_language_string+=get_month_pali_string(left.day).suff
  817. left_language_string+=pali_left_end;
  818. }
  819. else if(left.day==0 && left.month>1){
  820. left_language_string+=get_year_pali_string(left.year);
  821. left_language_string+=get_month_pali_string(left.month).suff;
  822. left_language_string+=get_day_pali_string(left.day).suff;
  823. left_language_string+=pali_left_end;
  824. }
  825. else{
  826. left_language_string+=get_year_pali_string(left.year);
  827. left_language_string+=get_month_pali_string(left.month).suff+"ca, ";
  828. left_language_string+=get_day_pali_string(left.day).suff;
  829. left_language_string+=pali_left_end;
  830. }
  831. pres_language_string+=get_year_name(pres.year).string_1;
  832. pres_language_string+=get_month_name(pres.month,pres.day).string_1;
  833. pres_language_string+=get_week_day_name(week_day).string_1;
  834. switch(currLanguage){
  835. case "sinhala":
  836. for(i_sinhala in char_unicode_to_si_n){
  837. eval("past_language_string=past_language_string.replace(/"+char_unicode_to_si_n[i_sinhala].id+"/g,char_unicode_to_si_n[i_sinhala].value);");
  838. eval("pres_language_string=pres_language_string.replace(/"+char_unicode_to_si_n[i_sinhala].id+"/g,char_unicode_to_si_n[i_sinhala].value);");
  839. eval("left_language_string=left_language_string.replace(/"+char_unicode_to_si_n[i_sinhala].id+"/g,char_unicode_to_si_n[i_sinhala].value);");
  840. }
  841. break;
  842. case "myanmar":
  843. for(r_to_m_i in char_roman_to_myn){
  844. eval("past_language_string=past_language_string.replace(/"+char_roman_to_myn[r_to_m_i].id+"/g,char_roman_to_myn[r_to_m_i].value);");
  845. eval("pres_language_string=pres_language_string.replace(/"+char_roman_to_myn[r_to_m_i].id+"/g,char_roman_to_myn[r_to_m_i].value);");
  846. eval("left_language_string=left_language_string.replace(/"+char_roman_to_myn[r_to_m_i].id+"/g,char_roman_to_myn[r_to_m_i].value);");
  847. }
  848. break;
  849. default:
  850. past_language_string=past_language_string.charAt(0).toUpperCase()+past_language_string.slice(1);
  851. left_language_string=left_language_string.charAt(0).toUpperCase()+left_language_string.slice(1);
  852. //pres_language_string=pres_language_string;
  853. var new_string=pres_language_string.charAt(0).toUpperCase();
  854. new_string+=pres_language_string.split('\. ')[0].slice(1)+". ";
  855. new_string+=pres_language_string.split('\. ')[1].charAt(0).toUpperCase();
  856. new_string+=pres_language_string.split('\. ')[1].slice(1);
  857. pres_language_string=new_string;
  858. }
  859. $('#past_string').html(past_language_string);
  860. $('#pres_string').html(pres_language_string);
  861. $('#left_string').html(left_language_string);
  862. }
  863. function get_year_pali_string(year){
  864. if(year>999){
  865. year=year.toString()
  866. Tp=year.charAt(0)*1000;
  867. Hp=year.charAt(1)*100;
  868. Sp=year.slice(2,4);
  869. }
  870. for(i_year in pali_num_str){
  871. if(Tp==pali_num_str[i_year].id){
  872. var Tp_string=pali_num_str[i_year].value;
  873. }
  874. if(Hp==pali_num_str[i_year].id){
  875. var Hp_string=pali_num_str[i_year].value;
  876. }
  877. if(Sp==pali_num_str[i_year].id){
  878. var Sp_string=pali_num_str[i_year].value;
  879. }
  880. }
  881. if(year==1){
  882. var year_pali_end=" saṃvaccharaṃ ceva, ";
  883. }
  884. else{
  885. var year_pali_end=" saṃvaccharāni ";
  886. }
  887. var year_string=Tp_string+"-"+Hp_string+"-"+Sp_string+year_pali_end;
  888. return(year_string);
  889. }
  890. function get_month_pali_string(month){
  891. var month_obj=new Object;
  892. if(month>=2){
  893. month=month.toString();
  894. for(i_month in pali_num_str_pl){
  895. if(month==pali_num_str_pl[i_month].id){
  896. var month_num_string=pali_num_str_pl[i_month].value;
  897. }
  898. }
  899. month_obj.suff=month_num_string+" māsāni "
  900. month_obj.pre="";
  901. }
  902. else if(month==1){
  903. month_obj.suff="dve-pakkhāni";
  904. month_obj.pre="eka-māsādhika-";
  905. }
  906. else if(month==0){
  907. month_obj.suff="";
  908. month_obj.pre="";
  909. }
  910. return(month_obj);
  911. }
  912. function get_day_pali_string(day){
  913. var day_obj=new Object;
  914. if(day>=2){
  915. day=day.toString();
  916. for(i_day in pali_num_str_pl){
  917. if(day==pali_num_str_pl[i_day].id){
  918. var day_num_string=pali_num_str_pl[i_day].value;
  919. }
  920. }
  921. day_obj.suff=day_num_string+" divasāni "
  922. day_obj.pre="";
  923. }
  924. else if(day==1){
  925. day_obj.suff="";
  926. day_obj.pre="eka-divasādhika-";
  927. }
  928. else if(day==0){
  929. day_obj.suff="";
  930. day_obj.pre="";
  931. }
  932. return(day_obj);
  933. }
  934. function get_year_name(year){
  935. var year_num=year%12;
  936. var year_name_string=new Object;
  937. for(i_year_name in pali_year_name){
  938. if(year_num==pali_year_name[i_year_name].id){
  939. year_name_string.value=pali_year_name[i_year_name].value;
  940. year_name_string.icon=pali_year_name[i_year_name].icon;
  941. }
  942. }
  943. year_name_string.string_0 ="<div><span class='BE_icon_span'>"+local_gui.year_0+"</span>";
  944. year_name_string.string_0+=year_name_string.icon+"</div>";
  945. year_name_string.string_1="ayaṃ "+year_name_string.value+"-saṃvacchare ";
  946. return(year_name_string);
  947. }
  948. function uposatha_calculator(month,day){
  949. var day_obj=new Object;
  950. if(month%2==1){
  951. var days_per_month=30;
  952. }
  953. else{
  954. var days_per_month=29;
  955. }
  956. if(days_per_month==30){
  957. if(day<=15){
  958. day_obj.day=day;
  959. day_obj.pakkha="kāla";
  960. day_obj.pakkha_icon="🌖→🌑";
  961. if(day==15){
  962. day_obj.uposatha=true;
  963. }
  964. else{
  965. day_obj.uposatha=false;
  966. }
  967. }
  968. else{
  969. day_obj.day=day-15;
  970. day_obj.pakkha="sukka";//🌕🌗🌗🌒🌓🌔🌝🌚🌞🌜🌛
  971. day_obj.pakkha_icon="🌒→🌕";
  972. if(day==30){
  973. day_obj.uposatha=true;
  974. }
  975. else{
  976. day_obj.uposatha=false;
  977. }
  978. }
  979. }
  980. else if(days_per_month==29){
  981. if(day<=14){
  982. day_obj.day=day;
  983. day_obj.pakkha="kāla";
  984. day_obj.pakkha_icon="🌖→🌑";
  985. if(day==14){
  986. day_obj.uposatha=true;
  987. }
  988. else{
  989. day_obj.uposatha=false;
  990. }
  991. }
  992. else{
  993. day_obj.day=day-14;
  994. day_obj.pakkha="sukka";
  995. day_obj.pakkha_icon="🌒→🌕";
  996. if(day==29){
  997. day_obj.uposatha=true;
  998. }
  999. else{
  1000. day_obj.uposatha=false;
  1001. }
  1002. }
  1003. }
  1004. return(day_obj);
  1005. }
  1006. function get_month_name(month,day){
  1007. var return_string=new Object;
  1008. for(i_month_name in pali_month_name){
  1009. if(month==pali_month_name[i_month_name].id){
  1010. var month_name_string=pali_month_name[i_month_name].value;
  1011. var season_name_string=pali_month_name[i_month_name].season;
  1012. var season_icon_string=pali_month_name[i_month_name].season_icon;
  1013. }
  1014. }
  1015. return_string.string_0 ="<div><span class='BE_icon_span'>"+local_gui.season+"</span>";
  1016. return_string.string_0+=season_icon_string+"</div>";
  1017. return_string.string_0+="<div><span class='BE_icon_span'>"+local_gui.month+"</span>";
  1018. return_string.string_0+=month_name_string+"</div>";
  1019. return_string.string_1=season_name_string+"-utu. "
  1020. return_string.string_1+="asmiṃ utumhi "+month_name_string+"-māsassa ";
  1021. var day_object=uposatha_calculator(month,day);
  1022. for(i_day_name in pali_date_name){
  1023. if(day_object.day==pali_date_name[i_day_name].id){
  1024. day_name_string=pali_date_name[i_day_name].value;
  1025. var day_num_string=day_object.day
  1026. }
  1027. }
  1028. var pakkha_name_string=day_object.pakkha+"-pakkhe "+day_name_string;
  1029. return_string.string_0+="<div><span class='BE_icon_span'>"+local_gui.pakkha+"</span>";
  1030. return_string.string_0+=day_object.pakkha_icon+"</div>";
  1031. return_string.string_0+="<div><span class='BE_icon_span'>"+local_gui.date+"</span>";
  1032. return_string.string_0+=day_num_string+"</div>";
  1033. return_string.string_1+=pakkha_name_string+", ";
  1034. return(return_string);
  1035. }
  1036. function get_week_day_name(week_day){
  1037. var week_day_string=new Object;
  1038. for(i_week in pali_week_day_name){
  1039. if(week_day==pali_week_day_name[i_week].id){
  1040. week_day_string.string_0=pali_week_day_name[i_week].value
  1041. week_day_string.string_1=pali_week_day_name[i_week].value
  1042. }
  1043. }
  1044. week_day_string.string_0="<div><span class='BE_icon_span'>"+local_gui.week_day+"</span>"+week_day_string.string_0+"</div>";
  1045. week_day_string.string_1+="-varamidan’ti daṭṭhabbaṃ."
  1046. return(week_day_string);
  1047. }
  1048. </script>