Exemplo n.º 1
0
 public function testGetFileContentForAllFiles()
 {
     $helpFiles = Home_Model_HelpFiles::getFiles();
     foreach ($helpFiles as $file) {
         $content = Home_Model_HelpFiles::getFileContent($file);
         $this->assertNotEmpty($content, "Could not get content of file '{$file}'.");
     }
 }
Exemplo n.º 2
0
 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');
 }