The raditex-library.php

This is the raditex-library.php.

source-highlight -n --input=raditex-library.php --output=src/raditex-library.php.html
001: <?php
002: 
003: //----------------------------------------------------------------------
004: //
005: //----------------------------------------------------------------------
006: function page_start()
007: {
008: 
009: //    header('Content-type: text/html; charset=utf-8');
010:     
011:     print("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
012:     echo "<html>";
013:     
014: }
015: 
016: function download_link($link, $save_as, $text)
017: {
018: 
019:     printf("<a class='download' href='%s' download='%s'>%s</a>", $link, $save_as, $text);
020: 
021: 
022: }
023: 
024: //----------------------------------------------------------------------
025: //
026: //----------------------------------------------------------------------
027: function page_header($header_image="http://192.168.37.35/~gorhas/images/raditex-banner-35h.png", $info="No info at the moment")
028: {
029: 
030:     echo "<head>";
031:     echo "<link rel='stylesheet' type='text/css' href='libs/rbis-standard.css'>";
032:     echo "<link rel='stylesheet' type='text/css' href='raditex-priv.css'>";
033: //    echo "<link rel='stylesheet' href='raditex-tutorial-print.css' type='text/css' media='print' />";
034:     echo "<body>";
035:     printf("<div class='top_banner'><a href='http://www.raditex.nu/'><img src='%s' height='35px'></a>", $header_image);
036: 
037:     printf("<div class='top_banner_info'>%s</div>", $info);
038: 
039:     echo "</div>";
040: 
041: //    echo "<div class='top_banner_print'><a href='http://www.raditex.nu/'><img src='http://www.raditex.nu/images/raditex-banner.png'></a></div>";
042: 
043: //    include($menu);
044: 
045:     $menu = array("The menu" => "slask.php",
046:                   "Other menu" => "slask2.php");
047:     
048:     
049: 
050: }
051: 
052: function current_page_name()
053: {
054:      return substr($_SERVER["SCRIPT_NAME"], strrpos($_SERVER["SCRIPT_NAME"],"/") + 1);
055: }
056: 
057: //----------------------------------------------------------------------
058: //
059: //----------------------------------------------------------------------
060: function page_menu($menu)
061: {
062: 
063:      $state = "";
064: 
065:      echo "<div class='menu'>";
066:      foreach($menu as $key => $value)
067:      {
068: 
069:           $state = (current_page_name() == "$value" ) ? "active" : "";
070: 
071:           // printf("State: %s", $state ); 
072: 
073:           if($state == "active")
074:           {
075:           //echo "<li class='" . $state . "'><a class='the-page-menu' href='" . $value . "'>" . $key . "</a></li>";
076:                echo "<a href='" . $value . "'><button class='button_active'>" . $key . "</button></a>";
077:           }
078:           else
079:           {
080:                echo "<a  href='" . $value . "'><button class='button_not_active'>" . $key . "</button></a>";
081:           }
082:      }
083: 
084:      //page_drop_down_menu("The dropdown", $menu);
085: 
086:      echo "</div>";
087: 
088: }
089: 
090: //----------------------------------------------------------------------
091: //
092: //----------------------------------------------------------------------
093: function page_drop_down_menu($menu)
094: {
095: 
096:     echo "<div id='cssmenu' class='top_menu'>";
097:     echo "<ul>";
098: 
099:     foreach($menu as $menu_text => $key_1)
100:     {
101:         if(is_array($key_1))
102:         {
103:             printf ("<li class='has-sub'><a href='#'>%s</a>", $menu_text);
104:         }
105:         else
106:         {
107:             printf ("<li class='has-sub'><a href='%s'>%s</a>", $key_1, $menu_text);
108:         }
109:         echo "<ul>";
110:         
111:         if(is_array($key_1))
112:         { 
113:             
114:             foreach($key_1 as $menu_sub_text => $link)
115:             {
116:                 
117:                 echo "<li><a href='" . $link . "'>" . $menu_sub_text . "</a></li>";
118:             }
119:             
120:         }
121: 
122:         echo "</ul>";
123:         echo "</li>";
124:     }
125:     
126:     echo "</ul>";
127:     echo "</div>";
128: }
129: 
130: //----------------------------------------------------------------------
131: //
132: //----------------------------------------------------------------------
133: function drop_down_start()
134: {
135:     echo "<div id='cssmenu' class='top_menu'>";
136: //    echo "<div class='nav_wrapper'>";
137: //    echo "<nav class='nav_menu'>";
138:     echo "<ul>";
139: }
140: 
141: //----------------------------------------------------------------------
142: //
143: //----------------------------------------------------------------------
144: function drop_down_end()
145: {
146:     echo "</ul>";
147: //    echo "</nav>";
148:     echo "</div>";
149: }
150: 
151: //----------------------------------------------------------------------
152: //
153: //----------------------------------------------------------------------
154: function page_row_start()
155: {
156:     echo "<div class='page_row'>";
157: }
158: 
159: function page_column_start_left()
160: {
161: 
162:     echo "<div class='page_column_left'>";
163: 
164: }
165: 
166: function page_column_start_right()
167: {
168: 
169:     echo "<div class='page_column_right'>";
170: 
171: }
172: 
173: function page_column_end()
174: {
175: 
176:     echo "</div>";
177: 
178: }
179: 
180: 
181: function page_row_end()
182: {
183: 
184:     echo "</div>";
185: 
186: }
187: 
188: function html_ul_start()
189: {
190: 
191:     echo "<ul class='unordered_list'>";
192: }
193: 
194: function html_ul_item($item)
195: {
196: 
197:     printf("<li>%s</li>", $item);
198: 
199: }
200: 
201: function html_ul_end()
202: {
203: 
204:     echo "</ul>";
205: }
206: 
207: function rweb_graph($id, $class, $width, $height, $json_data)
208: {
209: 
210: 
211:     printf("<div id='graphContainer'></div>", $id);
212: 
213: //    printf("<script>");
214: 
215: //    printf("var margin = {top: 20, right: 50, bottom: 30, left: 50}, " .
216: //         "width = %s - margin.left - margin.right, " .
217: //         "height = %s - margin.top - margin.bottom; ", $width, $height );
218: 
219: //    printf("var svg = d3.select('#graphContainer').append('svg')" .
220: //         ".attr('width', width + margin.left + margin.right)" .
221: //         ".attr('height', height + margin.top + margin.bottom)" .
222: //         ".attr('width', %s)" .
223: //         ".attr('height', %s)" .
224: //         ".attr('opacity', 1)" .
225:     //.style("stroke", "blue")
226:     //.style("fill", "green")
227: //         ".style('background', '#CCFFFF')" .
228: 
229:     //.style("border", "2px solid red")
230: //         ".on('mousedown', mouseDown)" .
231: //         ".on('mouseup', mouseUp)" .
232: //         ".on('click', mouseClick)" .
233: //         ".on('mousemove', mouseMove)" .
234: //         ".append('g')" .
235: //         ".attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");" , $id, $width, $height );
236: 
237: //    printf("</script>");
238: 
239: 
240: 
241: 
242: }
243: 
244: //----------------------------------------------------------------------
245: //
246: //----------------------------------------------------------------------
247: function html_pre($pre_text)
248: {
249: 
250:     echo "<pre><div class='preformatted_code'>";
251: 
252:     echo htmlspecialchars($pre_text, ENT_COMPAT , 'UTF-8');
253: 
254:     echo "</div></pre>";
255: 
256: }
257: 
258: function html_img($file, $width=600, $caption="Caption")
259: {
260: 
261:     global $fig_nr;
262: 
263:     $fig_nr++;
264: 
265:     printf("<div class='image_frame'>");
266:     printf("<img class='image' src='%s' width='%s' alt='Picutre lost'>", $file, $width);
267:     printf("<div class='image_caption'>");
268:     printf("Fig %d:  %s", $fig_nr, $caption);
269:     printf("</div>");
270:     printf("</div>");
271: 
272: 
273: }
274: 
275: 
276: //----------------------------------------------------------------------
277: //
278: //----------------------------------------------------------------------
279: function show_source_html($file)
280: {
281: 
282:     echo "<div class='code'>";
283:     include_once($file);
284:     echo "</div>";
285: 
286: }
287: 
288: //----------------------------------------------------------------------
289: //
290: //----------------------------------------------------------------------
291: function show_source_elipsis($file)
292: {
293:     echo "<pre><tt>";
294:     echo "<div class='code'>";
295:     echo "...\n";
296:     include_once($file);
297:     echo "...\n";
298:     echo "</div>";
299:     echo "</tt></pre>";
300: }
301: 
302: function page_footer($prev_page="http://www.raditex.nu/", $prev_page_text="Raditex homepage", $next_page="http://www.raditex.nu/", $next_page_text="Raditex homepage")
303: {
304:     echo "<div class='footer'>";
305:     
306:     echo "<div class='footer-left'>";
307:     echo "<a href='" . $prev_page . "'><button class='button_footer'>" . $prev_page_text ."</button></a>";
308:     echo "</div>";
309: 
310:     echo "Copyright: Raditex control AB, <a href='http://www.raditex.nu/'>http://www.raditex.nu</a>";
311: 
312:     echo "<div class='footer-right'>";
313:     echo "<a href='" . $next_page . "'><button class='button_footer'>" . $next_page_text ."</button></a>";
314:     echo "</div>";
315: 
316:     echo "</div>";
317: 
318:     echo "</body>";
319: }
320: 
321: function page_end()
322: {
323:     echo "</html>";
324: //    print("<script src='boo-library-utils.js' type='text/javascript'></script>\n");
325:     print("<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>\n");
326: }
327: 
328: //----------------------------------------------------------------------
329: //
330: //----------------------------------------------------------------------
331: // titles, paragraphs and text layouts                                                                                              
332: //                                  
333: function html_h($title, $level=1, $fg_color='000000', $bg_color='FFFFFF')
334: {
335:     printf("<div class='body_heading' style='color: #%s; background: #%s;'><h%d>%s</h%d></div>", $fg_color, $bg_color, $level, $title, $level);
336: }
337: 
338: function html_p($text)
339: {
340:     printf("<p class='body_text'>%s</p>", $text);
341: }
342: //----------------------------------------------------------------------
343: //
344: //----------------------------------------------------------------------
345: ?>
346: