GMSchedule.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <?php
  2. function startdb(){
  3. //Include the db configuration file. It's somehow like this
  4. /*
  5. <?php
  6. $host = 'XXXX';
  7. $db_name = 'XXXX';
  8. $username_ro = 'XXXX';
  9. $username_rw = 'XXXX';
  10. $pass_ro = 'XXXX';
  11. $pass_rw = 'XXXX';
  12. ?>
  13. */
  14. include('.htpasswd');
  15. //Connect to to database
  16. $con = mysqli_connect($host, $username_rw, $pass_rw, $db_name);
  17. //Set encoding options
  18. mysqli_set_charset($con, 'utf-8');
  19. header('Content-Type: text/html; charset=utf8');
  20. mysqli_query($con, 'SET NAMES utf8;');
  21. //Return the db connection
  22. return $con;
  23. }
  24. ?>
  25. <html>
  26. <head>
  27. <style>
  28. @media print {
  29. div#header, div.day, div.meetings{
  30. page-break-after: always;
  31. }
  32. body{
  33. background: #ffffff;
  34. filter: initial;
  35. font-size: 80%;
  36. color: #ff0000;
  37. }
  38. }
  39. @font-face{
  40. font-family: font;
  41. src: url('/font/FreeSans.ttf')
  42. }
  43. body{
  44. font-family: font;
  45. margin: 2em;
  46. /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#b5d3e5+0,e5f4ff+10,e5f4ff+90,b5d3e5+100 */
  47. /*background: #b5d3e5; */
  48. /*background: -moz-linear-gradient(left, #b5d3e5 0%, #e5f4ff 10%, #e5f4ff 90%, #b5d3e5 100%);*/ /* FF3.6-15 */
  49. /*background: -webkit-linear-gradient(left, #b5d3e5 0%,#e5f4ff 10%,#e5f4ff 90%,#b5d3e5 100%);*/ /* Chrome10-25,Safari5.1-6 */
  50. /*background: linear-gradient(to right, #b5d3e5 0%,#e5f4ff 10%,#e5f4ff 90%,#b5d3e5 100%);*/ /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
  51. /*filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b5d3e5', endColorstr='#b5d3e5',GradientType=1 );(/ /* IE6-9 */
  52. }
  53. div#header{
  54. width: 100%;
  55. text-align: center;
  56. margin-top: 18em;
  57. }
  58. div#header div#title{
  59. display: inline;
  60. vertical-align: middle;
  61. width: 90%;
  62. margin-top: 2em;
  63. background-color: #0078ff;
  64. color: #ffffff;
  65. border-top-right-radius: 0.5em;
  66. border-bottom-right-radius: 0.5em;
  67. border: 0.3em solid #0045cc;
  68. padding: 4em 4em 4em 0em;
  69. }
  70. div#header div#title img{
  71. display: inline-block;
  72. /*width: 6em;*/
  73. /*height: 6em;*/
  74. vertical-align: middle;
  75. margin: -1em 1em -1em -2em;
  76. -webkit-filter: drop-shadow(0 0 0.4em #dde);
  77. filter: drop-shadow(0 0 0.4em #dde);
  78. border: 0.1em solid #000011;
  79. border-radius: 100%;
  80. -ms-filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#dde')";
  81. filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#dde')";
  82. }
  83. div#header div#title h2{
  84. display: inline-block;
  85. font-size: 5em;
  86. margin: 0.5em;
  87. vertical-align: middle;
  88. }
  89. div#header h4{
  90. display: inline-block;
  91. margin: 1em auto 2em auto;
  92. padding: 4em 2em 7em 2em;
  93. color: #ffffff;
  94. font-weight: bold;
  95. font-size: 4em;
  96. text-shadow: -0.02em 0 black, 0 0.02em black, 0.02em 0 black, 0 -0.02em #0045cc;
  97. background: -moz-radial-gradient(center, ellipse cover, rgba(0,120,255,1) 10%, rgba(255,255,255,0) 67%, rgba(255,255,255,0) 100%); /* ff3.6+ */
  98. background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(10%, rgba(0,120,255,1)), color-stop(67%, rgba(255,255,255,0)), color-stop(100%, rgba(255,255,255,0))); /* safari4+,chrome */
  99. background:-webkit-radial-gradient(center, ellipse cover, rgba(0,120,255,1) 10%, rgba(255,255,255,0) 67%, rgba(255,255,255,0) 100%); /* safari5.1+,chrome10+ */
  100. background: -o-radial-gradient(center, ellipse cover, rgba(0,120,255,1) 10%, rgba(255,255,255,0) 67%, rgba(255,255,255,0) 100%); /* opera 11.10+ */
  101. background: -ms-radial-gradient(center, ellipse cover, rgba(0,120,255,1) 10%, rgba(255,255,255,0) 67%, rgba(255,255,255,0) 100%); /* ie10+ */
  102. background:radial-gradient(ellipse at center, rgba(0,120,255,1) 10%, rgba(255,255,255,0) 67%, rgba(255,255,255,0) 100%); /* w3c */
  103. filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0078ff', endColorstr='#ffffff',GradientType=1 ); /* ie6-9 */
  104. }
  105. div#header h3{
  106. color: #ffffff;
  107. font-weight: bold;
  108. font-size: 5em;
  109. text-shadow: -0.04em 0 #000033, 0 0.04em #000033, 0.04em 0 #000033, 0 -0.04em #000033;
  110. display: inline-block;
  111. margin: -8em auto 2em auto;
  112. }
  113. div#header span#warning{
  114. color: #ff0000;
  115. font-weight: bold;
  116. font-size: 1.5em;
  117. text-shadow: -0.04em 0 #000033, 0 0.04em #000033, 0.04em 0 #000033, 0 -0.04em #000033;
  118. display: inline-block;
  119. margin: -12em -7em 2em 7em;
  120. -ms-transform: rotate(-30deg); /* IE 9 */
  121. -webkit-transform: rotate(-30deg); /* Chrome, Safari, Opera */
  122. transform: rotate(-30deg);
  123. }
  124. div#header table#contact{
  125. color: #0056cc;
  126. font-weight: bold;
  127. margin: auto 0 auto auto;
  128. /*text-shadow: -0.02em 0 #000000, 0 0.02em #000000, 0.02em 0 #000000, 0 -0.02em #000000;*/
  129. /*text-shadow: -0.08em 0.3em black, 0.3em 0.08em black, 0.08em 0.3em black, 0.3em -0.08em #black;*/
  130. }
  131. div#header table#contact img{
  132. height: 2em;
  133. width: 2em;
  134. }
  135. div.tarifas table td{
  136. vertical_align: middle;
  137. border-top: 0.07em solid #999999;
  138. padding: 1em;
  139. }
  140. div.tarifas table td.price{
  141. text-align: right;
  142. width: 4em;
  143. }
  144. div.tarifas table td.info{
  145. padding-left: 4em;
  146. color:initial;
  147. text-align: center;
  148. }
  149. div.tarifas table td.warning{
  150. padding-left: 4em;
  151. color: red;
  152. font-weight: bold;
  153. text-align: center;
  154. }
  155. div.meetings td{
  156. color: initial;
  157. padding: 1em;
  158. }
  159. div.meetings table.location td.pinpoint{
  160. width: 2em;
  161. }
  162. div.meetings table.location img{
  163. margin-left: 1em;
  164. margin-right: 0.5em;
  165. }
  166. div.meetings table.location span.place{
  167. color: #444444;
  168. font-size: 0.9em;
  169. }
  170. div.meetings span.address{
  171. color: #666666;
  172. margin-left: 0.5em;
  173. font-style: italic;
  174. font-size: 0.8em;
  175. }
  176. div.day,div.tarifas, div.meetings{
  177. border-left: 0.1em solid #000011;
  178. border-right: 0.1em solid #000011;
  179. border-bottom: 0.1em solid #000011;
  180. border-top-right-radius: 1em;
  181. border-top-left-radius: 1em;
  182. max-width: 80em;
  183. margin: 2em auto 2em auto;
  184. padding: 0 0 0.4em 0;
  185. background-color: #0078ff;
  186. -webkit-filter: drop-shadow(0 0 1em #0078ff);
  187. filter: drop-shadow(0 0 1em #0078ff);
  188. -ms-filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#000011')";
  189. filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#000011')";
  190. }
  191. div.day h3,div.tarifas h3, div.meetings h3{
  192. font-size: 110%;
  193. font-style: bold;
  194. color: #ffffff;
  195. background-color: #0078ff;
  196. padding: 0.5em 2em 0.1em 1.5em;
  197. border-top-left-radius: 0.7em;
  198. border-top-right-radius: 0.7em;
  199. border: 0.1em solid #000011;
  200. margin: 0;
  201. }
  202. div.day table.day_content, div.tarifas table, div.meetings table{
  203. width: 100%;
  204. /*border-spacing: 10px;*/
  205. border-collapse: collapse;
  206. background-color: #ffffff;
  207. margin: 0;
  208. }
  209. div.day table.day_content td{
  210. padding: 0;
  211. }
  212. div.day table.day_content td.time{
  213. width: 3em;
  214. text-align: right;
  215. color: #275573;
  216. font-size: 1.2em;
  217. font-weight: bold;
  218. padding: 0.3em 0.5em 0.3em 0.3em;
  219. vertical-align: top;
  220. border-top: 0.07em solid #999999;
  221. }
  222. div.day table.day_content td.timeline{
  223. text-align:center;
  224. border-left: 0.2em dotted #999999;
  225. border-top: 0.07em solid #999999;
  226. vertical-align: top;
  227. }
  228. div.day table.day_content td.timeline img{
  229. width: 1.1em;
  230. height: 1.1em;
  231. margin: 0.4em -1.4em 0 -1.4em;
  232. }
  233. div.day table.day_content td.info{
  234. border-top: 0.07em solid #999999;
  235. vertical-align: top;
  236. padding: 0.3em 0.5em 0.3em 0.8em;
  237. }
  238. div.day table.day_content td.info h4, div.tarifas table td h4, div.meetings table td h4{
  239. color: #275573;
  240. /*letter-spacing: 0.07em;*/
  241. font-size: 1.2em;
  242. font-weight: bold;
  243. margin: 0 0 0.2em 0em;
  244. }
  245. div.day table.day_content td.info p, div.tarifas table td span{
  246. font-style: italic;
  247. /*letter-spacing: 0.07em;*/
  248. color: #222222;
  249. font-size: 1em;
  250. margin: 0 1em 0.5em 0.3em;
  251. }
  252. div.day table.day_content td.info table.location img{
  253. margin-left: 1em;
  254. margin-right: 0.5em;
  255. }
  256. div.day table.day_content td.info table.location span.place{
  257. color: #444444;
  258. font-size: 0.9em;
  259. }
  260. div.day table.day_content td.info table.location span.address{
  261. color: #666666;
  262. margin-left: 0.5em;
  263. font-style: italic;
  264. font-size: 0.8em;
  265. }
  266. </style>
  267. </head>
  268. <body>
  269. <?php
  270. $con = startdb();
  271. $lang = strtolower($_GET['l']);
  272. if ($lang != 'es' && $lang!= 'en' && $lang != 'eu'){
  273. $lang = 'es';
  274. }
  275. // TODO: Get current year
  276. $year = 2017;
  277. ?>
  278. <div id='header'>
  279. <div id='title'>
  280. <img src='https://margolariak.com/img/logo/GasetizkoMargolariak.png' />
  281. <h2>Gasteizko Margolariak</h2>
  282. </div>
  283. <?php
  284. switch($lang){
  285. case 'eu':
  286. $title = "Andre Maria Zuriaren jaiak egunetarako";
  287. $warning = "";//"Behin-behineko !!";
  288. break;
  289. case 'en':
  290. $title = "La Blanca Festivals schedule.";
  291. $warning = "";//"Provisional !!";
  292. break;
  293. case 'es':
  294. $title = "Programa Margolari<br/>Fiestas de La Blanca";
  295. $warning = "";//"¡¡ Provisional !!";
  296. break;
  297. }
  298. ?>
  299. <br/>
  300. <h4><?=$title?></h4>
  301. <br/>
  302. <h3><?=$year?></h3>
  303. <br/>
  304. <span id="warning"><?=$warning?></span>
  305. <br/><br/><br/><br/><br/><br/><br/>
  306. <table id='contact'>
  307. <tr>
  308. <td>
  309. <img src='https://margolariak.com/img/social/whatsapp.png'/>
  310. </td>
  311. <td>
  312. 637 14 03 71
  313. </td>
  314. </tr>
  315. <tr>
  316. <td>
  317. <img src='https://margolariak.com/img/social/mail.png'/>
  318. </td>
  319. <td>
  320. gasteizko@margolariak.com
  321. </td>
  322. </tr>
  323. <tr>
  324. <td>
  325. <img src='https://margolariak.com/img/social/twitter.png'/>
  326. </td>
  327. <td>
  328. @gmargolariak
  329. </td>
  330. </tr>
  331. </table>
  332. </div>
  333. <br/><br/>
  334. <div class='tarifas'>
  335. <?php
  336. $title = "";
  337. switch($lang){
  338. case 'es':
  339. $title = "Tarifas y ofertas";
  340. break;
  341. case 'en':
  342. $title = "Prices and offers";
  343. break;
  344. case 'eu':
  345. $title = "Prezioak eta eskaintzak";
  346. }
  347. ?>
  348. <h3><?=$title?></h3>
  349. <table>
  350. <?php
  351. $q_day = mysqli_query($con, "SELECT id, name_$lang AS name, DATE_FORMAT(date, '%e') AS day, DATE_FORMAT(date, '%c') AS month, price FROM festival_day WHERE date >= str_to_date('$year-00-00', '%Y-%m-%d') AND date <= str_to_date('$year-12-31', '%Y-%m-%d') ORDER BY date;");
  352. while ($r = mysqli_fetch_array($q_day)){
  353. $day = $r['day'];
  354. $month_n = $r['month'];
  355. $title = "";
  356. switch($lang){
  357. case 'es':
  358. if ($month_n == '8'){
  359. $title = "$day de agosto";
  360. }
  361. else{
  362. $title = "$day de julio";
  363. }
  364. break;
  365. case 'en':
  366. if ($month_n == '8'){
  367. $title = "August " . $day . "th";
  368. }
  369. else{
  370. $title = "July " . $day . "th";
  371. }
  372. break;
  373. case 'eu':
  374. if ($month_n == '8'){
  375. $title = "Abustuaren " . $day . "a";
  376. }
  377. else{
  378. $title = "Uztailaren " . $day . "a";
  379. }
  380. break;
  381. }
  382. ?>
  383. <tr>
  384. <td>
  385. <h4><?=$title?> - <?=$r['name']?></h4>
  386. </td>
  387. <td class='price'>
  388. <h4><?=$r['price']?> €</h4>
  389. </td>
  390. </tr>
  391. <?php
  392. }
  393. $q_offer = mysqli_query($con, "SELECT name_$lang AS name, description_$lang AS description, price FROM festival_offer WHERE year = $year;");
  394. while ($r = mysqli_fetch_array($q_offer)){
  395. ?>
  396. <tr>
  397. <td>
  398. <h4><?=$r['name']?></h4>
  399. <span><?=$r['description']?></span>
  400. </td>
  401. <td class='price'>
  402. <h4><?=$r['price']?> €</h4>
  403. </td>
  404. </tr>
  405. <?php
  406. }
  407. ?>
  408. <tr>
  409. <td class='info'>
  410. Para apuntarte, solo tienes que hacer el ingreso correspondiente en la cuenta de Gasteizko Margolariak
  411. <br/><br/>
  412. ES91 3035 0012 71 0120111936 de la Caja Laboral
  413. <br/><br/>
  414. indicando tu nombre y apellidos en el concepto. Si coges d&iacute;as sueltos o el pack de 3 d&iacute;as, deber&aacute;s indicar adem&aacute;s los d&iacute;as.
  415. </td>
  416. <td>
  417. </td>
  418. </tr>
  419. <tr>
  420. <td class='warning'>
  421. ¡Importante! El &uacute;ltimo d&iacute;a para realizar los ingresos es el 15 de julio.
  422. </td>
  423. <td>
  424. </td>
  425. </tr>
  426. </table>
  427. </div>
  428. <br/><br/><br/><br/>
  429. <div class='meetings'>
  430. <?php
  431. $title = "";
  432. switch($lang){
  433. case 'es':
  434. $title = "Reuniones";
  435. break;
  436. case 'en':
  437. $title = "Meetings";
  438. break;
  439. case 'eu':
  440. $title = "Bilerak";
  441. }
  442. ?>
  443. <h3><?=$title?></h3>
  444. <table>
  445. <tr>
  446. <td>
  447. Antes de Fiestas, se organizar&aacute;n dos reuniones informativas, donde adem&aacute;s podr&aacute;s recoger las pulseras de control, parches, pines...
  448. </td>
  449. </tr>
  450. <tr>
  451. <td>
  452. <h4>Domingos 9 y 23 de julio, 20:00</h4>
  453. <table class="location">
  454. <tr>
  455. <td class='pinpoint'><img src="https://margolariak.com/img/misc/pinpoint.png"></td>
  456. <td>
  457. <span class="place">Café Prado</span>
  458. <br>
  459. <span class="address">C/. Felicia Olave, S/N</span>
  460. </td>
  461. </tr>
  462. </table>
  463. </td>
  464. </tr>
  465. </table>
  466. </div>
  467. <?php
  468. // Gey day list
  469. $q = mysqli_query($con, "SELECT id, name_$lang AS name, DATE_FORMAT(date, '%e') AS day, DATE_FORMAT(date, '%c') AS month FROM festival_day WHERE date >= str_to_date('$year-00-00', '%Y-%m-%d') AND date <= str_to_date('$year-12-31', '%Y-%m-%d') UNION SELECT 0, '' AS name, 10 AS day, 8 AS month FROM dual;");
  470. while ($r = mysqli_fetch_array($q)){
  471. $day = $r['day'];
  472. $month_n = $r['month'];
  473. $title = "";
  474. switch($lang){
  475. case 'es':
  476. if ($month_n == '8'){
  477. $title = "$day de agosto";
  478. }
  479. else{
  480. $title = "$day de julio";
  481. }
  482. break;
  483. case 'en':
  484. if ($month_n == '8'){
  485. $title = "August " . $day . "th";
  486. }
  487. else{
  488. $title = "July " . $day . "th";
  489. }
  490. break;
  491. case 'eu':
  492. if ($month_n == '8'){
  493. $title = "Abustuaren " . $day . "a";
  494. }
  495. else{
  496. $title = "Uztailaren " . $day . "a";
  497. }
  498. break;
  499. }
  500. if (strlen($r['name']) > 0){
  501. $title = "$title - $r[name]";
  502. }
  503. ?>
  504. <br/><br/>
  505. <div class='day'>
  506. <h3><?=$title?></h3>
  507. <table class='day_content'>
  508. <?php
  509. $s_date = date_create_from_format('Y-m-d H:i', "$year-0" . $month_n . "-$day 07:00");
  510. $e_date = date_create_from_format('Y-m-d H:i', "$year-0" . $month_n . "-$day 06:59");
  511. $e_date = date_add($e_date, date_interval_create_from_date_string('1 days'));
  512. $s_date = date_format($s_date, 'Y-m-d H:i');
  513. $e_date = date_format($e_date, 'Y-m-d H:i');
  514. $q_e = mysqli_query($con, "SELECT festival_event.id AS id, title_$lang AS title, description_$lang AS description, name_$lang AS place, address_$lang AS address, DATE_FORMAT(start, '%k:%i') AS time FROM festival_event, place WHERE place.id = place AND gm = 1 AND start >= str_to_date('$s_date', '%Y-%m-%d %H:%i') AND start <= str_to_date('$e_date', '%Y-%m-%d %H:%i') ORDER BY start;");
  515. while ($r_e = mysqli_fetch_array($q_e)){
  516. ?>
  517. <tr>
  518. <td class='time'><?=$r_e['time']?></td>
  519. <td class='timeline'>
  520. <img src='https://margolariak.com/img/misc/schedule-point.png'>
  521. </td>
  522. <td class='info'>
  523. <h4><?=$r_e['title']?></h4>
  524. <p><?=$r_e['description']?></p>
  525. <table class='location'>
  526. <tr>
  527. <td><img src='https://margolariak.com/img/misc/pinpoint.png'/></td>
  528. <td>
  529. <span class='place'><?=$r_e['place']?></span>
  530. <br/>
  531. <span class='address'><?=$r_e['address']?></span>
  532. </td>
  533. </tr>
  534. </table>
  535. </td>
  536. </tr>
  537. <?php
  538. }
  539. ?>
  540. </table> <!-- .day_content -->
  541. <?php
  542. //}
  543. ?>
  544. </div> <!-- .day -->
  545. <?php
  546. }
  547. ?>
  548. </body>
  549. </html>