Rev 3 | Details | Compare with Previous | Last modification | View Log
Rev | Author | Line |
---|---|---|
2 | user_9 | <?php |
user_9 | ||
3 | user_9 | /** |
user_9 | * Ein Tab vom Tabber-Plugin |
|
user_9 | * @package Plugin-Tabber |
|
user_9 | * @author JuKu |
|
user_9 | * @link http://contentlion.pf-control.de/tabber.html |
|
user_9 | */ |
|
2 | user_9 | class Plugin_Tabber_Tab { |
user_9 | ||
user_9 | protected $title = ""; |
|
user_9 | public $innerHTML = ""; |
|
user_9 | ||
user_9 | protected $style_id = null; |
|
user_9 | protected $default_tab = ""; |
|
user_9 | ||
3 | user_9 | /** |
user_9 | * |
|
user_9 | * Construct - Creates a new Instance of this class. |
|
user_9 | * @param String title |
|
user_9 | */ |
|
2 | user_9 | public function __construct ($title = null) { |
3 | user_9 | if ($title != null) |
user_9 | $title = htmlentities($title); |
|
user_9 | ||
2 | user_9 | $this->title = $title; |
user_9 | } |
|
user_9 | ||
6 | user_9 | /* |
user_9 | * |
|
user_9 | * Set the title. |
|
user_9 | * @param String title |
|
user_9 | */ |
|
user_9 | public function setTitle ($title) { |
|
user_9 | $this->title = htmlentities($title); |
|
user_9 | } |
|
user_9 | ||
3 | user_9 | /** |
user_9 | * |
|
user_9 | * Set a custom style ID (CSS) to this class. |
|
user_9 | * @param String id |
|
user_9 | */ |
|
2 | user_9 | public function addCustomStyleID ($id) { |
user_9 | $this->style_id = $id; |
|
user_9 | } |
|
user_9 | ||
3 | user_9 | /** |
user_9 | * |
|
user_9 | * Set the innerHTML-Code. |
|
user_9 | * @param String code |
|
user_9 | */ |
|
2 | user_9 | public function setCode ($code) { |
user_9 | $this->innerHTML .= $code; |
|
user_9 | } |
|
user_9 | ||
3 | user_9 | /** |
user_9 | * |
|
user_9 | * Set the default tab. |
|
user_9 | * @param boolean true/false |
|
user_9 | */ |
|
2 | user_9 | public function setDefaultTab ($bool) { |
user_9 | if ($bool) { |
|
3 | user_9 | $this->default_tab = " plugin_tabber_tabbertabdefault"; |
2 | user_9 | } else { |
user_9 | $this->default_tab = ""; |
|
user_9 | } |
|
user_9 | } |
|
user_9 | ||
3 | user_9 | /** |
user_9 | * |
|
user_9 | * Returns the Code of the tabber-tab. |
|
user_9 | * @param |
|
user_9 | * @return String code |
|
user_9 | */ |
|
2 | user_9 | public function getCode () { |
user_9 | if ($this->title == null) { |
|
3 | user_9 | $code = "<div class=\"plugin_tabber_tabbertab" . $this->default_tab . "\">"; |
2 | user_9 | } else { |
3 | user_9 | $code = "<div class=\"plugin_tabber_tabbertab" . $this->default_tab . "\" title=\"" . $this->title . "\">"; |
2 | user_9 | } |
user_9 | ||
user_9 | $code .= $this->innerHTML; |
|
user_9 | EventManager::raiseEvent("tabber_get_tab", array('code' => &$code, 'instance' => &$this)); |
|
user_9 | ||
user_9 | $code .= "</div>"; |
|
user_9 | return $code; |
|
user_9 | } |
|
user_9 | ||
3 | user_9 | /** |
user_9 | * |
|
user_9 | * Returns the Code to show a tab. |
|
user_9 | * @param int id |
|
user_9 | * @return String code |
|
user_9 | */ |
|
2 | user_9 | public static function getCodeForShow ($id) { |
user_9 | return "document.getElementById('" . $id . "').tabber.tabShow(0);"; |
|
user_9 | } |
|
user_9 | ||
3 | user_9 | /** |
user_9 | * |
|
user_9 | * Returns the Code of the tabber-tab with <script...</script>. |
|
user_9 | * @param |
|
user_9 | * @return String code |
|
user_9 | */ |
|
2 | user_9 | public static function getJSCodeForShow ($id) { |
user_9 | return "<script type=\"text/javascript\">" . self::getCodeForShow($id) . "</script>"; |
|
user_9 | } |
|
user_9 | ||
user_9 | } |
|
user_9 | ||
user_9 | ?> |