| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @author Mambo Foundation Inc see README.php 5 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 6 * See COPYRIGHT.php for copyright notices and details. 7 * @license GNU/GPL Version 2, see LICENSE.php 8 * 9 * Redistributions of files must retain the above copyright notice. 10 * 11 * Mambo is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; version 2 of the License. 14 */ 15 16 /** 17 * Utility class for all HTML drawing classes 18 */ 19 20 class mosHTML { 21 22 function makeOption( $value, $text='' ) { 23 $obj = new stdClass; 24 $obj->value = $value; 25 $obj->text = trim( $text ) ? $text : $value; 26 return $obj; 27 } 28 29 function writableCell( $folder ) { 30 echo '<tr>'; 31 echo '<td class="item">' . $folder . '/</td>'; 32 echo '<td align="left">'; 33 echo is_writable( "../$folder" ) ? '<strong><span class="green">'.T_('Writeable').'</span></strong>' : '<strong><span class="red">'.T_('Unwriteable').'</span></strong>' . '</td>'; 34 echo '</tr>'; 35 } 36 37 /** 38 * Generates an HTML select list 39 * @param array An array of objects 40 * @param string The value of the HTML name attribute 41 * @param string Additional HTML attributes for the <select> tag 42 * @param string The name of the object variable for the option value 43 * @param string The name of the object variable for the option text 44 * @param mixed The key that is selected 45 * @returns string HTML for the select list 46 */ 47 function selectList ( &$arr, $tag_name, $tag_attribs, $key, $text, $selected=NULL ) { 48 if (is_array($arr)){ 49 reset( $arr ); 50 } 51 $html = "\n<select name=\"$tag_name\" $tag_attribs>"; 52 for ($i=0, $n=count( $arr ); $i < $n; $i++ ) { 53 $k = $arr[$i]->$key; 54 $t = $arr[$i]->$text; 55 $id = isset($arr[$i]->id) ? $arr[$i]->id : null; 56 57 $extra = ''; 58 $extra .= $id ? " id=\"" . $arr[$i]->id . "\"" : ''; 59 if (is_array( $selected )) { 60 foreach ($selected as $obj) { 61 $k2 = $obj->$key; 62 if ($k == $k2) { 63 $extra .= " selected=\"selected\""; 64 break; 65 } 66 } 67 } else { 68 $extra .= ($k == $selected ? " selected=\"selected\"" : ''); 69 } 70 $html .= "\n\t<option value=\"".$k."\"$extra>" . $t . "</option>"; 71 } 72 $html .= "\n</select>\n"; 73 return $html; 74 } 75 76 /** 77 * Writes a select list of integers 78 * @param int The start integer 79 * @param int The end integer 80 * @param int The increment 81 * @param string The value of the HTML name attribute 82 * @param string Additional HTML attributes for the <select> tag 83 * @param mixed The key that is selected 84 * @param string The printf format to be applied to the number 85 * @returns string HTML for the select list 86 */ 87 function integerSelectList( $start, $end, $inc, $tag_name, $tag_attribs, $selected, $format="" ) { 88 $start = intval( $start ); 89 $end = intval( $end ); 90 $inc = intval( $inc ); 91 $arr = array(); 92 for ($i=$start; $i <= $end; $i+=$inc) { 93 $fi = $format ? sprintf( "$format", $i ) : "$i"; 94 $arr[] = mosHTML::makeOption( $fi, $fi ); 95 } 96 97 return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected ); 98 } 99 100 /** 101 * Writes a select list of month names based on Language settings 102 * @param string The value of the HTML name attribute 103 * @param string Additional HTML attributes for the <select> tag 104 * @param mixed The key that is selected 105 * @returns string HTML for the select list values 106 */ 107 function monthSelectList( $tag_name, $tag_attribs, $selected ) { 108 $arr = array( 109 mosHTML::makeOption( '01', T_('January') ), 110 mosHTML::makeOption( '02', T_('February') ), 111 mosHTML::makeOption( '03', T_('March') ), 112 mosHTML::makeOption( '04', T_('April') ), 113 mosHTML::makeOption( '05', T_('May') ), 114 mosHTML::makeOption( '06', T_('June') ), 115 mosHTML::makeOption( '07', T_('July') ), 116 mosHTML::makeOption( '08', T_('August') ), 117 mosHTML::makeOption( '09', T_('September') ), 118 mosHTML::makeOption( '10', T_('October') ), 119 mosHTML::makeOption( '11', T_('November') ), 120 mosHTML::makeOption( '12', T_('December') ) 121 ); 122 123 return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected ); 124 } 125 126 /** 127 * Writes a yes/no select list 128 * @param string The value of the HTML name attribute 129 * @param string Additional HTML attributes for the <select> tag 130 * @param mixed The key that is selected 131 * @returns string HTML for the select list values 132 */ 133 function yesnoSelectList( $tag_name, $tag_attribs, $selected, $yes=false, $no=false ) { 134 $arr = array( 135 mosHTML::makeOption( '0', $no ? $no : T_('No') ), 136 mosHTML::makeOption( '1', $yes ? $yes : T_('Yes') ), 137 ); 138 139 return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected ); 140 } 141 142 /** 143 * Generates an HTML radio list 144 * @param array An array of objects 145 * @param string The value of the HTML name attribute 146 * @param string Additional HTML attributes for the <select> tag 147 * @param mixed The key that is selected 148 * @param string The name of the object variable for the option value 149 * @param string The name of the object variable for the option text 150 * @returns string HTML for the select list 151 */ 152 function radioList( &$arr, $tag_name, $tag_attribs, $selected=null, $key='value', $text='text' ) { 153 reset( $arr ); 154 $html = ""; 155 foreach ($arr as $choice) { 156 $id = @$choice->id; 157 $extra = $id ? " id=\"" . $choice->id . "\"" : ''; 158 if (is_array( $selected )) { 159 foreach ($selected as $obj) { 160 if ($choice->$key == $obj->$key) { 161 $extra .= ' selected="selected"'; 162 break; 163 } 164 } 165 } else { 166 $extra .= ($choice->$key == $selected ? " checked=\"checked\"" : ''); 167 } 168 $html .= "\n\t<input type=\"radio\" name=\"$tag_name\" value=\"".$choice->$key."\"$extra $tag_attribs />" . $choice->$text; 169 } 170 $html .= "\n"; 171 return $html; 172 } 173 174 /** 175 * Writes a yes/no radio list 176 * @param string The value of the HTML name attribute 177 * @param string Additional HTML attributes for the <select> tag 178 * @param mixed The key that is selected 179 * @returns string HTML for the radio list 180 */ 181 function yesnoRadioList( $tag_name, $tag_attribs, $selected, $yes=false, $no=false ) { 182 183 $arr = array( 184 mosHTML::makeOption( '0', $no ? $no : T_('No') ), 185 mosHTML::makeOption( '1', $yes ? $yes : T_('Yes') ) 186 ); 187 return mosHTML::radioList( $arr, $tag_name, $tag_attribs, $selected ); 188 } 189 190 /** 191 * @param int The row index 192 * @param int The record id 193 * @param boolean 194 * @param string The name of the form element 195 * @return string 196 */ 197 function idBox( $rowNum, $recId, $checkedOut=false, $name='cid' ) { 198 if ( $checkedOut ) { 199 return ''; 200 } else { 201 return '<input type="checkbox" id="cb'.$rowNum.'" name="'.$name.'[]" value="'.$recId.'" onclick="isChecked(this.checked);" />'; 202 } 203 } 204 205 function sortIcon( $base_href, $field, $state='none' ) { 206 $mosConfig_live_site = mamboCore::get('mosConfig_live_site'); 207 $alts = array( 208 'none' => T_('No Sorting'), 209 'asc' => T_('Sort Ascending'), 210 'desc' => T_('Sort Descending'), 211 ); 212 $next_state = 'asc'; 213 if ($state == 'asc') { 214 $next_state = 'desc'; 215 } else if ($state == 'desc') { 216 $next_state = 'none'; 217 } 218 219 $html = "<a href=\"$base_href&field=$field&order=$next_state\">" 220 . "<img src=\"$mosConfig_live_site/images/M_images/sort_$state.png\" width=\"12\" height=\"12\" border=\"0\" alt=\"{$alts[$next_state]}\" />" 221 . "</a>"; 222 return $html; 223 } 224 225 /** 226 * Writes Close Button 227 */ 228 function CloseButton ( &$params, $hide_js=NULL ) { 229 // displays close button in Pop-up window 230 if ( $params->get( 'popup' ) && !$hide_js ) { 231 ?> 232 <div align="center" style="margin-top: 30px; margin-bottom: 30px;"> 233 <a href='javascript:window.close();'> 234 <span class="small"> 235 <?php echo T_('Close Window');?> 236 </span> 237 </a> 238 </div> 239 <?php 240 } 241 } 242 243 /** 244 * Writes Back Button 245 */ 246 function BackButton ( &$params, $hide_js=NULL ) { 247 // Back Button 248 if ( $params->get( 'back_button' ) && !$params->get( 'popup' ) && !$hide_js) { 249 ?> 250 <div class="back_button"> 251 <a href='javascript:history.go(-1)'> 252 <?php echo T_('Back'); ?> 253 </a> 254 </div> 255 <?php 256 } 257 } 258 259 /** 260 * Cleans text of all formating and scripting code 261 */ 262 function cleanText ( &$text ) { 263 $text = preg_replace( "'<script[^>]*>.*?</script>'si", '', $text ); 264 $text = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $text ); 265 $text = preg_replace( '/<!--.+?-->/', '', $text ); 266 $text = preg_replace( '/{.+?}/', '', $text ); 267 $text = preg_replace( '/ /', ' ', $text ); 268 $text = preg_replace( '/&/', ' ', $text ); 269 $text = preg_replace( '/"/', ' ', $text ); 270 $text = strip_tags( $text ); 271 $text = htmlspecialchars( $text ); 272 return $text; 273 } 274 275 /** 276 * Writes Print icon 277 */ 278 function PrintIcon( &$row, &$params, $hide_js, $link, $status=NULL ) { 279 if ( $params->get( 'print' ) && !$hide_js ) { 280 // use default settings if none declared 281 if ( !$status ) { 282 $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; 283 } 284 285 // checks template image directory for image, if non found default are loaded 286 if ( $params->get( 'icons' ) ) { 287 $mainframe =& mosMainFrame::getInstance(); 288 $image = $mainframe->ImageCheck( 'printButton.png', '/images/M_images/', NULL, NULL, T_('Print')); 289 } else { 290 $image = _ICON_SEP .' '. T_('Print'). ' '. _ICON_SEP; 291 } 292 293 if ( $params->get( 'popup' ) && !$hide_js ) { 294 // Print Preview button - used when viewing page 295 ?> 296 <td align="right" class="buttonheading"> 297 <a href="#" onclick="javascript:window.print(); return false" title="<?php echo T_('Print');?>"> 298 <?php echo $image;?> 299 </a> 300 </td> 301 <?php 302 } else { 303 // Print Button - used in pop-up window 304 ?> 305 <td align="right" class="buttonheading"> 306 <a href="javascript:void window.open('<?php echo $link; ?>', 'win2', '<?php echo $status; ?>');" title="<?php echo T_('Print');?>"> 307 <?php echo $image;?> 308 </a> 309 </td> 310 <?php 311 } 312 } 313 } 314 315 /** 316 * simple Javascript Cloaking 317 * email cloacking 318 * by default replaces an email with a mailto link with email cloacked 319 */ 320 function emailCloaking( $mail, $mailto=1, $text='', $email=1 ) { 321 // convert text 322 $mail = mosHTML::encoding_converter( $mail ); 323 // split email by @ symbol 324 $mail = explode( '@', $mail ); 325 $mail_parts = explode( '.', $mail[1] ); 326 // random number 327 $rand = rand( 1, 100000 ); 328 329 $replacement = "\n<script type='text/javascript'> \n"; 330 $replacement .= "<!-- \n"; 331 $replacement .= "var prefix = 'ma' + 'il' + 'to'; \n"; 332 $replacement .= "var path = 'hr' + 'ef' + '='; \n"; 333 $replacement .= "var addy". $rand ." = '". @$mail[0] ."' + '@' + '". implode( "' + '.' + '", $mail_parts ) ."'; \n"; 334 if ( $mailto ) { 335 // special handling when mail text is different from mail addy 336 if ( $text ) { 337 if ( $email ) { 338 // convert text 339 $text = mosHTML::encoding_converter( $text ); 340 // split email by @ symbol 341 $text = explode( '@', $text ); 342 $text_parts = explode( '.', $text[1] ); 343 $replacement .= "var addy_text". $rand ." = '". @$text[0] ."' + '@' + '". implode( "' + '.' + '", @$text_parts ) ."'; \n"; 344 } else { 345 $text = mosHTML::encoding_converter( $text ); 346 $replacement .= "var addy_text". $rand ." = '". $text ."';\n"; 347 } 348 $replacement .= "document.write( '<a ' + path + '\'' + prefix + ':' + addy". $rand ." + '\'>' ); \n"; 349 $replacement .= "document.write( addy_text". $rand ." ); \n"; 350 $replacement .= "document.write( '<\/a>' ); \n"; 351 } else { 352 $replacement .= "document.write( '<a ' + path + '\'' + prefix + ':' + addy". $rand ." + '\'>' ); \n"; 353 $replacement .= "document.write( addy". $rand ." ); \n"; 354 $replacement .= "document.write( '<\/a>' ); \n"; 355 } 356 } else { 357 $replacement .= "document.write( addy". $rand ." ); \n"; 358 } 359 $replacement .= "//--> \n"; 360 $replacement .= "</script> \n"; 361 $replacement .= "<noscript> \n"; 362 $replacement .= T_('This email address is being protected from spam bots, you need Javascript enabled to view it'); 363 $replacement .= "\n</noscript> \n"; 364 365 return $replacement; 366 } 367 368 function encoding_converter( $text ) { 369 // replace vowels with character encoding 370 $text = str_replace( 'a', 'a', $text ); 371 $text = str_replace( 'e', 'e', $text ); 372 $text = str_replace( 'i', 'i', $text ); 373 $text = str_replace( 'o', 'o', $text ); 374 $text = str_replace( 'u', 'u', $text ); 375 376 return $text; 377 } 378 } 379 380 class mosCommonHTML { 381 382 function ContentLegend( ) { 383 ?> 384 <table cellspacing="0" cellpadding="4" border="0" align="center"> 385 <tr align="center"> 386 <td> 387 <img src="images/publish_y.png" width="12" height="12" border="0" alt="<?php echo T_('Pending') ?>" /> 388 </td> 389 <td> 390 <?php echo T_('Published, but is <u>Pending</u>') ?> | 391 </td> 392 <td> 393 <img src="images/publish_g.png" width="12" height="12" border="0" alt="<?php echo T_('Visible') ?>" /> 394 </td> 395 <td> 396 <?php echo T_('Published and is <u>Current</u>') ?> | 397 </td> 398 <td> 399 <img src="images/publish_r.png" width="12" height="12" border="0" alt="<?php echo T_('Finished') ?>" /> 400 </td> 401 <td> 402 <?php echo T_('Published, but has <u>Expired</u>') ?> | 403 </td> 404 <td> 405 <img src="images/publish_x.png" width="12" height="12" border="0" alt="<?php echo T_('Finished') ?>" /> 406 </td> 407 <td> 408 <?php echo T_('Not Published') ?> 409 </td> 410 </tr> 411 <tr> 412 <td colspan="8" align="center"> 413 <?php echo T_('Click on icon to toggle state.') ?> 414 </td> 415 </tr> 416 </table> 417 <?php 418 } 419 420 function menuLinksContent( &$menus ) { 421 ?> 422 <script type="text/javascript"> 423 function go2( pressbutton, menu, id ) { 424 var form = document.adminForm; 425 426 if (pressbutton == 'go2menu') { 427 form.menu.value = menu; 428 submitform( pressbutton ); 429 return; 430 } 431 432 if (pressbutton == 'go2menuitem') { 433 form.menu.value = menu; 434 form.menuid.value = id; 435 submitform( pressbutton ); 436 return; 437 } 438 } 439 </script> 440 <?php 441 foreach( $menus as $menu ) { 442 ?> 443 <tr> 444 <td colspan="2"> 445 <hr /> 446 </td> 447 </tr> 448 <tr> 449 <td width="90px" valign="top"> 450 <?php echo T_('Menu') ?> 451 </td> 452 <td> 453 <a href="javascript:go2( 'go2menu', '<?php echo $menu->menutype; ?>' );" title="<?php echo T_('Go to Menu') ?>"> 454 <?php echo $menu->menutype; ?> 455 </a> 456 </td> 457 </tr> 458 <tr> 459 <td width="90px" valign="top"> 460 <?php echo T_('Link Name') ?> 461 </td> 462 <td> 463 <strong> 464 <a href="javascript:go2( 'go2menuitem', '<?php echo $menu->menutype; ?>', '<?php echo $menu->id; ?>' );" title="<?php echo T_('Go to Menu Item') ?>"> 465 <?php echo $menu->name; ?> 466 </a> 467 </strong> 468 </td> 469 </tr> 470 <tr> 471 <td width="90px" valign="top"> 472 <?php echo T_('State') ?> 473 </td> 474 <td> 475 <?php 476 switch ( $menu->published ) { 477 case -2: 478 echo '<font color="red">'.T_('Trashed').'</font>'; 479 break; 480 case 0: 481 echo T_('UnPublished') ; 482 break; 483 case 1: 484 default: 485 echo '<font color="green">'.T_('Published').'</font>'; 486 break; 487 } 488 ?> 489 </td> 490 </tr> 491 <?php 492 } 493 ?> 494 <input type="hidden" name="menu" value="" /> 495 <input type="hidden" name="menuid" value="" /> 496 <?php 497 } 498 499 function menuLinksSecCat( &$menus ) { 500 ?> 501 <script type="text/javascript"> 502 function go2( pressbutton, menu, id ) { 503 var form = document.adminForm; 504 505 if (pressbutton == 'go2menu') { 506 form.menu.value = menu; 507 submitform( pressbutton ); 508 return; 509 } 510 511 if (pressbutton == 'go2menuitem') { 512 form.menu.value = menu; 513 form.menuid.value = id; 514 submitform( pressbutton ); 515 return; 516 } 517 } 518 </script> 519 <?php 520 foreach( $menus as $menu ) { 521 ?> 522 <tr> 523 <td colspan="2"> 524 <hr /> 525 </td> 526 </tr> 527 <tr> 528 <td width="90px" valign="top"> 529 <?php echo T_('Menu') ?> 530 </td> 531 <td> 532 <a href="javascript:go2( 'go2menu', '<?php echo $menu->menutype; ?>' );" title="<?php echo T_('Go to Menu') ?>"> 533 <?php echo $menu->menutype; ?> 534 </a> 535 </td> 536 </tr> 537 <tr> 538 <td width="90px" valign="top"> 539 <?php echo T_('Type') ?> 540 </td> 541 <td> 542 <?php echo $menu->type; ?> 543 </td> 544 </tr> 545 <tr> 546 <td width="90px" valign="top"> 547 <?php echo T_('Item Name') ?> 548 </td> 549 <td> 550 <strong> 551 <a href="javascript:go2( 'go2menuitem', '<?php echo $menu->menutype; ?>', '<?php echo $menu->id; ?>' );" title="<?php echo T_('Go to Menu Item') ?>"> 552 <?php echo $menu->name; ?> 553 </a> 554 </strong> 555 </td> 556 </tr> 557 <tr> 558 <td width="90px" valign="top"> 559 <?php echo T_('State') ?> 560 </td> 561 <td> 562 <?php 563 switch ( $menu->published ) { 564 case -2: 565 echo '<font color="red">'.T_('Trashed').'</font>'; 566 break; 567 case 0: 568 echo T_('UnPublished'); 569 break; 570 case 1: 571 default: 572 echo '<font color="green">'.T_('Published').'</font>'; 573 break; 574 } 575 ?> 576 </td> 577 </tr> 578 <?php 579 } 580 ?> 581 <input type="hidden" name="menu" value="" /> 582 <input type="hidden" name="menuid" value="" /> 583 <?php 584 } 585 586 function checkedOut( &$row, $overlib=1 ) { 587 $hover = ''; 588 if ( $overlib ) { 589 $date = mosFormatDate( $row->checked_out_time, '%A, %d %B %Y' ); 590 $time = mosFormatDate( $row->checked_out_time, '%H:%M' ); 591 $checked_out_text = '<table>'; 592 $checked_out_text .= '<tr><td>'. $row->editor .'</td></tr>'; 593 $checked_out_text .= '<tr><td>'. $date .'</td></tr>'; 594 $checked_out_text .= '<tr><td>'. $time .'</td></tr>'; 595 $checked_out_text .= '</table>'; 596 $hover = 'onMouseOver="return overlib(\''. $checked_out_text .'\', CAPTION, \''.T_('Checked Out') .'\', BELOW, RIGHT);" onMouseOut="return nd();"'; 597 } 598 $checked = '<img src="images/checked_out.png" '. $hover .'/>'; 599 600 return $checked; 601 } 602 603 /* 604 * Loads all necessary files for JS Overlib tooltips 605 */ 606 function loadOverlib() { 607 ?> 608 <script type="text/javascript" src="<?php echo mamboCore::get('mosConfig_live_site');?>/includes/js/overlib_mini.js"></script> 609 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> 610 <?php 611 } 612 613 614 /* 615 * Loads all necessary files for JS Calendar 616 */ 617 function loadCalendar() { 618 $mosConfig_live_site = mamboCore::get('mosConfig_live_site'); 619 ?> 620 <link rel="stylesheet" type="text/css" media="all" href="<?php echo $mosConfig_live_site;?>/includes/js/calendar/calendar-mos.css" title="green" /> 621 <!-- import the calendar script --> 622 <script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/calendar.js"></script> 623 <!-- import the language module --> 624 <script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/lang/calendar-en.js"></script> 625 <?php 626 } 627 628 function AccessProcessing( &$row, $i ) { 629 if ( !$row->access ) { 630 $color_access = 'style="color: green;"'; 631 $task_access = 'accessregistered'; 632 } else if ( $row->access == 1 ) { 633 $color_access = 'style="color: red;"'; 634 $task_access = 'accessspecial'; 635 } else { 636 $color_access = 'style="color: black;"'; 637 $task_access = 'accesspublic'; 638 } 639 640 $href = ' 641 <a href="javascript: void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $task_access .'\')" '. $color_access .'> 642 '. $row->groupname .' 643 </a>' 644 ; 645 646 return $href; 647 } 648 649 function CheckedOutProcessing( &$row, $i ) { 650 $my = mamboCore::get('currentUser'); 651 if ( $row->checked_out ) { 652 $checked = mosCommonHTML::checkedOut( $row ); 653 } else { 654 $checked = mosHTML::idBox( $i, $row->id, ($row->checked_out && $row->checked_out != $my->id ) ); 655 } 656 657 return $checked; 658 } 659 660 function PublishedProcessing( &$row, $i ) { 661 $img = $row->published ? 'publish_g.png' : 'publish_x.png'; 662 $task = $row->published ? 'unpublish' : 'publish'; 663 $alt = $row->published ? T_('Published') : T_('Unpublished'); 664 $action = $row->published ? T_('Unpublish Item') : T_('Publish item'); 665 666 $href = ' 667 <a href="javascript: void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $task .'\')" title="'. $action .'"> 668 <img src="images/'. $img .'" border="0" alt="'. $alt .'" /> 669 </a>' 670 ; 671 672 return $href; 673 } 674 } 675 676 /** 677 * Tab Creation handler 678 * @package Mambo 679 * @author Phil Taylor 680 */ 681 class mosTabs { 682 /** @var int Use cookies */ 683 var $useCookies = 0; 684 685 /** 686 * Constructor 687 * Includes files needed for displaying tabs and sets cookie options 688 * @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes 689 */ 690 function mosTabs($useCookies) { 691 $mosConfig_live_site = mamboCore::get('mosConfig_live_site'); 692 echo "<link id=\"luna-tab-style-sheet\" type=\"text/css\" rel=\"stylesheet\" href=\"" . $mosConfig_live_site. "/includes/js/tabs/tabpane.css\" />"; 693 echo "<script type=\"text/javascript\" src=\"". $mosConfig_live_site . "/includes/js/tabs/tabpane.js\"></script>"; 694 $this->useCookies = $useCookies; 695 } 696 697 /** 698 * creates a tab pane and creates JS obj 699 * @param string The Tab Pane Name 700 */ 701 function startPane($id){ 702 echo "<div class=\"tab-page\" id=\"".$id."\">"; 703 echo "<script type=\"text/javascript\">\n"; 704 echo " var tabPane1 = new WebFXTabPane( document.getElementById( \"".$id."\" ), ".$this->useCookies." )\n"; 705 echo "</script>\n"; 706 } 707 708 /** 709 * Ends Tab Pane 710 */ 711 function endPane() { 712 echo "</div>"; 713 } 714 715 /* 716 * Creates a tab with title text and starts that tabs page 717 * @param tabText - This is what is displayed on the tab 718 * @param paneid - This is the parent pane to build this tab on 719 */ 720 function startTab( $tabText, $paneid ) { 721 echo "<div class=\"tab-page\" id=\"".$paneid."\">"; 722 echo "<h2 class=\"tab\">".$tabText."</h2>"; 723 echo "<script type=\"text/javascript\">\n"; 724 echo " tabPane1.addTabPage( document.getElementById( \"".$paneid."\" ) );"; 725 echo "</script>"; 726 } 727 728 /* 729 * Ends a tab page 730 */ 731 function endTab() { 732 echo "</div>"; 733 } 734 } 735 736 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |