interface.php 13 KB

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