interface.php 13 KB

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