1
0

popup.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCoreSamples Samples
  7. * @{
  8. */
  9. /**
  10. * @page samples
  11. * @section popup Popups
  12. */
  13. $aPathInfo = pathinfo(__FILE__);
  14. require_once ($aPathInfo['dirname'] . '/../inc/header.inc.php');
  15. require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
  16. if( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) {
  17. sleep(2); // to see AJAX loader
  18. echo date(DATE_RFC822);
  19. exit;
  20. }
  21. $oTemplate = BxDolTemplate::getInstance();
  22. $oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
  23. $oTemplate->setPageHeader ("Sample popup");
  24. $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
  25. $oTemplate->getPageCode();
  26. /**
  27. * page code function
  28. */
  29. function PageCompMainCode()
  30. {
  31. ob_start();
  32. // transBox
  33. echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-transbox', '<div class="bx-def-padding">transBox</div>', true);
  34. echo '<div></div><button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-transbox\').dolPopup()">transBox</button>';
  35. // transBox AJAX
  36. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(window).dolPopupAjax({url: \'samples/popup.php?_t=a'.time().'\'})">transBox AJAX</button>';
  37. // popupBox
  38. echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box', 'popupBox', 'popupBox content', true);
  39. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-box\').dolPopup()">popupBox</button>';
  40. // popupBox without fog
  41. echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-without-fog', 'popupBox', 'popupBox without fog content', true);
  42. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-box-without-fog\').dolPopup({fog:0})">popupBox without fog</button>';
  43. echo '<div class="bx-clear"></div>';
  44. echo '<hr class="bx-def-hr" />';
  45. // transBox
  46. echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-transbox-scrolled', '<div class="bx-def-padding">' . str_repeat('transBox transBox transBox <br />', 100) . '</div>', true);
  47. echo '<div></div><button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-transbox-scrolled\').dolPopup()">transBox scrolled</button>';
  48. // popupBox
  49. echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-scrolled', 'popupBox', str_repeat('popupBox ', 1000), true);
  50. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-box-scrolled\').dolPopup()">popupBox scrolled</button>';
  51. echo '<div class="bx-clear"></div>';
  52. echo '<hr class="bx-def-hr" />';
  53. // transBox with pointer
  54. echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-transbox-with-pointer', '<div class="bx-def-padding">transBox with pointer</div>', true);
  55. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-transbox-with-pointer\').dolPopup({pointer:{el:$(this)}})">transBox with pointer</button>';
  56. // popupBox with pointer
  57. echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-with-pointer', 'popupBox', 'popupBox with pointer content', true);
  58. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-box-with-pointer\').dolPopup({pointer:{el:$(this)}})">popupBox with pointer</button>';
  59. // popupBox with pointer AJAX
  60. echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-with-pointer', 'popupBox', 'popupBox with pointer AJAX', true);
  61. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(this).dolPopupAjax({url: \'samples/popup.php?_t=b'.time().'\'})">popupBox with pointer AJAX</button>';
  62. echo '<div class="bx-clear"></div>';
  63. echo '<hr class="bx-def-hr" />';
  64. // image popup
  65. echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-image', '<img src="samples/img/landscape.jpg" />', true, true);
  66. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/landscape.jpg\', this)">popupImage (landscape)</button>';
  67. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/landscape_wide.jpg\', this)">popupImage (landscape wide)</button>';
  68. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/portrate.jpg\', this)">popupImage (portrate)</button>';
  69. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/portrate_thin.jpg\', this)">popupImage (portrate thin)</button>';
  70. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/small.jpg\', this)">popupImage (small)</button>';
  71. echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/square.jpg\', this)">popupImage (square)</button>';
  72. echo str_repeat('&nbsp; <br />', 100);
  73. return DesignBoxContent("Sample popup", ob_get_clean(), BX_DB_PADDING_DEF);
  74. }
  75. /** @} */