Source for file profiler.phtml

Documentation is available at profiler.phtml

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework - Profiler screen template.
  5. 5:  *
  6. 6:  * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
  7. 7:  *
  8. 8:  * This source file is subject to the "Nette license" that is bundled
  9. 9:  * with this package in the file license.txt.
  10. 10:  *
  11. 11:  * For more information please see http://nettephp.com
  12. 12:  *
  13. 13:  * @author     David Grudl
  14. 14:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  15. 15:  * @license    http://nettephp.com/license  Nette license
  16. 16:  * @link       http://nettephp.com
  17. 17:  * @category   Nette
  18. 18:  * @package    Nette
  19. 19:  *
  20. 20:  * @param      array     $colophons 
  21. 21:  * @return     void 
  22. 22:  */
  23. 23:  
  24. 24:  
  25. 25:  
  26. 26: ?>
  27. 27:  
  28. 28: <style type="text/css">
  29. 29: /* <![CDATA[ */
  30. 30:     #netteProfilerContainer {
  31. 31:         position: fixed;
  32. 32:         _position: absolute;
  33. 33:         right: 5px;
  34. 34:         bottom: 5px;
  35. 35:         z-index: 23178;
  36. 36:     }
  37. 37:  
  38. 38:     #netteProfiler {
  39. 39:         font: normal normal 11px/1.4 Consolas, Arial;
  40. 40:         position: relative;
  41. 41:         padding: 3px;
  42. 42:         color: black;
  43. 43:         background: #EEE;
  44. 44:         border: 1px dotted gray;
  45. 45:         cursor: move;
  46. 46:         opacity: .70;
  47. 47:         =filter: alpha(opacity=70);
  48. 48:     }
  49. 49:  
  50. 50:     #netteProfiler * {
  51. 51:         color: inherit;
  52. 52:         background: inherit;
  53. 53:         text-align: inherit;
  54. 54:     }
  55. 55:  
  56. 56:     #netteProfilerIcon {
  57. 57:         position: absolute;
  58. 58:         right: 0;
  59. 59:         top: 0;
  60. 60:         line-height: 1;
  61. 61:         padding: 2px;
  62. 62:         color: black;
  63. 63:         text-decoration: none;
  64. 64:     }
  65. 65:  
  66. 66:     #netteProfiler:hover {
  67. 67:         opacity: 1;
  68. 68:         =filter: none;
  69. 69:     }
  70. 70:  
  71. 71:     #netteProfiler ul {
  72. 72:         margin: 0;
  73. 73:         padding: 0;
  74. 74:         width: 350px;
  75. 75:     }
  76. 76:  
  77. 77:     #netteProfiler li {
  78. 78:         margin: 0;
  79. 79:         padding: 1px;
  80. 80:         text-align: left;
  81. 81:         list-style: none;
  82. 82:     }
  83. 83:  
  84. 84:     #netteProfiler span[title] {
  85. 85:         border-bottom: 1px dotted gray;
  86. 86:         cursor: help;
  87. 87:     }
  88. 88:  
  89. 89:     #netteProfiler strong {
  90. 90:         color: red;
  91. 91:     }
  92. 92: /* ]]> */
  93. 93: </style>
  94. 94:  
  95. 95:  
  96. 96: <div id="netteProfilerContainer">
  97. 97: <div id="netteProfiler">
  98. 98:     <a id="netteProfilerIcon" href="#"><abbr>&#x25bc;</abbr></a
  99. 99:     ><ul>
  100. 100:     <?php foreach ($colophons as $callback)?>
  101. 101:     <?php foreach ((array) call_user_func($callback'profiler'as $line)?><li><?php echo $line"\n" ?></li><?php endforeach ?>
  102. 102:     <?php endforeach ?>
  103. 103:     </ul>
  104. 104: </div>
  105. 105: </div>
  106. 106:  
  107. 107:  
  108. 108: <script type="text/javascript">
  109. 109: /* <![CDATA[ */
  110. 110: document.getElementById('netteProfiler').onmousedown = function(e) {
  111. 111:     e = e || event;
  112. 112:     this.posX = parseInt(this.style.left + '0');
  113. 113:     this.posY = parseInt(this.style.top + '0');
  114. 114:     this.mouseX = e.clientX;
  115. 115:     this.mouseY = e.clientY;
  116. 116:  
  117. 117:     var thisObj = this;
  118. 118:  
  119. 119:     document.documentElement.onmousemove = function(e) {
  120. 120:         e = e || event;
  121. 121:         thisObj.style.left = (e.clientX - thisObj.mouseX + thisObj.posX) + "px";
  122. 122:         thisObj.style.top = (e.clientY - thisObj.mouseY + thisObj.posY) + "px";
  123. 123:         return false;
  124. 124:     };
  125. 125:  
  126. 126:     document.documentElement.onmouseup = function(e) {
  127. 127:         document.documentElement.onmousemove = null;
  128. 128:         document.documentElement.onmouseup = null;
  129. 129:         document.cookie = 'netteProfilerPosition=' + thisObj.style.left + ':' + thisObj.style.top + '; path=/';
  130. 130:         return false;
  131. 131:     };
  132. 132: };
  133. 133:  
  134. 134: document.getElementById('netteProfilerIcon').onclick = function(e) {
  135. 135:     var arrow = this.getElementsByTagName('abbr')[0];
  136. 136:     var panel = this.nextSibling;
  137. 137:     var collapsed = panel.currentStyle ? panel.currentStyle.display == 'none' : getComputedStyle(panel, null).display == 'none';
  138. 138:  
  139. 139:     arrow.innerHTML = collapsed ? String.fromCharCode(0x25bc) : 'Profiler ' + String.fromCharCode(0x25ba);
  140. 140:     panel.style.display = collapsed ? 'block' : 'none';
  141. 141:     arrow.parentNode.style.position = collapsed ? 'absolute' : 'static';
  142. 142:  
  143. 143:     document.cookie = 'netteProfilerVisible=' + collapsed*1 + '; path=/';
  144. 144:     return false;
  145. 146:  
  146. 147: document.body.appendChild(document.getElementById('netteProfilerContainer'));
  147. 148:  
  148. 149: if (document.cookie.indexOf('netteProfilerVisible=0') > -1) {
  149. 150:     document.getElementById('netteProfilerIcon').onclick();
  150. 152:  
  151. 153: var _nettePos = document.cookie.match(/netteProfilerPosition=([0-9-]+px):([0-9-]+px)/);
  152. 154: if (_nettePos) {
  153. 155:     document.getElementById('netteProfiler').style.left = _nettePos[1];
  154. 156:     document.getElementById('netteProfiler').style.top = _nettePos[2];
  155. 158: /* ]]> */
  156. 159: </script>