Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.13 KB | None | 0 0
  1. function golwebdes_seminar_output () {
  2.  
  3. include('golwebdes_conf.inc.php');
  4.  
  5. setlocale(LC_TIME, 'de_DE.utf8');
  6.  
  7. global $wpdb;
  8.  
  9. $seminare = $seminare_gki;
  10.  
  11. if (isset($_GET['semid'])) { // Einzelseminar
  12. $sql = "SELECT * FROM ".$seminare." WHERE id=".$_GET['semid'];
  13. $result = $wpdb->get_row($sql) or die(mysql_error());
  14. $html = '<div class="container-fluid">';
  15.  
  16. $kateg = $result->kategorie;
  17. $html .= '<div class="col-sm-12"><div class="row" style="margin-bottom:3%;">
  18. <div class="col-sm-3">
  19. <img src="/pics/icon-workshops-indien.gif" alt="" class="img-responsive">
  20. </div>
  21. <div class="col-sm-9" style="padding-left:3%;">';
  22. $html .= '<p><span class="small">'.$seminarkategorien[$kateg].'</span><br><span style="font-weight:bold;">'.$result->titel.'</span></p>';
  23. $html .= '<p>'.$result->kurzinfo.'</p>';
  24. $html .= '<p>'.$result->beschreibung.'</p>';
  25. $html .= '<p>'.$result->inhalt.'</p>';
  26.  
  27.  
  28. /**** BEGINN - Erzeugen der Termine: Ort Datum Anmeldelink ***/
  29. $termine='';
  30.  
  31. /* 1 */
  32. if ($result->ort1!='')
  33. $ort1 = $result->ort1;
  34.  
  35. if ($result->datum_beginn1!=0) {
  36. if ($result->datum_ende1!=0) {
  37. if (date("m",$result->datum_beginn1) == date("m",$result->datum_ende1))
  38. $datum1 = date("j.",$result->datum_beginn1)."/".date("j.",$result->datum_ende1).strftime(" %B %Y", strtotime(date("m/d/Y", $result->datum_beginn1)));
  39. }
  40. else
  41. $datum1 = date("j.",$result->datum_beginn1).strftime(" %B %Y", strtotime(date("m/d/Y", $result->datum_beginn1)));
  42. }
  43. else
  44. $datum1 = "Termin folgt.";
  45.  
  46. if ($result->datum_ende1 !=0 && $result->datum_ende1 >= time())
  47. $termin1 = "<strong>".$ort1."</strong> ".$datum1." <a href="#" class="anmeldung" onclick="window.open('seminaranmeldung.php?s=".$result->id."&o=1','anmeldung','').focus();return false;" >zur Anmeldung</a>";
  48. else if ($result->datum_ende1 ==0 && $result->datum_beginn1 !=0 && $result->datum_beginn1 >= time())
  49. $termin1 = "<strong>".$ort1."</strong> ".$datum1." <a href="#" onclick="window.open('seminaranmeldung.php?s=".$result->id."&o=1','anmeldung','').focus();return false;" class="anmeldung">zur Anmeldung</a>";
  50. else if ($result->datum_beginn1 ==0)
  51. $termin1 = $ort1." ".$datum1;
  52.  
  53. $termine = $termine.$termin1.'<br>';
  54.  
  55.  
  56. /* 2 */
  57. if ($result->ort2!='')
  58. $ort2 = $result->ort2;
  59.  
  60. if ($result->datum_beginn2!=0) {
  61. if ($result->datum_ende2!=0) {
  62. if (date("m",$result->datum_beginn2) == date("m",$result->datum_ende2))
  63. $datum2 = date("j.",$result->datum_beginn2)."/".date("j.",$result->datum_ende2).strftime(" %B %Y", strtotime(date("m/d/Y", $result->datum_beginn2)));
  64. }
  65. else
  66. $datum2 = date("j.",$result->datum_beginn2).strftime(" %B %Y", strtotime(date("m/d/Y", $result->datum_beginn2)));
  67. }
  68. else
  69. $datum2 = "Termin folgt.";
  70.  
  71. if ($result->datum_ende2 !=0 && $result->datum_ende2 >= time())
  72. $termin2 = "<strong>".$ort2."</strong> ".$datum2." <a href="#" class="anmeldung" onclick="window.open('seminaranmeldung.php?s=".$result->id."&o=2','anmeldung','').focus();return false;" >zur Anmeldung</a>";
  73. else if ($result->datum_ende2 ==0 && $result->datum_beginn2 !=0 && $result->datum_beginn2 >= time())
  74. $termin2 = "<strong>".$ort2."</strong> ".$datum2." <a href="#" class="anmeldung" onclick="window.open('seminaranmeldung.php?s=".$result->id."&o=2','anmeldung','').focus();return false;" >zur Anmeldung</a>";
  75. else if ($result->datum_beginn2 ==0)
  76. $termin2 = $ort2." ".$datum2;
  77.  
  78.  
  79. $termine = $termine.$termin2.'<br>';
  80.  
  81. <div id="ajax-register-modal">
  82. <input type="text" id="ajax-username" placeholder="<?php _e( 'Username', 'text-domain' ); ?>"/>
  83. <input type="password" id="ajax-password" placeholder="<?php _e( 'Password', 'text-domain' ); ?>"/>
  84. <span id="register-modal-send"><?php _e( 'Register', 'text-domain' ); ?></span>
  85. </div>
  86.  
  87. jQuery('#YourLinkID').click(function($){
  88. $('#ajax-register-modal').toggle();
  89. });
  90.  
  91. jQuery('#register-modal-send').click(function($){
  92. registerTheUser();
  93. });
  94.  
  95. function registerTheUser(){
  96. // Get the field values for username and password
  97. var username = $('#ajax-username').val();
  98. var password = $('#ajax-password').val();
  99. // Send them to server via AJAX
  100. jQuery.ajax({
  101. type: 'GET',
  102. url: 'REST URL HERE',
  103. data: { ajaxUsername: username , ajaxPassword: password},
  104. });
  105. }
  106.  
  107. add_action( 'rest_api_init', function () {
  108. //Path to REST route for registration
  109. register_rest_route( 'LarryG001/v2', '/ajax_registration/', array(
  110. 'methods' => 'GET', // I suggest using POST
  111. 'callback' => 'register_the_user' // Callback PHP function
  112. ) );
  113. });
  114.  
  115. function register_the_user(){
  116. // Get the username and password
  117. $username = $_GET['ajaxUsername'];
  118. $password = $_GET['ajaxPassword'];
  119. // A basic creation of user based on username and password. Email is optional
  120. $id = wp_create_user( $username, $password, $email );
  121. // Return the ID of the new user
  122. return $id;
  123. }
  124.  
  125. http://example.com/wp-json/LarryG001/v2/ajax_registration/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement