interface.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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 interface Interface
  12. */
  13. /**
  14. * Interface elements
  15. */
  16. $aPathInfo = pathinfo(__FILE__);
  17. require_once ($aPathInfo['dirname'] . '/../inc/header.inc.php');
  18. require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
  19. $GLOBALS['SAMPLE_TEXT'] = 'Lorem ipsum dolor sit amet, <b>vitae tractatos philosophia ius ei</b>, per id causae integre voluptatibus. An iusto <a href="javascript:void(0);">rationibus concludaturque vix</a>, ei dicat admodum minimum vix. Vim ne eruditi scripserit. Nonumy dolorem ex eum, <i>te quo aliquid mnesarchum</i>, ea mel dico populo. Accumsan platonem salutandi te mei, nostro epicurei per ea. Sed ut nonumy sapientem, <u>stet postea periculis eu nec</u>, et purto erat facilisis sed.
  20. ';
  21. $GLOBALS['SAMPLE_TITLE'] = 'Lorem ipsum dolor sit amet';
  22. $GLOBALS['SAMPLE_THUMB'] = 'modules/boonex/persons/template/images/no-picture-preview.png';
  23. $oTemplate = BxDolTemplate::getInstance();
  24. $oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
  25. $oTemplate->setPageHeader ("Interface elements");
  26. $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
  27. $oTemplate->addCss(BX_DOL_URL_PLUGINS_PUBLIC . 'jush/jush.css');
  28. $oTemplate->addJs(BX_DOL_URL_PLUGINS_PUBLIC . 'jush/jush.js');
  29. $oTemplate->addJs(BX_DOL_URL_ROOT . 'samples/jquery.smint.js');
  30. $oTemplate->getPageCode();
  31. /**
  32. * page code function
  33. */
  34. function PageCompMainCode()
  35. {
  36. ob_start();
  37. ?>
  38. <script>
  39. function samples_interface_toggle_code(e)
  40. {
  41. var ePre = $(e).parent().find('pre');
  42. if (!ePre.hasClass('syntax-highlighed')) {
  43. var s = ePre.html().replace(/\s+$/gm, '');
  44. ePre.html(jush.highlight('htm', s).replace(/\t/g, '&nbsp; &nbsp; ').replace(/(^|\n| ) /g, '$1&nbsp;'));
  45. ePre.addClass('syntax-highlighed');
  46. }
  47. ePre.toggle();
  48. }
  49. </script>
  50. <style>
  51. pre {
  52. display:none;
  53. border:1px solid #060;
  54. padding:5px;
  55. font-size:14px;
  56. max-height:200px;
  57. overflow:auto;
  58. }
  59. section hr:first-child {
  60. display:none;
  61. }
  62. section > div {
  63. box-sizing:border-box;
  64. -moz-box-sizing:border-box; /* Firefox */
  65. display:inline-block;
  66. width:50%;
  67. vertical-align:top;
  68. }
  69. section > div > h3 {
  70. margin:0;
  71. }
  72. .sample-box {
  73. float:left;;
  74. width:64px;
  75. height:64px;
  76. border:1px solid #966;
  77. background-color:#c99
  78. }
  79. .sample-box-empty {
  80. height:64px;
  81. }
  82. </style>
  83. <?php
  84. $s = ob_get_clean();
  85. $sMenu = '<ul class="samples-interface-menu">';
  86. $aSections = array (
  87. 'Buttons' => array ('title' => 'Buttons', 'desc' => '
  88. Using buttons with images is strictly discouraged - use font icons istead.'
  89. ),
  90. 'PaddingsMargins' => array ('title' => 'Paddings & margins', 'desc' => '
  91. 3 sizes are available: default, -sec, -thd. <br />
  92. Possible combination: -left, -right, -top, -bottom, -leftright, -rightbottomleft, -topbottom. <br />
  93. -auto is special suffix to be added for -left and -top margin combinations, if it is first then margin is 0. <br />
  94. -thd is special size to be used as padding and margin together to get proper spacing from borders and between items when several tiles are displayed.'
  95. ),
  96. 'BordersCornersShadow' => array ('title' => 'Borders, corners and shadow', 'desc' => '
  97. Possible combination of borders only: -left, -right, -top, -bottom, -rightbottomleft. <br />
  98. -auto is special suffix to be added for -top border, if element is first then there is no border.'
  99. ),
  100. 'ThumbsIconsUnits' => array ('title' => 'Thumbs, icons & units', 'desc' => '
  101. Additianl classes are available: bx-def-thumb-size-max-height, bx-def-thumb-size-min-height, bx-def-icon-size-max-height, bx-def-icon-size-min-height'
  102. ),
  103. 'Colors' => array ('title' => 'Colors', 'desc' => '
  104. <a href="samples/palette.php">Additional pallette</a> is also available.'
  105. ),
  106. 'Fonts' => array ('title' => 'Fonts', 'desc' => ''
  107. ),
  108. 'Form' => array ('title' => 'Form', 'desc' => '
  109. <a href="samples/forms.php">Form sample is here</a>'
  110. ),
  111. 'Grid' => array ('title' => 'Grid', 'desc' => '
  112. <a href="samples/grid.php">Grid sample is here</a>'
  113. ),
  114. 'DesignBoxes' => array ('title' => 'Design Boxes', 'desc' => '
  115. <a href="samples/designbox.php">Design boxes samples are here</a>'
  116. ),
  117. );
  118. foreach ($aSections as $sName => $a) {
  119. $sMenu .= '<li><a href="samples/interface.php#' . $sName . '">' . $a['title'] . '</a></li>';
  120. $s .= '<div id="' . $sName. '" class="bx-anchor bx-def-margin-top-auto">';
  121. $s .= '<hr class="bx-def-hr" />';
  122. $s .= '<hr class="bx-def-hr" />';
  123. $s .= '<h1 class="bx-def-margin-sec-topbottom bx-def-padding-sec-topbottom">' . $a['title'] . '</h1>';
  124. if ($a['desc'])
  125. $s .= '<p>' . $a['desc'] . '</p>';
  126. $sFunc = 'Samples_' . $sName;
  127. if (function_exists($sFunc))
  128. $s .= $sFunc();
  129. $s .= '</div>';
  130. }
  131. $sMenu .= '</ul>';
  132. return DesignBoxContent("Interface elements", $sMenu . $s, BX_DB_PADDING_NO_CAPTION);
  133. }
  134. function Samples_Buttons()
  135. {
  136. $aBlocks = array ();
  137. ob_start();
  138. ?>
  139. <button class="bx-btn bx-def-margin-right">Button</button>
  140. <button class="bx-btn bx-btn-primary bx-def-margin-right">Primary button</button>
  141. <button class="bx-btn bx-btn-disabled bx-def-margin-right">Disabled button</button>
  142. <?php
  143. $aBlocks['.bx-btn'] = ob_get_clean();
  144. ob_start();
  145. ?>
  146. <button class="bx-btn bx-btn-small bx-def-margin-right">Button</button>
  147. <button class="bx-btn bx-btn-small bx-btn-primary bx-def-margin-right">Primary button</button>
  148. <button class="bx-btn bx-btn-small bx-btn-disabled bx-def-margin-right">Disabled button</button>
  149. <?php
  150. $aBlocks['.bx-btn .bx-btn-small'] = ob_get_clean();
  151. ob_start();
  152. ?>
  153. <button class="bx-btn bx-def-margin-right"><i class="sys-icon fire-extinguisher"></i></button>
  154. <button class="bx-btn bx-def-margin-right"><i class="sys-icon fire-extinguisher sys-icon-bigger"></i></button>
  155. <button class="bx-btn bx-def-margin-right"><i class="sys-icon fire-extinguisher sys-icon-bigger col-red2"></i></button>
  156. <button class="bx-btn bx-def-margin-right"><i class="sys-icon fire-extinguisher"></i><u>Button</u></button>
  157. <?php
  158. $aBlocks['.bx-btn with icon'] = ob_get_clean();
  159. ob_start();
  160. ?>
  161. <button class="bx-btn bx-btn-small bx-def-margin-right"><i class="sys-icon fire-extinguisher"></i></button>
  162. <button class="bx-btn bx-btn-small bx-def-margin-right"><i class="sys-icon fire-extinguisher"></i><u>Button</u></button>
  163. <?php
  164. $aBlocks['.bx-btn .bx-btn-small with icon'] = ob_get_clean();
  165. ob_start();
  166. ?>
  167. <button class="bx-btn bx-btn-img bx-def-margin-right"><img src="template/images/icons/clock.png" /></button>
  168. <button class="bx-btn bx-btn-img bx-def-margin-right"><img src="template/images/icons/clock.png"><u>Button</u></button>
  169. <?php
  170. $aBlocks['.bx-btn with image'] = ob_get_clean();
  171. ob_start();
  172. ?>
  173. <button class="bx-btn bx-btn-small bx-btn-img bx-def-margin-right"><img src="template/images/icons/clock.png" /></button>
  174. <button class="bx-btn bx-btn-small bx-btn-img bx-def-margin-right"><img src="template/images/icons/clock.png" /><u>Button</u></button>
  175. <?php
  176. $aBlocks['.bx-btn .bx-btn-small with image'] = ob_get_clean();
  177. ob_start();
  178. ?>
  179. <div class="bx-btn-group">
  180. <button class="bx-btn bx-def-margin-right">Button</button>
  181. <button class="bx-btn bx-def-margin-right">Shmatton</button>
  182. <button class="bx-btn bx-def-margin-right">Tratton</button>
  183. </div>
  184. <?php
  185. $aBlocks['.bx-btn-group'] = ob_get_clean();
  186. return FormatBlocks($aBlocks);
  187. }
  188. function Samples_PaddingsMargins()
  189. {
  190. $aBlocks = array ();
  191. ob_start();
  192. ?>
  193. <div class="bx-def-border bx-def-padding">
  194. <?php echo $GLOBALS['SAMPLE_TEXT']; ?>
  195. </div>
  196. <?php
  197. $aBlocks['.bx-def-padding'] = ob_get_clean();
  198. ob_start();
  199. ?>
  200. <div class="bx-def-border bx-def-padding-left bx-def-padding-right">
  201. <?php echo $GLOBALS['SAMPLE_TEXT']; ?>
  202. </div>
  203. <?php
  204. $aBlocks['.bx-def-padding-left .bx-def-padding-right'] = ob_get_clean();
  205. ob_start();
  206. ?>
  207. <div class="bx-def-border bx-def-padding-sec">
  208. <?php echo $GLOBALS['SAMPLE_TEXT']; ?>
  209. </div>
  210. <?php
  211. $aBlocks['.bx-def-padding-sec'] = ob_get_clean();
  212. ob_start();
  213. ?>
  214. <div class="bx-clearfix">
  215. <div class="sample-box bx-def-margin-left"></div>
  216. <div class="sample-box bx-def-margin-left"></div>
  217. </div>
  218. <?php
  219. $aBlocks['.bx-def-margin-left'] = ob_get_clean();
  220. ob_start();
  221. ?>
  222. <div class="bx-clearfix">
  223. <div class="sample-box bx-def-margin-left-auto"></div>
  224. <div class="sample-box bx-def-margin-left-auto"></div>
  225. </div>
  226. <?php
  227. $aBlocks['.bx-def-margin-left-auto'] = ob_get_clean();
  228. ob_start();
  229. ?>
  230. <div class="bx-def-border bx-clearfix">
  231. <div class="sample-box bx-def-margin-sec"></div>
  232. <div class="sample-box bx-def-margin-sec"></div>
  233. <div class="sample-box bx-def-margin-sec"></div>
  234. </div>
  235. <?php
  236. $aBlocks['.bx-def-margin-sec'] = ob_get_clean();
  237. ob_start();
  238. ?>
  239. <div class="bx-def-border bx-clearfix bx-def-padding-thd">
  240. <div class="sample-box bx-def-margin-thd"></div>
  241. <div class="sample-box bx-def-margin-thd"></div>
  242. <div class="sample-box bx-def-margin-thd"></div>
  243. </div>
  244. <?php
  245. $aBlocks['.bx-def-padding-thd and .bx-def-margin-thd'] = ob_get_clean();
  246. return FormatBlocks($aBlocks);
  247. }
  248. function Samples_Colors()
  249. {
  250. $aBlocks = array ();
  251. $aClasses = array ('bx-def-color-bg-page', 'bx-def-color-bg-block', 'bx-def-color-bg-box', 'bx-def-color-bg-sec', 'bx-def-color-bg-active', 'bx-def-color-bg-hl', 'bx-def-color-bg-hl-hover');
  252. foreach ($aClasses as $sClass) {
  253. ob_start();
  254. ?>
  255. <div class="bx-def-border sample-box-empty <?php echo $sClass; ?>">
  256. </div>
  257. <?php
  258. $aBlocks['.' . implode(" .", explode(' ', $sClass))] = ob_get_clean();
  259. }
  260. return FormatBlocks($aBlocks);
  261. }
  262. function Samples_BordersCornersShadow()
  263. {
  264. $aBlocks = array ();
  265. $aClasses = array ('bx-def-border', 'bx-def-border-left bx-def-border-bottom', 'bx-def-border bx-def-round-corners', 'bx-def-shadow');
  266. foreach ($aClasses as $sClass) {
  267. ob_start();
  268. ?>
  269. <div class="sample-box-empty <?php echo $sClass; ?>">
  270. </div>
  271. <?php
  272. $aBlocks['.' . implode(" .", explode(' ', $sClass))] = ob_get_clean();
  273. }
  274. return FormatBlocks($aBlocks);
  275. }
  276. function Samples_ThumbsIconsUnits()
  277. {
  278. $aBlocks = array ();
  279. $aClasses = array ('bx-def-thumb bx-def-thumb-size', 'bx-def-icon bx-def-icon-size');
  280. foreach ($aClasses as $sClass) {
  281. ob_start();
  282. ?>
  283. <img class="<?php echo $sClass; ?>" src="<?php echo $GLOBALS['SAMPLE_THUMB']; ?>" />
  284. <?php
  285. $aBlocks['.' . implode(" .", explode(' ', $sClass))] = ob_get_clean();
  286. }
  287. ob_start();
  288. ?>
  289. <div class="bx-def-unit">
  290. <a href="javascript:void(0);"><img class="bx-def-thumb bx-def-thumb-size" src="<?php echo $GLOBALS['SAMPLE_THUMB']; ?>" /></a>
  291. <div class="bx-def-unit-info bx-def-thumb-size-max-height bx-def-padding-left">
  292. <span class="bx-def-font-large">Some info here</span><br />
  293. <span class="bx-def-font-grayed">additional info</span>
  294. </div>
  295. </div>
  296. <?php
  297. $aBlocks['.bx-def-unit .bx-def-thumb'] = ob_get_clean();
  298. ob_start();
  299. ?>
  300. <div class="bx-def-unit">
  301. <a href="javascript:void(0);"><img class="bx-def-icon bx-def-icon-size" src="<?php echo $GLOBALS['SAMPLE_THUMB']; ?>" /></a>
  302. <div class="bx-def-unit-info bx-def-icon-size-max-height bx-def-padding-sec-left">
  303. Some info here
  304. </div>
  305. </div>
  306. <?php
  307. $aBlocks['.bx-def-unit .bx-def-icon'] = ob_get_clean();
  308. return FormatBlocks($aBlocks);
  309. }
  310. function Samples_Fonts()
  311. {
  312. $aBlocks = array ();
  313. $aClasses = array ('' => 'SAMPLE_TEXT', 'bx-def-font-grayed' => 'SAMPLE_TEXT', 'bx-def-font-small' => 'SAMPLE_TEXT', 'bx-def-font-middle' => 'SAMPLE_TEXT', 'bx-def-font-large' => 'SAMPLE_TEXT', 'bx-def-font-h1' => 'SAMPLE_TITLE', 'bx-def-font-h2' => 'SAMPLE_TITLE', 'bx-def-font-h3' => 'SAMPLE_TITLE', 'bx-def-font-contrasted bx-def-font-h2 bg-col-green3' => 'SAMPLE_TITLE');
  314. foreach ($aClasses as $sClass => $sSampleText) {
  315. ob_start();
  316. ?>
  317. <div class="<?php echo $sClass; ?>">
  318. <?php echo $GLOBALS[$sSampleText]; ?>
  319. </div>
  320. <?php
  321. $aBlocks['.' . implode(" .", explode(' ', $sClass))] = ob_get_clean();
  322. }
  323. return FormatBlocks($aBlocks);
  324. }
  325. function FormatBlocks ($aBlocks)
  326. {
  327. $s = '<section class="bx-def-padding-top">';
  328. foreach ($aBlocks as $sCaption => $sBlock) {
  329. $s .= '<hr class="bx-def-hr bx-def-margin-topbottom" />';
  330. $s .= '<div>' . $sBlock . '</div>';
  331. $s .= '<div class="bx-def-padding-left"><h3>' . $sCaption . '</h3><a href="javascript:void(0);" onclick="samples_interface_toggle_code(this)">Toggle code</a><br /><pre>' . $sBlock . '</pre></div>';
  332. }
  333. $s .= '</section>';
  334. return $s;
  335. }
  336. /** @} */