1 |
<?php
|
2 |
require_once("style/shared/cpuusagestatclock.inc");
|
3 |
?>
|
4 |
<?php
|
5 |
//********************************************************************************
|
6 |
//Copyright (C) 2015 David T. Ashley
|
7 |
//********************************************************************************
|
8 |
//This program or source file is free software; you can redistribute it and/or
|
9 |
//modify it under the terms of the GNU General Public License as published by
|
10 |
//the Free Software Foundation; either version 2 of the License, or (at your
|
11 |
//option) any later version.
|
12 |
//
|
13 |
//This program or source file is distributed in the hope that it will
|
14 |
//be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
//GNU General Public License for more details.
|
17 |
//
|
18 |
//You may have received a copy of the GNU General Public License
|
19 |
//along with this program; if not, write to the Free Software
|
20 |
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21 |
//********************************************************************************
|
22 |
//This class defines standard styles (HTML styles, ways of doing things)
|
23 |
//for web or all types, including pages with static content, dynamic content,
|
24 |
//file upload, and calculation pages. This class helps
|
25 |
//to ensure that any changes to the way of thinking about style are
|
26 |
//centralized in one place.
|
27 |
//
|
28 |
class StdWpStyle
|
29 |
{
|
30 |
var $cpu_time_clock;
|
31 |
//Used to remember snapshots to calculate CPU time.
|
32 |
|
33 |
//The constructor function. Among other things, collects CPU usage
|
34 |
//statistics for later display.
|
35 |
function StdWpStyle()
|
36 |
{
|
37 |
$this->cpu_time_clock = new Cpuusagestatclock;
|
38 |
$this->cpu_time_clock->start();
|
39 |
}
|
40 |
|
41 |
//Dumps out the standard header for a static page where browser or proxy
|
42 |
//caching is acceptable.
|
43 |
//The page title is what is displayed by the
|
44 |
//browser, while the HTML title is what goes in big letters at the top of the
|
45 |
//page. Size and alignment should be set here, italics if necessary can be
|
46 |
//put in the passed string. The description is text below the header to
|
47 |
//say a little bit more about the page.
|
48 |
function static_page_header_title_std($Pagetitle, $Htmltitle, $Desc)
|
49 |
{
|
50 |
echo "<html>\n";
|
51 |
echo "<head>\n";
|
52 |
echo "<title>" . $Pagetitle . "</title>\n";
|
53 |
echo "</head>\n";
|
54 |
echo "<body background=\"/bkgnds/bk_garlic.jpg\">\n";
|
55 |
echo "<p align=\"center\"><b><font size=\"6\">" . $Htmltitle . "</font></b></p>\n";
|
56 |
if (strlen($Desc))
|
57 |
{
|
58 |
echo "<p align=\"center\"><b><font size=\"5\">(" . $Desc . ")</font></b></p>\n";
|
59 |
}
|
60 |
$this->static_page_hrule_std();
|
61 |
}
|
62 |
|
63 |
//Prints the message about clicking on thumbnails, plus optionally the horizontal rule.
|
64 |
//$multiple_pics dictates whether the message is in the singular or plural.
|
65 |
function static_page_photo_thumbnail_explanation($b_multiple_pics, $b_horizontal_rule)
|
66 |
{
|
67 |
if ($b_multiple_pics)
|
68 |
{
|
69 |
echo "<p align=\"center\">\n";
|
70 |
echo " (Click on any of the thumbnails below to view the full-sized photo.)\n";
|
71 |
echo "</p>\n";
|
72 |
}
|
73 |
else
|
74 |
{
|
75 |
echo "<p align=\"center\">\n";
|
76 |
echo " (Click on the thumbnail below to view the full-sized photo.)\n";
|
77 |
echo "</p>\n";
|
78 |
}
|
79 |
|
80 |
if ($b_horizontal_rule)
|
81 |
{
|
82 |
$this->static_page_hrule_std();
|
83 |
}
|
84 |
}
|
85 |
|
86 |
|
87 |
//This function tallies up the used CPU time and prints out the standard footer which
|
88 |
//includes this information for a static page.
|
89 |
function static_page_footer_std()
|
90 |
{
|
91 |
$this->static_page_hrule_std();
|
92 |
|
93 |
//Stop the cpu clock.
|
94 |
$this->cpu_time_clock->stop();
|
95 |
|
96 |
//Record a time string.
|
97 |
$today = date("g:i:s a (e) \o\\n F j, Y.");
|
98 |
|
99 |
echo "<p align=\"center\" style=\"margin-top: -2; margin-bottom: 0\">\n";
|
100 |
echo " <font size=\"2\">\n";
|
101 |
echo " Local time on the server (at the time this page was served) is "
|
102 |
. $today
|
103 |
. " \n";
|
104 |
echo " " . $this->cpu_time_clock->std_web_page_cpu_time_usage_footer() . " \n";
|
105 |
echo " This page is maintained by <a href=\"mailto:dashley@gmail.com\">David T. Ashley</a>.\n";
|
106 |
|
107 |
echo " </font>\n";
|
108 |
echo "</p>\n";
|
109 |
echo "<hr noshade size=\"5\">\n";
|
110 |
echo "</body>\n";
|
111 |
echo "</html>\n";
|
112 |
}
|
113 |
|
114 |
|
115 |
//Dumps out the standard horizontal rule for separating sections for a static page. The rule for
|
116 |
//hacking up functionality is that the page application is responsible to use these
|
117 |
//rules except first after the header and last before the footer.
|
118 |
function static_page_hrule_std()
|
119 |
{
|
120 |
echo "<hr>\n";
|
121 |
}
|
122 |
}
|
123 |
?>
|