diff --git a/appexemplo_v1.0/app/control/DocumentationView.class.php b/appexemplo_v1.0/app/control/DocumentationView.class.php new file mode 100644 index 00000000..7cb69d98 --- /dev/null +++ b/appexemplo_v1.0/app/control/DocumentationView.class.php @@ -0,0 +1,81 @@ +form = new BootstrapFormBuilder('form'); + $this->form->setFormTitle('Source Code class: '.$class); + + $objhtml = new TElement('div'); + $html = 'Voltar para a Class:'.$class.''; + $objhtml->add($html); + $this->form->addFields( [$objhtml]); + + $config = AdiantiApplicationConfig::get(); + ini_set('highlight.comment', $config['highlight']['comment']); + ini_set('highlight.default', $config['highlight']['default']); + ini_set('highlight.html', $config['highlight']['html']); + ini_set('highlight.keyword', $config['highlight']['keyword']); + ini_set('highlight.string', $config['highlight']['string']); + + // scroll to put the source inside + $wrapper = new TElement('div'); + $wrapper->class = 'sourcecodewrapper'; + + $this->source = new TSourceCode; + $this->source->generateRowNumbers(); + $wrapper->add($this->source); + //parent::add($wrapper); + $this->form->addContent([$wrapper]); + + // wrap the page content using vertical box + $vbox = new TVBox; + $vbox->style = 'width:100%'; + //$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); + $vbox->add($this->form); + parent::add($vbox); + } + + /** + * Method onHelp + * Shows the source code for this sample, along with an explanation + */ + function onHelp($param) + { + if (isset($param['classname']) AND $param['classname']) + { + $folder = 'app/control'; + $classname = TSession::getValue('classCode'); + $list = new RecursiveDirectoryIterator($folder); + $it = new RecursiveIteratorIterator($list,RecursiveIteratorIterator::SELF_FIRST); + + foreach ($it as $entry){ + if ( strpos($entry, $classname) !== false ) { + $this->source->loadFile("$entry"); + return; + } + } + } else { + $this->source->loadFile('index.php'); + } + } +}