3 require_once $gfwww.'include/Layout.class.php';
5 define('TOP_TAB_HEIGHT', 30);
6 define('BOTTOM_TAB_HEIGHT', 22);
8 class Theme extends Layout {
13 $this->doctype = 'strict';
14 $this->cssurls = array(
15 'http://yui.yahooapis.com/2.6.0/build/reset-fonts-grids/reset-fonts-grids.css',
16 'http://yui.yahooapis.com/2.6.0/build/base/base-min.css',
17 util_make_url ('/themes/css/fusionforge.css'),
18 $this->cssbaseurl .'theme.css',
19 $this->cssbaseurl .'theme-pages.css',
23 function bodyHeader($params) {
27 <table id="header" class="width-100p100">
30 <h1>'. util_make_link ('/', html_image('header/top-logo.png',192,54,array('alt'=>'FusionForge Home'))) .'</h1>
32 <td id="header-col2">';
38 $items = $this->navigation->getUserLinks();
39 for ($j = 0; $j < count($items['titles']); $j++) {
40 $links[] = util_make_link($items['urls'][$j], $items['titles'][$j],
41 array('class'=>'userlink'), true);
43 echo implode(' | ', $links);
45 plugin_hook ('headermenu', $params);
55 echo $this->outerTabs($params);
56 echo '<!-- inner tabs -->';
57 if (isset($params['group']) && $params['group']) {
58 echo $this->projectTabs($params['toptab'],$params['group']);
60 echo '<div id="maindiv">
64 function bodyFooter($params) {
69 function footer($params) {
71 <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
72 <div class="align-right">
73 ' . $this->navigation->getPoweredBy() . '
75 ' . $this->navigation->getShowSource() . '
85 * boxTop() - Top HTML box
87 * @param string Box title
88 * @param bool Whether to echo or return the results
89 * @param string The box background color
91 function boxTop($title, $id = '') {
93 <div id="' . $this->toSlug($id) . '" class="box-surround">
94 <div id="'. $this->toSlug($id) . '-title" class="box-title">
95 <div class="box-title-left">
96 <div class="box-title-right">
97 <h3 class="box-title-content" id="'. $this->toSlug($id) .'-title-content">'. $title .'</h3>
101 <div id="'. $this->toSlug($id) .'-content" class="box-content">
107 * boxMiddle() - Middle HTML box
109 * @param string Box title
110 * @param string The box background color
112 function boxMiddle($title, $id = '') {
114 </div> <!-- class="box-content" -->
115 <h3 id="title-'. $this->toSlug($id).'" class="box-middle">'.$title.'</h3>
116 <div class="box-content">
122 * boxBottom() - Bottom HTML box
125 function boxBottom() {
128 </div> <!-- class="box-surround" -->
134 * boxGetAltRowStyle() - Get an alternating row style for tables
136 * @param int Row number
138 function boxGetAltRowStyle($i) {
140 return 'class="bgcolor-white"';
142 return 'class="bgcolor-grey"';
147 * listTableTop() - Takes an array of titles and builds the first row of a new table.
149 * @param array The array of titles
150 * @param array The array of title links
151 * @param boolean Whether to highlight or not the entry
153 function listTableTop ($title_arr,$links_arr=false,$selected=false) {
154 $return = '<table class="width-100p100 listTable';
155 if ($selected == true) {
156 $return .= ' selected';
161 $count=count($title_arr);
163 for ($i=0; $i<$count; $i++) {
165 <th scope="col"><a class="sortbutton" href="'.util_make_url ($links_arr[$i]).'"><strong>'.$title_arr[$i].'</strong></a></th>';
168 for ($i=0; $i<$count; $i++) {
170 <th scope="col"><strong>'.$title_arr[$i].'</strong></th>';
173 return $return.'</tr>';
176 function listTableBottom() {
182 function tabGenerator($TABS_DIRS, $TABS_TITLES, $nested=false,
183 $selected=false, $sel_tab_bgcolor='WHITE',
184 $total_width='100%') {
185 $count=count($TABS_DIRS);
191 <table class="tabGenerator width-100p100" summary="" ';
193 if ($total_width != '100%') {
194 $return .= 'style="width:' . $total_width . ';"';
199 $folder = $this->imgurl.($nested ? 'bottomtab-new/' : 'toptab-new/');
201 $accumulated_width = 0;
202 for ($i=0; $i<$count; $i++) {
203 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
204 $accumulated_width += $tabwidth ;
206 if ($selected == $i) {
207 $left_img = $folder.'selected-left.gif';
208 $middle_img = $folder.'selected-middle.gif';
209 $right_img = $folder.'selected-right.gif';
210 $separ_img = $folder.'selected-separator.gif';
211 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
213 $left_img = $folder.'left.gif';
214 $middle_img = $folder.'middle.gif';
215 $right_img = $folder.'right.gif';
216 $separ_img = $folder.'separator.gif';
217 $css_class = $nested ? 'bottomTab' : 'topTab';
220 $clear_img = $this->imgurl.'clear.png';
225 $return .= '<td class="tg-left">' . "\n";
227 if ($selected == $i) {
228 $return .= ' class="selected"';
234 $return .= ' class="nested"';
236 $return .= '>' . "\n";
238 $return .= '</div>' . "\n";
239 $return .= '</td>' . "\n";
242 $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;">' . "\n";
244 if ($selected == $i) {
245 $return .= ' class="selected"';
250 $return .= ' class="nested"';
252 $return .= '>' . "\n";
253 $return .= '<a href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a>' . "\n";
255 $return .= '</div>' . "\n";
256 $return .= '</td>' . "\n";
259 // if the next tab is not selected, close this tab
260 if ($selected != $i+1) {
261 $return .= '<td class="tg-right">' . "\n";
263 if ($selected == $i) {
264 $return .= ' class="selected"';
269 $return .= ' class="nested"';
271 $return .= '>' . "\n";
273 $return .= '</div>' . "\n";
274 $return .= '</td>' . "\n";
287 * beginSubMenu() - Opening a submenu.
289 * @return string Html to start a submenu.
291 function beginSubMenu () {
298 * endSubMenu() - Closing a submenu.
300 * @return string Html to end a submenu.
302 function endSubMenu () {
303 $return = '</strong></p>';
308 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
310 * @param array The array of titles.
311 * @param array The array of title links.
312 * @return string Html to build a submenu.
314 function printSubMenu ($title_arr,$links_arr) {
315 $count=count($title_arr);
320 for ($i=0; $i<$count; $i++) {
321 $return .= util_make_link ($links_arr[$i], $title_arr[$i]) . ' | ';
323 $return .= util_make_link ($links_arr[$i], $title_arr[$i]);
328 * subMenu() - Takes two array of titles and links and build a menu.
330 * @param array The array of titles.
331 * @param array The array of title links.
332 * @return string Html to build a submenu.
334 function subMenu ($title_arr,$links_arr) {
335 $return = $this->beginSubMenu () ;
336 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
337 $return .= $this->endSubMenu () ;
342 * multiTableRow() - create a mutlilevel row in a table
344 * @param string the row attributes
345 * @param array the array of cell data, each element is an array,
346 * the first item being the text,
347 * the subsequent items are attributes (dont include
348 * the bgcolor for the title here, that will be
349 * handled by $istitle
350 * @param boolean is this row part of the title ?
353 function multiTableRow($row_attr, $cell_data, $istitle) {
355 <tr class="ff" '.$row_attr;
357 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
360 for ( $c = 0; $c < count($cell_data); $c++ ) {
361 $return .='<td class="ff" ';
362 for ( $a=1; $a < count($cell_data[$c]); $a++) {
363 $return .= $cell_data[$c][$a].' ';
367 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
369 $return .= $cell_data[$c][0];
371 $return .='</strong></font>';
383 * feedback() - returns the htmlized feedback string when an action is performed.
385 * @param string feedback string
386 * @return string htmlized feedback
388 function feedback($feedback) {
393 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
398 * getThemeIdFromName()
400 * @param string the dirname of the theme
401 * @return integer the theme id
403 function getThemeIdFromName($dirname) {
404 $res=db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1',
406 return db_result($res,0,'theme_id');
412 // c-file-style: "bsd"