2 // CardSet is a widget for displaying a stack of cards, e.g. for
3 // user preferences. It is skinnable by overloading.
4 // Default CardSet uses fieldsets for the cards,
5 // the derived class TabbedCardSet uses JavaScript-based tabs
8 // First, create a CardSet using the constructor
9 // Then, add cards to it
10 // Finally Render to get the HTML
14 /* private */ var $mLabels, // Array of card labels
15 $mBodies, // Array of card bodies
16 $mTitle; // Title of this stack
18 // Initialize an empty CardSet.
19 function CardSet( $title )
21 $this->mLabels
= array();
22 $this->mBodies
= array();
23 $this->mTitle
= $title;
26 // Add a card to the set. The body of the card is expected to be
27 // HTML, not wikitext.
28 function addCard( $label, $body )
30 $this->mLabels
[] = $label;
31 $this->mBodies
[] = $body;
34 // Return the HTML of this CardSet
35 function renderToOutpage( &$out )
37 for ( $i=0; $i<count( $this->mLabels
); $i++
)
39 $s .= "<fieldset>\n<legend>" . $this->mLabels
[$i] . "</legend>\n"
40 . $this->mBodies
[$i] . "</fieldset>\n";
46 } // end of: class CardSet