1
0

interface.php 13 KB

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