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) {
65 echo '</div> <!-- id="maindiv" -->
69 function footer($params) {
70 $this->bodyFooter($params);
72 <!-- PLEASE LEAVE "Powered By FusionForge" on your site -->
73 <div class="align-right">
74 ' . $this->navigation->getPoweredBy() . '
76 ' . $this->navigation->getShowSource() . '
86 * boxTop() - Top HTML box
88 * @param string Box title
89 * @param bool Whether to echo or return the results
90 * @param string The box background color
92 function boxTop($title, $id = '') {
94 <div id="' . $this->toSlug($id) . '" class="box-surround">
95 <div id="'. $this->toSlug($id) . '-title" class="box-title">
96 <div class="box-title-left">
97 <div class="box-title-right">
98 <h3 class="box-title-content" id="'. $this->toSlug($id) .'-title-content">'. $title .'</h3>
99 </div> <!-- class="box-title-right" -->
100 </div> <!-- class="box-title-left" -->
101 </div> <!-- class="box-title" -->
102 <div id="'. $this->toSlug($id) .'-content" class="box-content">
108 * boxMiddle() - Middle HTML box
110 * @param string Box title
111 * @param string The box background color
113 function boxMiddle($title, $id = '') {
115 </div> <!-- class="box-content" -->
116 <h3 id="title-'. $this->toSlug($id).'" class="box-middle">'.$title.'</h3>
117 <div class="box-content">
123 * boxBottom() - Bottom HTML box
126 function boxBottom() {
128 </div> <!-- class="box-content" -->
129 </div> <!-- class="box-surround" -->
135 * boxGetAltRowStyle() - Get an alternating row style for tables
137 * @param int Row number
139 function boxGetAltRowStyle($i) {
141 return 'class="bgcolor-white"';
143 return 'class="bgcolor-grey"';
148 * listTableTop() - Takes an array of titles and builds the first row of a new table.
150 * @param array The array of titles
151 * @param array The array of title links
152 * @param boolean Whether to highlight or not the entry
154 function listTableTop ($title_arr,$links_arr=false,$selected=false) {
155 $return = '<table class="width-100p100 listTable';
156 if ($selected == true) {
157 $return .= ' selected';
162 $count=count($title_arr);
164 for ($i=0; $i<$count; $i++) {
166 <th scope="col"><a class="sortbutton" href="'.util_make_url ($links_arr[$i]).'"><strong>'.$title_arr[$i].'</strong></a></th>';
169 for ($i=0; $i<$count; $i++) {
171 <th scope="col"><strong>'.$title_arr[$i].'</strong></th>';
174 return $return.'</tr>';
177 function listTableBottom() {
183 function tabGenerator($TABS_DIRS, $TABS_TITLES, $nested=false,
184 $selected=false, $sel_tab_bgcolor='WHITE',
185 $total_width='100%') {
186 $count=count($TABS_DIRS);
192 <table class="tabGenerator width-100p100" summary="" ';
194 if ($total_width != '100%') {
195 $return .= 'style="width:' . $total_width . ';"';
200 /* $folder = $this->imgurl.($nested ? 'bottomtab-new/' : 'toptab-new/');*/
202 $accumulated_width = 0;
203 for ($i=0; $i<$count; $i++) {
204 $tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
205 $accumulated_width += $tabwidth ;
207 if ($selected == $i) {
208 $left_img = $folder.'selected-left.gif';
209 $middle_img = $folder.'selected-middle.gif';
210 $right_img = $folder.'selected-right.gif';
211 $separ_img = $folder.'selected-separator.gif';
212 $css_class = $nested ? 'bottomTabSelected' : 'topTabSelected';
214 $left_img = $folder.'left.gif';
215 $middle_img = $folder.'middle.gif';
216 $right_img = $folder.'right.gif';
217 $separ_img = $folder.'separator.gif';
218 $css_class = $nested ? 'bottomTab' : 'topTab';
221 $clear_img = $this->imgurl.'clear.png';
226 $return .= '<td class="tg-left">' . "\n";
228 if ($selected == $i) {
229 $return .= ' class="selected"';
235 $return .= ' class="nested"';
237 $return .= '>' . "\n";
239 $return .= '</div>' . "\n";
240 $return .= '</td>' . "\n";
243 $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;">' . "\n";
245 if ($selected == $i) {
246 $return .= ' class="selected"';
251 $return .= ' class="nested"';
253 $return .= '>' . "\n";
254 $return .= '<a href="'.$TABS_DIRS[$i].'">'.$TABS_TITLES[$i].'</a>' . "\n";
256 $return .= '</div>' . "\n";
257 $return .= '</td>' . "\n";
260 // if the next tab is not selected, close this tab
261 if ($selected != $i+1) {
262 $return .= '<td class="tg-right">' . "\n";
264 if ($selected == $i) {
265 $return .= ' class="selected"';
270 $return .= ' class="nested"';
272 $return .= '>' . "\n";
274 $return .= '</div>' . "\n";
275 $return .= '</td>' . "\n";
288 * beginSubMenu() - Opening a submenu.
290 * @return string Html to start a submenu.
292 function beginSubMenu () {
299 * endSubMenu() - Closing a submenu.
301 * @return string Html to end a submenu.
303 function endSubMenu () {
304 $return = '</strong></p>';
309 * printSubMenu() - Takes two array of titles and links and builds the contents of a menu.
311 * @param array The array of titles.
312 * @param array The array of title links.
313 * @return string Html to build a submenu.
315 function printSubMenu ($title_arr,$links_arr) {
316 $count=count($title_arr);
321 for ($i=0; $i<$count; $i++) {
322 $return .= util_make_link ($links_arr[$i], $title_arr[$i]) . ' | ';
324 $return .= util_make_link ($links_arr[$i], $title_arr[$i]);
329 * subMenu() - Takes two array of titles and links and build a menu.
331 * @param array The array of titles.
332 * @param array The array of title links.
333 * @return string Html to build a submenu.
335 function subMenu ($title_arr,$links_arr) {
336 $return = $this->beginSubMenu () ;
337 $return .= $this->printSubMenu ($title_arr,$links_arr) ;
338 $return .= $this->endSubMenu () ;
343 * multiTableRow() - create a mutlilevel row in a table
345 * @param string the row attributes
346 * @param array the array of cell data, each element is an array,
347 * the first item being the text,
348 * the subsequent items are attributes (dont include
349 * the bgcolor for the title here, that will be
350 * handled by $istitle
351 * @param boolean is this row part of the title ?
354 function multiTableRow($row_attr, $cell_data, $istitle) {
356 <tr class="ff" '.$row_attr;
358 $return .=' align="center" bgcolor="'. $this->COLOR_HTMLBOX_TITLE .'"';
361 for ( $c = 0; $c < count($cell_data); $c++ ) {
362 $return .='<td class="ff" ';
363 for ( $a=1; $a < count($cell_data[$c]); $a++) {
364 $return .= $cell_data[$c][$a].' ';
368 $return .='<font color="'.$this->FONTCOLOR_HTMLBOX_TITLE.'"><strong>';
370 $return .= $cell_data[$c][0];
372 $return .='</strong></font>';
384 * feedback() - returns the htmlized feedback string when an action is performed.
386 * @param string feedback string
387 * @return string htmlized feedback
389 function feedback($feedback) {
394 <h3 style="color:red">'.strip_tags($feedback, '<br>').'</h3>';
399 * getThemeIdFromName()
401 * @param string the dirname of the theme
402 * @return integer the theme id
404 function getThemeIdFromName($dirname) {
405 $res=db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1',
407 return db_result($res,0,'theme_id');
413 // c-file-style: "bsd"