/** * Show the last run's crawler result * * @global array $_ARRAYLANG */ public function showCrawlerResult() { global $_ARRAYLANG; \JS::activate('cx'); $objCx = \ContrexxJavascript::getInstance(); $objCx->setVariable(array('updateSuccessMsg' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_UPDATE_SUCCESS_MSG'], 'loadingLabel' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LABEL_LOADING']), 'LinkManager'); if (isset($_POST['checkAgain'])) { $this->recheckSelectedLinks(); } //show crawler results //get parameters $pos = isset($_GET['pos']) ? $_GET['pos'] : 0; //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 . '&act=crawlerResult'; $this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->linkRepository->brokenLinkCount(), $pageLimit, true, $pos, 'pos')); $brokenLinks = $this->linkRepository->getBrokenLinks($pos, $pageLimit); $i = 1; $objUser = new \Cx\Core_Modules\LinkManager\Controller\User(); if ($brokenLinks && $brokenLinks->count() > 0) { foreach ($brokenLinks as $brokenLink) { $this->template->setVariable(array($this->moduleNameLang . '_BROKEN_LINK_ID' => contrexx_raw2xhtml($brokenLink->getId()), $this->moduleNameLang . '_BROKEN_LINK_IMAGE' => $brokenLink->getBrokenLinkText() == $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NO_IMAGE'] ? 'brokenImage' : 'brokenLinkImage', $this->moduleNameLang . '_BROKEN_LINK_TEXT' => $brokenLink->getBrokenLinkText(), $this->moduleNameLang . '_BROKEN_LINK_URL' => contrexx_raw2xhtml($brokenLink->getRequestedPath()), $this->moduleNameLang . '_BROKEN_LINK_REFERER' => contrexx_raw2xhtml($brokenLink->getLeadPath()) . '&pos=' . $pos . '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code(), $this->moduleNameLang . '_BROKEN_LINK_MODULE_NAME' => contrexx_raw2xhtml($brokenLink->getModuleName()), $this->moduleNameLang . '_BROKEN_LINK_ENTRY_TITLE' => contrexx_raw2xhtml($brokenLink->getEntryTitle()), $this->moduleNameLang . '_BROKEN_LINK_STATUS_CODE' => $brokenLink->getLinkStatusCode() == 0 ? $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NON_EXISTING_DOMAIN'] : contrexx_raw2xhtml($brokenLink->getLinkStatusCode()), $this->moduleNameLang . '_BROKEN_LINK_STATUS' => $brokenLink->getLinkStatus() ? $brokenLink->getLinkStatus() : 0, $this->moduleNameLang . '_BROKEN_LINK_STATUS_CHECKED' => $brokenLink->getLinkStatus() ? 'checked' : '', $this->moduleNameLang . '_BROKEN_LINK_DETECTED' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($brokenLink->getDetectedTime()), $this->moduleNameLang . '_BROKEN_LINK_UPDATED_BY' => $brokenLink->getUpdatedBy() ? contrexx_raw2xhtml($objUser->getUpdatedUserName($brokenLink->getUpdatedBy(), 0)) : '', $this->moduleNameLang . '_CRAWLER_BROKEN_LINK' => $brokenLink->getLinkRecheck() && $brokenLink->getLinkStatus() ? 'brokenLink' : '', $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1))); $this->template->parse($this->moduleName . 'CrawlerResultList'); } $this->template->hideBlock('LinkManagerNoCrawlerResultFound'); } else { $this->template->touchBlock('LinkManagerNoCrawlerResultFound'); } }
/** * 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'); } }