public function testHelpFileExists() { $this->markTestIncomplete("File names are translated, but translation resources not yet accessible here."); $entries = Home_Model_HelpFiles::getHelpEntries(); foreach ($entries as $section) { foreach ($section as $file) { // TODO $this->assertTrue(); } } }
/** * Loads help configuration. * @return Zend_Config_Ini */ private static function getHelpConfig() { if (empty(Home_Model_HelpFiles::$__helpConfig)) { $config = null; $filePath = Home_Model_HelpFiles::getHelpPath() . 'help.ini'; if (file_exists($filePath)) { try { $config = new Zend_Config_Ini($filePath); } catch (Zend_Config_Exception $zce) { // TODO einfachere Lösung? $logger = Zend_Registry::get('Zend_Log'); if (!is_null($logger)) { $logger->err("could not load help configuration", $zce); } } } if (is_null($config)) { $config = new Zend_Config(array()); } Home_Model_HelpFiles::$__helpConfig = $config; } return Home_Model_HelpFiles::$__helpConfig; }
public function helpAction() { $config = Zend_Registry::get('Zend_Config'); if (isset($config->help->separate)) { $this->view->separate = (bool) $config->help->separate; } else { $this->view->separate = false; } if ($this->view->separate) { $content = $this->getRequest()->getParam('content'); if (!is_null($content)) { if ($content === 'contact') { $this->_redirectToAndExit('contact'); } if ($content === 'imprint') { $this->_redirectToAndExit('imprint'); } $translation = $this->view->translate('help_content_' . $content); // get all readable help files in directory /home/views/scripts $helpFilesAvailable = Home_Model_HelpFiles::getFiles(); $pos = array_search($translation, $helpFilesAvailable); if ($pos !== FALSE) { $this->view->contenttitle = 'help_title_' . $content; $this->view->content = Home_Model_HelpFiles::getFileContent($helpFilesAvailable[$pos]); } elseif ($translation !== 'help_content_' . $content) { // a translation exists, but it is not a valid file name $this->view->contenttitle = 'help_title_' . $content; $this->view->content = $translation; } } } $this->_helper->mainMenu('help'); }