* @license PHP License * @package WB * @subpackage base */ WBClass::load('WBWxml_Dialog'); /** * Wxml Dialog Module * * TOC - Table of content * * @version 0.1.0 * @package WB * @subpackage base */ class WBWxml_Dialog_Toc extends WBWxml_Dialog { /** * Start dialog using default values * */ public function start() { $values = array(); $template = $this->getAttribute('template'); $tags = trim($this->getAttribute('tags')); if (empty($tags)) { $tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'); } else { $tags = explode(',', $tags); } if (!empty($template)) { $values = array( 'class' => $this->value, 'template' => $template, 'stopat' => $this->getAttribute('stopat'), 'tags' => $tags ); } $values['title'] = strip_tags($this->select); $values['tags'] = $tags; $this->submit($values); } /** * Form "Toc" validated * * mangle "internal" URLs as such and generate HTML snippet to * past into editor * * @param patForms $forn * @param array $values * @return bool always true - display valid-template */ protected function onTocValid($forn, $values) { if (!isset($values['class']) || empty($values['class'])) { $values['class'] = ''; } if (isset($values['tags']) && is_array($values['tags'])) { $values['tags'] = implode(',', $values['tags']); } $this->tmpl->addGlobalVars($values); return true; } }