| [ Index ] |
PHP Cross Reference of MyBB 1.6.5 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.6 4 * Copyright 2010 MyBB Group, All Rights Reserved 5 * 6 * Website: http://mybb.com 7 * License: http://mybb.com/about/license 8 * 9 * $Id: class_form.php 5624 2011-10-02 19:07:56Z ralgith $ 10 */ 11 12 /** 13 * Generate a form on the page. 14 */ 15 class DefaultForm 16 { 17 /** 18 * @var boolean Should this form be returned instead of output to the browser? 19 */ 20 private $_return = false; 21 22 /** 23 * @var string Contents of the form if $_return is true from __construct 24 */ 25 public $construct_return = ""; 26 27 /** 28 * Constructor. Outputs the form tag with the specified options. 29 * 30 * @param string The action for the form. 31 * @param string The method (get or post) for this form. 32 * @param string The ID of the form. 33 * @param boolean Should file uploads be allowed for this form? 34 * @param boolean The name of the form 35 * @param boolean Should this form be returned instead of output to the browser? 36 * @param boolean The onsubmit action of the form 37 */ 38 function __construct($script='', $method='', $id="", $allow_uploads=0, $name="", $return=false, $onsubmit="") 39 { 40 global $mybb; 41 $form = "<form action=\"{$script}\" method=\"{$method}\""; 42 if($allow_uploads != 0) 43 { 44 $form .= " enctype=\"multipart/form-data\""; 45 } 46 47 if($name != "") 48 { 49 $form .= " name=\"{$name}\""; 50 } 51 52 if($id != "") 53 { 54 $form .= " id=\"{$id}\""; 55 } 56 57 if($onsubmit != "") 58 { 59 $form .= " onsubmit=\"{$onsubmit}\""; 60 } 61 $form .= ">\n"; 62 $form .= $this->generate_hidden_field("my_post_key", $mybb->post_code)."\n"; 63 if($return == false) 64 { 65 echo $form; 66 } 67 else 68 { 69 $this->_return = true; 70 $this->construct_return = $form; 71 } 72 } 73 74 /** 75 * Generate and return a hidden field. 76 * 77 * @param string The name of the hidden field. 78 * @param string The value of the hidden field. 79 * @param array Optional array of options (id) 80 * @return string The generated hidden 81 */ 82 function generate_hidden_field($name, $value, $options=array()) 83 { 84 $input = "<input type=\"hidden\" name=\"{$name}\" value=\"".htmlspecialchars($value)."\""; 85 if(isset($options['id'])) 86 { 87 $input .= " id=\"".$options['id']."\""; 88 } 89 $input .= " />"; 90 return $input; 91 } 92 93 /** 94 * Generate a text box field. 95 * 96 * @param string The name of the text box. 97 * @param string The value of the text box. 98 * @param array Array of options for the text box (class, style, id) 99 * @return string The generated text box. 100 */ 101 function generate_text_box($name, $value="", $options=array()) 102 { 103 $input = "<input type=\"text\" name=\"".$name."\" value=\"".htmlspecialchars($value)."\""; 104 if(isset($options['class'])) 105 { 106 $input .= " class=\"text_input ".$options['class']."\""; 107 } 108 else 109 { 110 $input .= " class=\"text_input\""; 111 } 112 if(isset($options['style'])) 113 { 114 $input .= " style=\"".$options['style']."\""; 115 } 116 if(isset($options['id'])) 117 { 118 $input .= " id=\"".$options['id']."\""; 119 } 120 $input .= " />"; 121 return $input; 122 } 123 124 /** 125 * Generate a password input box. 126 * 127 * @param string The name of the password box. 128 * @param string The value of the password box. 129 * @param array Array of options for the password box (class, id) 130 * @return string The generated password input box. 131 */ 132 function generate_password_box($name, $value="", $options=array()) 133 { 134 $input = "<input type=\"password\" name=\"".$name."\" value=\"".htmlspecialchars($value)."\""; 135 if(isset($options['class'])) 136 { 137 $input .= " class=\"text_input ".$options['class']."\""; 138 } 139 else 140 { 141 $input .= " class=\"text_input\""; 142 } 143 if(isset($options['id'])) 144 { 145 $input .= " id=\"".$options['id']."\""; 146 } 147 if(isset($options['autocomplete'])) 148 { 149 $input .= " autocomplete=\"".$options['autocomplete']."\""; 150 } 151 $input .= " />"; 152 return $input; 153 } 154 155 /** 156 * Generate a file upload field. 157 * 158 * @param string The name of the file upload field. 159 * @param array Array of options for the file upload field (class, id) 160 * @return string The generated file upload field. 161 */ 162 function generate_file_upload_box($name, $options=array()) 163 { 164 $input = "<input type=\"file\" name=\"".$name."\""; 165 if(isset($options['class'])) 166 { 167 $input .= " class=\"text_input ".$options['class']."\""; 168 } 169 else 170 { 171 $input .= " class=\"text_input\""; 172 } 173 if(isset($options['style'])) 174 { 175 $input .= " style=\"".$options['style']."\""; 176 } 177 if(isset($options['id'])) 178 { 179 $input .= " id=\"".$options['id']."\""; 180 } 181 $input .= " />"; 182 return $input; 183 184 } 185 186 /** 187 * Generate a text area. 188 * 189 * @param string The name of of the text area. 190 * @param string The value of the text area field. 191 * @param array Array of options for text area (class, id, rows, cols, style, disabled) 192 * @return string The generated text area field. 193 */ 194 function generate_text_area($name, $value="", $options=array()) 195 { 196 $textarea = "<textarea"; 197 if(!empty($name)) 198 { 199 $textarea .= " name=\"{$name}\""; 200 } 201 if(isset($options['class'])) 202 { 203 $textarea .= " class=\"{$options['class']}\""; 204 } 205 if(isset($options['id'])) 206 { 207 $textarea .= " id=\"{$options['id']}\""; 208 } 209 if($options['style']) 210 { 211 $textarea .= " style=\"{$options['style']}\""; 212 } 213 if($options['disabled']) 214 { 215 $textarea .= " disabled=\"disabled\""; 216 } 217 if(!$options['rows']) 218 { 219 $options['rows'] = 5; 220 } 221 if(!$options['cols']) 222 { 223 $options['cols'] = 45; 224 } 225 $textarea .= " rows=\"{$options['rows']}\" cols=\"{$options['cols']}\">"; 226 $textarea .= htmlspecialchars_uni($value); 227 $textarea .= "</textarea>"; 228 return $textarea; 229 } 230 231 /** 232 * Generate a radio button. 233 * 234 * @param string The name of the radio button. 235 * @param string The value of the radio button 236 * @param string The label of the radio button if there is one. 237 * @param array Array of options for the radio button (id, class, checked) 238 * @return string The generated radio button. 239 */ 240 function generate_radio_button($name, $value="", $label="", $options=array()) 241 { 242 $input = "<label"; 243 if(isset($options['id'])) 244 { 245 $input .= " for=\"{$options['id']}\""; 246 } 247 if(isset($options['class'])) 248 { 249 $input .= " class=\"label_{$options['class']}\""; 250 } 251 $input .= "><input type=\"radio\" name=\"{$name}\" value=\"".htmlspecialchars($value)."\""; 252 if(isset($options['class'])) 253 { 254 $input .= " class=\"radio_input ".$options['class']."\""; 255 } 256 else 257 { 258 $input .= " class=\"radio_input\""; 259 } 260 if(isset($options['id'])) 261 { 262 $input .= " id=\"".$options['id']."\""; 263 } 264 if(isset($options['checked']) && $options['checked'] != 0) 265 { 266 $input .= " checked=\"checked\""; 267 } 268 $input .= " />"; 269 if($label != "") 270 { 271 $input .= $label; 272 } 273 $input .= "</label>"; 274 return $input; 275 } 276 277 /** 278 * Generate a checkbox. 279 * 280 * @param string The name of the check box. 281 * @param string The value of the check box. 282 * @param string The label of the check box if there is one. 283 * @param array Array of options for the check box (id, class, checked) 284 * @return string The generated check box. 285 */ 286 function generate_check_box($name, $value="", $label="", $options=array()) 287 { 288 $input = "<label"; 289 if(isset($options['id'])) 290 { 291 $input .= " for=\"{$options['id']}\""; 292 } 293 if(isset($options['class'])) 294 { 295 $input .= " class=\"label_{$options['class']}\""; 296 } 297 $input .= "><input type=\"checkbox\" name=\"{$name}\" value=\"".htmlspecialchars($value)."\""; 298 if(isset($options['class'])) 299 { 300 $input .= " class=\"checkbox_input ".$options['class']."\""; 301 } 302 else 303 { 304 $input .= " class=\"checkbox_input\""; 305 } 306 if(isset($options['id'])) 307 { 308 $input .= " id=\"".$options['id']."\""; 309 } 310 if($options['checked'] === true || $options['checked'] == 1) 311 { 312 $input .= " checked=\"checked\""; 313 } 314 if(isset($options['onclick'])) 315 { 316 $input .= " onclick=\"{$options['onclick']}\""; 317 } 318 $input .= " /> "; 319 if($label != "") 320 { 321 $input .= $label; 322 } 323 $input .= "</label>"; 324 return $input; 325 } 326 327 /** 328 * Generate a select box. 329 * 330 * @param string The name of the select box. 331 * @param array Array of options in key => val format. 332 * @param mixed Either a string containing the selected item or an array containing multiple selected items (options['multiple'] must be true) 333 * @param array Array of options for the select box (multiple, class, id, size) 334 * @return string The select box. 335 */ 336 function generate_select_box($name, $option_list, $selected=array(), $options=array()) 337 { 338 if(!isset($options['multiple'])) 339 { 340 $select = "<select name=\"{$name}\""; 341 } 342 else 343 { 344 $select = "<select name=\"{$name}\" multiple=\"multiple\""; 345 if(!isset($options['size'])) 346 { 347 $options['size'] = count($option_list); 348 } 349 } 350 if(isset($options['class'])) 351 { 352 $select .= " class=\"{$options['class']}\""; 353 } 354 if(isset($options['id'])) 355 { 356 $select .= " id=\"{$options['id']}\""; 357 } 358 if(isset($options['size'])) 359 { 360 $select .= " size=\"{$options['size']}\""; 361 } 362 $select .= ">\n"; 363 foreach($option_list as $value => $option) 364 { 365 $select_add = ''; 366 if(!empty($selected) && ((string)$value == (string)$selected || (is_array($selected) && in_array((string)$value, $selected)))) 367 { 368 $select_add = " selected=\"selected\""; 369 } 370 $select .= "<option value=\"{$value}\"{$select_add}>{$option}</option>\n"; 371 } 372 $select .= "</select>\n"; 373 return $select; 374 } 375 376 /** 377 * Generate a forum selection box. 378 * 379 * @param string The name of the selection box. 380 * @param mixed Array/string of the selected items. 381 * @param array Array of options (pid, main_option, multiple) 382 * @param boolean Is this our first iteration of this function? 383 * @return string The built select box. 384 */ 385 function generate_forum_select($name, $selected, $options=array(), $is_first=1) 386 { 387 global $fselectcache, $forum_cache, $selectoptions; 388 389 if(!$selectoptions) 390 { 391 $selectoptions = ''; 392 } 393 394 if(!$options['depth']) 395 { 396 $options['depth'] = 0; 397 } 398 399 $options['depth'] = intval($options['depth']); 400 401 if(!$options['pid']) 402 { 403 $pid = 0; 404 } 405 406 $pid = intval($options['pid']); 407 408 if(!is_array($fselectcache)) 409 { 410 if(!is_array($forum_cache)) 411 { 412 $forum_cache = cache_forums(); 413 } 414 415 foreach($forum_cache as $fid => $forum) 416 { 417 $fselectcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; 418 } 419 } 420 421 if($options['main_option'] && $is_first) 422 { 423 $select_add = ''; 424 if($selected == -1) 425 { 426 $select_add = " selected=\"selected\""; 427 } 428 429 $selectoptions .= "<option value=\"-1\"{$select_add}>{$options['main_option']}</option>\n"; 430 } 431 432 if(is_array($fselectcache[$pid])) 433 { 434 foreach($fselectcache[$pid] as $main) 435 { 436 foreach($main as $forum) 437 { 438 if($forum['fid'] != "0" && $forum['linkto'] == '') 439 { 440 $select_add = ''; 441 442 if(!empty($selected) && ($forum['fid'] == $selected || (is_array($selected) && in_array($forum['fid'], $selected)))) 443 { 444 $select_add = " selected=\"selected\""; 445 } 446 447 $sep = ''; 448 if(isset($options['depth'])) 449 { 450 $sep = str_repeat(" ", $options['depth']); 451 } 452 453 $style = ""; 454 if($forum['active'] == 0) 455 { 456 $style = " style=\"font-style: italic;\""; 457 } 458 459 $selectoptions .= "<option value=\"{$forum['fid']}\"{$style}{$select_add}>".$sep.htmlspecialchars_uni(strip_tags($forum['name']))."</option>\n"; 460 461 if($forum_cache[$forum['fid']]) 462 { 463 $options['depth'] += 5; 464 $options['pid'] = $forum['fid']; 465 $this->generate_forum_select($forum['fid'], $selected, $options, 0); 466 $options['depth'] -= 5; 467 } 468 } 469 } 470 } 471 } 472 473 if($is_first == 1) 474 { 475 if(!isset($options['multiple'])) 476 { 477 $select = "<select name=\"{$name}\""; 478 } 479 else 480 { 481 $select = "<select name=\"{$name}\" multiple=\"multiple\""; 482 } 483 if(isset($options['class'])) 484 { 485 $select .= " class=\"{$options['class']}\""; 486 } 487 if(isset($options['id'])) 488 { 489 $select .= " id=\"{$options['id']}\""; 490 } 491 if(isset($options['size'])) 492 { 493 $select .= " size=\"{$options['size']}\""; 494 } 495 $select .= ">\n".$selectoptions."</select>\n"; 496 $selectoptions = ''; 497 return $select; 498 } 499 } 500 501 /** 502 * Generate a group selection box. 503 * 504 * @param string The name of the selection box. 505 * @param mixed Array/string of the selected items. 506 * @param array Array of options (class, id, multiple) 507 * @return string The built select box. 508 */ 509 function generate_group_select($name, $selected=array(), $options=array()) 510 { 511 global $cache; 512 513 $select = "<select name=\"{$name}\""; 514 515 if(isset($options['multiple'])) 516 { 517 $select .= " multiple=\"multiple\""; 518 } 519 520 if(isset($options['class'])) 521 { 522 $select .= " class=\"{$options['class']}\""; 523 } 524 525 if(isset($options['id'])) 526 { 527 $select .= " id=\"{$options['id']}\""; 528 } 529 530 if(isset($options['size'])) 531 { 532 $select .= " size=\"{$options['size']}\""; 533 } 534 535 $select .= ">\n"; 536 537 $groups_cache = $cache->read('usergroups'); 538 foreach($groups_cache as $group) 539 { 540 $selected_add = ""; 541 if(is_array($selected)) 542 { 543 if(in_array($group['gid'], $selected)) 544 { 545 $selected_add = " selected=\"selected\""; 546 } 547 } 548 549 $select .= "<option value=\"{$group['gid']}\"{$selected_add}>".htmlspecialchars_uni(strip_tags($group['title']))."</option>"; 550 } 551 552 $select .= "</select>"; 553 554 return $select; 555 } 556 557 /** 558 * Generate a submit button. 559 * 560 * @param string The value for the submit button. 561 * @param array Array of options for the submit button (class, id, name, dsiabled, onclick) 562 * @return string The generated submit button. 563 */ 564 function generate_submit_button($value, $options=array()) 565 { 566 $input = "<input type=\"submit\" value=\"".htmlspecialchars($value)."\""; 567 568 if(isset($options['class'])) 569 { 570 $input .= " class=\"submit_button ".$options['class']."\""; 571 } 572 else 573 { 574 $input .= " class=\"submit_button\""; 575 } 576 if(isset($options['id'])) 577 { 578 $input .= " id=\"".$options['id']."\""; 579 } 580 if(isset($options['name'])) 581 { 582 $input .= " name=\"".$options['name']."\""; 583 } 584 if($options['disabled']) 585 { 586 $input .= " disabled=\"disabled\""; 587 } 588 if($options['onclick']) 589 { 590 $input .= " onclick=\"".str_replace('"', '\"', $options['onclick'])."\""; 591 } 592 $input .= " />"; 593 return $input; 594 } 595 596 /** 597 * Generate a reset button. 598 * 599 * @param string The value for the reset button. 600 * @param array Array of options for the reset button (class, id, name) 601 * @return string The generated reset button. 602 */ 603 function generate_reset_button($value, $options=array()) 604 { 605 $input = "<input type=\"reset\" value=\"".htmlspecialchars($value)."\""; 606 607 if(isset($options['class'])) 608 { 609 $input .= " class=\"submit_button ".$options['class']."\""; 610 } 611 else 612 { 613 $input .= " class=\"submit_button\""; 614 } 615 if(isset($options['id'])) 616 { 617 $input .= " id=\"".$options['id']."\""; 618 } 619 if(isset($options['name'])) 620 { 621 $input .= " name=\"".$options['name']."\""; 622 } 623 $input .= " />"; 624 return $input; 625 } 626 627 /** 628 * Generate a yes/no radio button choice. 629 * 630 * @param string The name of the yes/no choice field. 631 * @param string The value that should be checked. 632 * @param boolean Using integers for the checkbox? 633 * @param array Array of options for the yes checkbox (@see generate_radio_button) 634 * @param array Array of options for the no checkbox (@see generate_radio_button) 635 * @return string The generated yes/no radio button. 636 */ 637 function generate_yes_no_radio($name, $value=1, $int=true, $yes_options=array(), $no_options = array()) 638 { 639 global $lang; 640 641 // Checked status 642 if($value == "no" || $value === '0') 643 { 644 $no_checked = 1; 645 $yes_checked = 0; 646 } 647 else 648 { 649 $yes_checked = 1; 650 $no_checked = 0; 651 } 652 // Element value 653 if($int == true) 654 { 655 $yes_value = 1; 656 $no_value = 0; 657 } 658 else 659 { 660 $yes_value = "yes"; 661 $no_value = "no"; 662 } 663 // Set the options straight 664 $yes_options['class'] = "radio_yes ".$yes_options['class']; 665 $yes_options['checked'] = $yes_checked; 666 $no_options['class'] = "radio_no ".$no_options['class']; 667 $no_options['checked'] = $no_checked; 668 669 $yes = $this->generate_radio_button($name, $yes_value, $lang->yes, $yes_options); 670 $no = $this->generate_radio_button($name, $no_value, $lang->no, $no_options); 671 return $yes." ".$no; 672 } 673 674 /** 675 * Generate an on/off radio button choice. 676 * 677 * @param string The name of the on/off choice field. 678 * @param string The value that should be checked. 679 * @param boolean Using integers for the checkbox? 680 * @param array Array of options for the on checkbox (@see generate_radio_button) 681 * @param array Array of options for the off checkbox (@see generate_radio_button) 682 * @return string The generated on/off radio button. 683 */ 684 function generate_on_off_radio($name, $value=1, $int=true, $on_options=array(), $off_options = array()) 685 { 686 global $lang; 687 688 // Checked status 689 if($value == "off" || (int) $value !== 1) 690 { 691 $off_checked = 1; 692 $on_checked = 0; 693 } 694 else 695 { 696 $on_checked = 1; 697 $off_checked = 0; 698 } 699 // Element value 700 if($int == true) 701 { 702 $on_value = 1; 703 $off_value = 0; 704 } 705 else 706 { 707 $on_value = "on"; 708 $off_value = "off"; 709 } 710 711 // Set the options straight 712 $on_options['class'] = "radio_on ".$on_options['class']; 713 $on_options['checked'] = $on_checked; 714 $off_options['class'] = "radio_off ".$off_options['class']; 715 $off_options['checked'] = $off_checked; 716 717 $on = $this->generate_radio_button($name, $on_value, $lang->on, $on_options); 718 $off = $this->generate_radio_button($name, $off_value, $lang->off, $off_options); 719 return $on." ".$off; 720 } 721 722 function generate_date_select($name, $day="",$month="",$year="") 723 { 724 global $lang; 725 726 $months = array( 727 1 => $lang->january, 728 2 => $lang->february, 729 3 => $lang->march, 730 4 => $lang->april, 731 5 => $lang->may, 732 6 => $lang->june, 733 7 => $lang->july, 734 8 => $lang->august, 735 9 => $lang->september, 736 10 => $lang->october, 737 11 => $lang->november, 738 12 => $lang->december, 739 ); 740 741 // Construct option list for days 742 $days = array(); 743 for($i = 1; $i <= 31; ++$i) 744 { 745 $days[$i] = $i; 746 } 747 748 if(!$day) 749 { 750 $day = date("j", TIME_NOW); 751 } 752 753 if(!$month) 754 { 755 $month = date("n", TIME_NOW); 756 } 757 758 if(!$year) 759 { 760 $year = date("Y", TIME_NOW); 761 } 762 763 $built = $this->generate_select_box($name.'_day', $days, intval($day), array('id' => $name.'_day'))." "; 764 $built .= $this->generate_select_box($name.'_month', $months, intval($month), array('id' => $name.'_month'))." "; 765 $built .= $this->generate_text_box($name.'_year', intval($year), array('id' => $name.'_year', 'style' => 'width: 100px;')); 766 return $built; 767 } 768 769 /** 770 * Output a row of buttons in a wrapped container. 771 * 772 * @param array Array of the buttons (html) to output. 773 * @return string The submit wrapper (optional) 774 */ 775 function output_submit_wrapper($buttons) 776 { 777 global $plugins; 778 $buttons = $plugins->run_hooks("admin_form_output_submit_wrapper", $buttons); 779 $return = "<div class=\"form_button_wrapper\">\n"; 780 foreach($buttons as $button) 781 { 782 $return .= $button." \n"; 783 } 784 $return .= "</div>\n"; 785 if($this->_return == false) 786 { 787 echo $return; 788 } 789 else 790 { 791 return $return; 792 } 793 } 794 795 /** 796 * Finish up a form. 797 * 798 * @return string The ending form tag (optional) 799 */ 800 function end() 801 { 802 global $plugins; 803 $plugins->run_hooks_by_ref("admin_form_end", $this); 804 if($this->_return == false) 805 { 806 echo "</form>"; 807 } 808 else 809 { 810 return "</form>"; 811 } 812 } 813 } 814 815 /** 816 * Generate a form container. 817 */ 818 class DefaultFormContainer 819 { 820 private $_container; 821 public $_title; 822 823 /** 824 * Initialise the new form container. 825 * 826 * @param string The title of the forum container 827 * @param string An additional class to apply if we have one. 828 */ 829 function __construct($title='', $extra_class='') 830 { 831 $this->_container = new Table; 832 $this->extra_class = $extra_class; 833 $this->_title = $title; 834 } 835 836 /** 837 * Output a header row of the form container. 838 * 839 * @param string The header row label. 840 * @param array TODO 841 */ 842 function output_row_header($title, $extra=array()) 843 { 844 $this->_container->construct_header($title, $extra); 845 } 846 847 /** 848 * Output a row of the form container. 849 * 850 * @param string The title of the row. 851 * @param string The description of the row/field. 852 * @param string The HTML content to show in the row. 853 * @param string The ID of the control this row should be a label for. 854 * @param array Array of options for the row cell. 855 * @param array Array of options for the row container. 856 */ 857 function output_row($title, $description="", $content="", $label_for="", $options=array(), $row_options=array()) 858 { 859 global $plugins; 860 $pluginargs = array( 861 'title' => &$title, 862 'description' => &$description, 863 'content' => &$content, 864 'label_for' => &$label_for, 865 'options' => &$options, 866 'row_options' => &$row_options, 867 'this' => &$this 868 ); 869 $plugins->run_hooks("admin_formcontainer_output_row", $pluginargs); 870 if($label_for != '') 871 { 872 $for = " for=\"{$label_for}\""; 873 } 874 875 if($title) 876 { 877 $row = "<label{$for}>{$title}</label>"; 878 } 879 880 if($options['id']) 881 { 882 $options['id'] = " id=\"{$options['id']}\""; 883 } 884 885 if($description != '') 886 { 887 $row .= "\n<div class=\"description\">{$description}</div>\n"; 888 } 889 $row .= "<div class=\"form_row\"{$options['id']}>{$content}</div>\n"; 890 891 $this->_container->construct_cell($row, $options); 892 893 if(!isset($options['skip_construct'])) 894 { 895 $this->_container->construct_row($row_options); 896 } 897 } 898 899 /** 900 * Output a row cell for a table based form row. 901 * 902 * @param string The data to show in the cell. 903 * @param array Array of options for the cell (optional). 904 */ 905 function output_cell($data, $options=array()) 906 { 907 $this->_container->construct_cell($data, $options); 908 } 909 910 /** 911 * Build a row for the table based form row. 912 * 913 * @param array Array of extra options for the cell (optional). 914 */ 915 function construct_row($extra=array()) 916 { 917 $this->_container->construct_row($extra); 918 } 919 920 /** 921 * return the cells of a row for the table based form row. 922 * 923 * @param string The id of the row. 924 * @param boolean Whether or not to return or echo the resultant contents. 925 * @return string The output of the row cells (optional). 926 */ 927 function output_row_cells($row_id, $return=false) 928 { 929 if(!$return) 930 { 931 echo $this->_container->output_row_cells($row_id, $return); 932 } 933 else 934 { 935 return $this->_container->output_row_cells($row_id, $return); 936 } 937 } 938 939 /** 940 * Count the number of rows in the form container. Useful for displaying a 'no rows' message. 941 * 942 * @return int The number of rows in the form container. 943 */ 944 function num_rows() 945 { 946 return $this->_container->num_rows(); 947 } 948 949 /** 950 * Output the end of the form container row. 951 * 952 * @param boolean Whether or not to return or echo the resultant contents. 953 * @return string The output of the form container (optional). 954 */ 955 function end($return=false) 956 { 957 global $plugins; 958 959 $hook = array( 960 'return' => &$return, 961 'this' => &$this 962 ); 963 964 $plugins->run_hooks("admin_formcontainer_end", $hook); 965 if($return == true) 966 { 967 return $this->_container->output($this->_title, 1, "general form_container {$this->extra_class}", true); 968 } 969 else 970 { 971 echo $this->_container->output($this->_title, 1, "general form_container {$this->extra_class}", false); 972 } 973 } 974 } 975 976 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sun Dec 11 14:16:27 2011 | Cross-referenced by PHPXref 0.7.1 |