interface.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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, vitae tractatos philosophia ius ei, per id causae integre voluptatibus. An iusto rationibus concludaturque vix, ei dicat admodum minimum vix. Vim ne eruditi scripserit. Nonumy dolorem ex eum, te quo aliquid mnesarchum, ea mel dico populo. Accumsan platonem salutandi te mei, nostro epicurei per ea. Sed ut nonumy sapientem, stet postea periculis eu nec, et purto erat facilisis sed.
  23. ";
  24. $GLOBALS['SAMPLE_TITLE'] = "Lorem ipsum dolor sit amet";
  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.'jush/jush.css');
  30. $oTemplate->addJs(BX_DOL_URL_PLUGINS.'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-img bx-def-margin-right"><img src="template/images/icons/clock.png" /></button>
  143. <button class="bx-btn bx-btn-img bx-def-margin-right"><img src="template/images/icons/clock.png"><u>Button</u></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-img bx-def-margin-right"><img src="template/images/icons/clock.png" /></button>
  150. <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>
  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-red1"></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. <div class="bx-btn-group">
  170. <button class="bx-btn bx-def-margin-right">Button</button>
  171. <button class="bx-btn bx-def-margin-right">Shmatton</button>
  172. <button class="bx-btn bx-def-margin-right">Tratton</button>
  173. </div>
  174. <?php
  175. $aBlocks['.bx-btn-group'] = ob_get_clean();
  176. return FormatBlocks($aBlocks);
  177. }
  178. function Samples_PaddingsMargins()
  179. {
  180. $aBlocks = array ();
  181. ob_start();
  182. ?>
  183. <div class="bx-def-border bx-def-padding">
  184. <?=$GLOBALS['SAMPLE_TEXT']; ?>
  185. </div>
  186. <?php
  187. $aBlocks['.bx-def-padding'] = ob_get_clean();
  188. ob_start();
  189. ?>
  190. <div class="bx-def-border bx-def-padding-left bx-def-padding-right">
  191. <?=$GLOBALS['SAMPLE_TEXT']; ?>
  192. </div>
  193. <?php
  194. $aBlocks['.bx-def-padding-left .bx-def-padding-right'] = ob_get_clean();
  195. ob_start();
  196. ?>
  197. <div class="bx-def-border bx-def-padding-sec">
  198. <?=$GLOBALS['SAMPLE_TEXT']; ?>
  199. </div>
  200. <?php
  201. $aBlocks['.bx-def-padding-sec'] = ob_get_clean();
  202. ob_start();
  203. ?>
  204. <div class="bx-clearfix">
  205. <div class="sample-box bx-def-margin-left"></div>
  206. <div class="sample-box bx-def-margin-left"></div>
  207. </div>
  208. <?php
  209. $aBlocks['.bx-def-margin-left'] = ob_get_clean();
  210. ob_start();
  211. ?>
  212. <div class="bx-clearfix">
  213. <div class="sample-box bx-def-margin-left-auto"></div>
  214. <div class="sample-box bx-def-margin-left-auto"></div>
  215. </div>
  216. <?php
  217. $aBlocks['.bx-def-margin-left-auto'] = ob_get_clean();
  218. ob_start();
  219. ?>
  220. <div class="bx-def-border bx-clearfix">
  221. <div class="sample-box bx-def-margin-sec"></div>
  222. <div class="sample-box bx-def-margin-sec"></div>
  223. <div class="sample-box bx-def-margin-sec"></div>
  224. </div>
  225. <?php
  226. $aBlocks['.bx-def-margin-sec'] = ob_get_clean();
  227. ob_start();
  228. ?>
  229. <div class="bx-def-border bx-clearfix bx-def-padding-thd">
  230. <div class="sample-box bx-def-margin-thd"></div>
  231. <div class="sample-box bx-def-margin-thd"></div>
  232. <div class="sample-box bx-def-margin-thd"></div>
  233. </div>
  234. <?php
  235. $aBlocks['.bx-def-padding-thd and .bx-def-margin-thd'] = ob_get_clean();
  236. return FormatBlocks($aBlocks);
  237. }
  238. function Samples_Colors()
  239. {
  240. $aBlocks = array ();
  241. $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');
  242. foreach ($aClasses as $sClass) {
  243. ob_start();
  244. ?>
  245. <div class="bx-def-border sample-box-empty <?=$sClass; ?>">
  246. </div>
  247. <?php
  248. $aBlocks['.' . implode(" .", explode(' ', $sClass))] = ob_get_clean();
  249. }
  250. return FormatBlocks($aBlocks);
  251. }
  252. function Samples_BordersCornersShadow()
  253. {
  254. $aBlocks = array ();
  255. $aClasses = array ('bx-def-border', 'bx-def-border-left bx-def-border-bottom', 'bx-def-border bx-def-round-corners', 'bx-def-round-corners-with-border', 'bx-def-shadow');
  256. foreach ($aClasses as $sClass) {
  257. ob_start();
  258. ?>
  259. <div class="sample-box-empty <?=$sClass; ?>">
  260. </div>
  261. <?php
  262. $aBlocks['.' . implode(" .", explode(' ', $sClass))] = ob_get_clean();
  263. }
  264. return FormatBlocks($aBlocks);
  265. }
  266. function Samples_ThumbsIconsUnits()
  267. {
  268. $aBlocks = array ();
  269. $aClasses = array ('bx-def-thumb bx-def-thumb-size', 'bx-def-icon bx-def-icon-size');
  270. foreach ($aClasses as $sClass) {
  271. ob_start();
  272. ?>
  273. <img class="<?=$sClass; ?>" src="http://farm8.staticflickr.com/7413/10593220664_99831fab5a_q.jpg" />
  274. <?php
  275. $aBlocks['.' . implode(" .", explode(' ', $sClass))] = ob_get_clean();
  276. }
  277. ob_start();
  278. ?>
  279. <div class="bx-def-unit">
  280. <a href="javascript:void(0);"><img class="bx-def-thumb bx-def-thumb-size" src="http://farm8.staticflickr.com/7413/10593220664_99831fab5a_q.jpg" /></a>
  281. <div class="bx-def-unit-info bx-def-thumb-size-max-height bx-def-padding-left">
  282. <span class="bx-def-font-large">Some info here</span><br />
  283. <span class="bx-def-font-grayed">additional info</span>
  284. </div>
  285. </div>
  286. <?php
  287. $aBlocks['.bx-def-unit .bx-def-thumb'] = ob_get_clean();
  288. ob_start();
  289. ?>
  290. <div class="bx-def-unit">
  291. <a href="javascript:void(0);"><img class="bx-def-icon bx-def-icon-size" src="http://farm8.staticflickr.com/7413/10593220664_99831fab5a_q.jpg" /></a>
  292. <div class="bx-def-unit-info bx-def-icon-size-max-height bx-def-padding-sec-left">
  293. Some info here
  294. </div>
  295. </div>
  296. <?php
  297. $aBlocks['.bx-def-unit .bx-def-icon'] = ob_get_clean();
  298. return FormatBlocks($aBlocks);
  299. }
  300. function Samples_Fonts()
  301. {
  302. $aBlocks = array ();
  303. $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');
  304. foreach ($aClasses as $sClass => $sSampleText) {
  305. ob_start();
  306. ?>
  307. <div class="<?=$sClass; ?>">
  308. <?=$GLOBALS[$sSampleText]; ?>
  309. </div>
  310. <?php
  311. $aBlocks['.' . implode(" .", explode(' ', $sClass))] = ob_get_clean();
  312. }
  313. return FormatBlocks($aBlocks);
  314. }
  315. function FormatBlocks ($aBlocks) {
  316. $s = '<section class="bx-def-padding-top">';
  317. foreach ($aBlocks as $sCaption => $sBlock) {
  318. $s .= '<hr class="bx-def-hr bx-def-margin-topbottom" />';
  319. $s .= '<div>' . $sBlock . '</div>';
  320. $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>';
  321. }
  322. $s .= '</section>';
  323. return $s;
  324. }
  325. /** @} */