Exemplo n.º 1
0
 /**
  * Show all the runs and last runs detail
  * 
  * @global array $_ARRAYLANG
  */
 public function showCrawlerRuns()
 {
     global $_ARRAYLANG;
     //show the last runs details
     $lastRunResult = $this->crawlerRepository->getLatestRunDetails();
     if ($lastRunResult) {
         $this->template->setVariable(array($this->moduleNameLang . '_LAST_RUN_STARTTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($lastRunResult[0]->getStartTime()), $this->moduleNameLang . '_LAST_RUN_ENDTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($lastRunResult[0]->getEndTime()), $this->moduleNameLang . '_LAST_RUN_DURATION' => \Cx\Core_Modules\LinkManager\Controller\DateTime::diffTime($lastRunResult[0]->getStartTime(), $lastRunResult[0]->getEndTime()), $this->moduleNameLang . '_LAST_RUN_TOTAL_LINKS' => $lastRunResult[0]->getTotalLinks(), $this->moduleNameLang . '_LAST_RUN_BROKEN_LINKS' => $lastRunResult[0]->getTotalBrokenLinks()));
     } else {
         if ($this->template->blockExists('showLastRun')) {
             $this->template->hideBlock('showLastRun');
         }
     }
     //show Crawler Runs table
     //get parameters
     $pos = isset($_GET['pos']) ? $_GET['pos'] : 0;
     $langArray = \FWLanguage::getLanguageArray();
     //set the settings value from DB
     \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config');
     $pageLimit = \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager');
     $parameter = './index.php?cmd=' . $this->moduleName;
     $this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->crawlerRepository->crawlerEntryCount(), $pageLimit, true, $pos, 'pos'));
     $crawlers = $this->crawlerRepository->getCrawlerRunEntries($pos, $pageLimit);
     $i = 1;
     if ($crawlers && $crawlers->count() > 0) {
         foreach ($crawlers as $crawler) {
             $this->template->setVariable(array($this->moduleNameLang . '_CRAWLER_RUN_ID' => $crawler->getId(), $this->moduleNameLang . '_CRAWLER_RUN_LANGUAGE' => $langArray[$crawler->getLang()]['name'], $this->moduleNameLang . '_CRAWLER_RUN_STARTTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($crawler->getStartTime()), $this->moduleNameLang . '_CRAWLER_RUN_ENDTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($crawler->getEndTime()), $this->moduleNameLang . '_CRAWLER_RUN_DURATION' => \Cx\Core_Modules\LinkManager\Controller\DateTime::diffTime($crawler->getStartTime(), $crawler->getEndTime()), $this->moduleNameLang . '_CRAWLER_RUN_TOTAL_LINKS' => $crawler->getTotalLinks(), $this->moduleNameLang . '_CRAWLER_RUN_BROKEN_LINKS' => $crawler->getTotalBrokenLinks(), $this->moduleNameLang . '_CRAWLER_RUN_STATUS' => ucfirst($crawler->getRunStatus()), $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1)));
             $this->template->parse($this->moduleName . 'CrawlerRuns');
         }
         $this->template->hideBlock($this->moduleName . 'NoCrawlerRunsFound');
     } else {
         $this->template->touchBlock($this->moduleName . 'NoCrawlerRunsFound');
     }
 }