diff --git a/src/Controller/KeywordsController.php b/src/Controller/KeywordsController.php index 94c3dccb..f5242377 100644 --- a/src/Controller/KeywordsController.php +++ b/src/Controller/KeywordsController.php @@ -38,6 +38,7 @@ public function KeywordView($id, Request $request) // Repos $knotesrepo = $this->getDoctrine()->getRepository(KeywordsNotes::class); + $blrepo = $this->getDoctrine()->getRepository(Backlinks::class); $keyword = $this->getDoctrine()->getRepository(Keywords::class)->find($id); $site = $this->getDoctrine()->getRepository(Sites::class)->find($keyword->getSiteId()); @@ -46,12 +47,20 @@ public function KeywordView($id, Request $request) $knotestasks = $knotesrepo->findBy(['keywordid' => $keyword->getId(), 'status' => 'Unread', 'type' => 'Task'], ['id' => 'DESC']); $knotesissues = $knotesrepo->findBy(['keywordid' => $keyword->getId(), 'status' => 'Unread', 'type' => 'Issue'], ['id' => 'DESC']); + // Latest Backlinks + $backlinks = $blrepo->findBy(['keywordid' => $id],['id' => 'DESC'], $limit = 5); + # Count Backlinks + $getbl = $blrepo->findBy(['keywordid' => $id]); + $totalbacklinks = count($getbl); + return $this->render('keywords/view.html.twig', [ 'site' => $site, 'keyword' => $keyword, 'knotestasks' => $knotestasks, 'knotesissues' => $knotesissues, + 'backlinks' => $backlinks, + 'totalbacklinks' => $totalbacklinks, ] ); } diff --git a/src/Controller/SitepagesController.php b/src/Controller/SitepagesController.php index d4892a59..5ab2abd8 100644 --- a/src/Controller/SitepagesController.php +++ b/src/Controller/SitepagesController.php @@ -12,6 +12,8 @@ use App\Entity\Sitepages; use App\Entity\System\DataSettings; use App\Entity\Notes\SitepagesNotes; +use App\Entity\Linktracking\TrackingUrls; +use App\Entity\Linktracking\TrackingCampaigns; use App\Form\Sitepages\AddNoteType; use Symfony\Component\HttpFoundation\JsonResponse; @@ -38,6 +40,8 @@ public function SitepageView($id, Request $request) } $spnotesrepo = $this->getDoctrine()->getRepository(SitepagesNotes::class); + $blrepo = $this->getDoctrine()->getRepository(Backlinks::class); + $turls = $this->getDoctrine()->getRepository(TrackingUrls::class); $spage = $this->getDoctrine()->getRepository(Sitepages::class)->find($id); $site = $this->getDoctrine()->getRepository(Sites::class)->find($spage->getSiteId()); @@ -46,12 +50,32 @@ public function SitepageView($id, Request $request) $spnotestasks = $spnotesrepo->findBy(['spageid' => $spage->getId(), 'status' => 'Unread', 'type' => 'Task'], ['id' => 'DESC']); $spnotesissues = $spnotesrepo->findBy(['spageid' => $spage->getId(), 'status' => 'Unread', 'type' => 'Issue'], ['id' => 'DESC']); + // Latest Backlinks + $backlinks = $blrepo->findBy(['spageid' => $id],['id' => 'DESC'], $limit = 5); + # Count Backlinks + $getbl = $blrepo->findBy(['spageid' => $id]); + $totalbacklinks = count($getbl); + + $pageturls = $turls->findBy(['spageid' => $id]); + + $counthits = 0; + foreach ($pageturls as $key=>$value) + { + $counthits+= $value->getUrlHits(); + } + + $totalhits = $counthits; + + return $this->render('sitepages/view.html.twig', [ 'site' => $site, 'spage' => $spage, 'spnotestasks' => $spnotestasks, 'spnotesissues' => $spnotesissues, + 'backlinks' => $backlinks, + 'totalbacklinks' => $totalbacklinks, + 'totalhits' => $totalhits ] ); } diff --git a/src/Controller/SitesController.php b/src/Controller/SitesController.php index fdfebe3c..b155fabc 100644 --- a/src/Controller/SitesController.php +++ b/src/Controller/SitesController.php @@ -361,7 +361,7 @@ public function SiteKeywords($id, Request $request) // Repos $datasettings = $this->getDoctrine()->getRepository(DataSettings::class)->find(1); $sitekeywords = $this->getDoctrine()->getRepository(Keywords::class); - + $backlinks = $this->getDoctrine()->getRepository(Backlinks::class); $site = $this->getDoctrine()->getRepository(Sites::class)->find($id); @@ -391,6 +391,15 @@ public function SiteKeywords($id, Request $request) if ($page){ $offset = ($page - 1) * $limit; $sitekeywords = $sitekeywords->findBy(['siteid' => $id], ['id' => 'DESC'], $limit, $offset); + + $countbls = 0; + foreach ($sitekeywords as $keyword) + { + $keywordid = $keyword->getId(); + $getbls = $backlinks->findBy(['keywordid' => $keywordid]); + $countbls = count($getbls); + } + $totalbacklinks = $countbls; } // 2) handle the submit (will only happen on POST) @@ -426,6 +435,7 @@ public function SiteKeywords($id, Request $request) 'nextpage' => $nextpage, 'maxpages' => $maxpages, 'form' => $form->createView(), + 'totalbacklinks' => $totalbacklinks, ] ); } @@ -443,10 +453,12 @@ public function SitePages($id, Request $request) // Repos $datasettings = $this->getDoctrine()->getRepository(DataSettings::class)->find(1); $sitepages = $this->getDoctrine()->getRepository(SitePages::class); + $backlinks = $this->getDoctrine()->getRepository(Backlinks::class); + $turls = $this->getDoctrine()->getRepository(TrackingUrls::class); $site = $this->getDoctrine()->getRepository(Sites::class)->find($id); - + // Paginition $page = isset($_GET['page']) ? $_GET['page'] : "1"; $limit = $datasettings->getMaxPageRows(); @@ -468,6 +480,25 @@ public function SitePages($id, Request $request) if ($page){ $offset = ($page - 1) * $limit; $sitepages = $sitepages->findBy(['siteid' => $id], ['id' => 'DESC'], $limit, $offset); + + $countbls = 0; + foreach ($sitepages as $page) + { + $pageid = $page->getId(); + $getbls = $backlinks->findBy(['spageid' => $pageid]); + $countbls = count($getbls); + + $pageturls = $turls->findBy(['spageid' => $pageid]); + + $counthits = 0; + foreach ($pageturls as $key=>$value) + { + $counthits+= $value->getUrlHits(); + } + + $totalhits = $counthits; + } + $totalbacklinks = $countbls; } // 1) build the form @@ -508,6 +539,8 @@ public function SitePages($id, Request $request) 'nextpage' => $nextpage, 'maxpages' => $maxpages, 'form' => $form->createView(), + 'totalbacklinks' => $totalbacklinks, + 'totalhits' => $totalhits, ] ); } diff --git a/templates/keywords/view.html.twig b/templates/keywords/view.html.twig index 62b57240..68f468ea 100644 --- a/templates/keywords/view.html.twig +++ b/templates/keywords/view.html.twig @@ -50,21 +50,57 @@ +
- We are working out extra feature that will fill this space, - We are working hard to get as much features in as possible -
-- Overtime this space will be filled with extra information as we build the system, - In the meantime if you have any ideas or suggestions please feel free to let us know and we will aim to implement them here -
+Backlinks (work in progress) - 0 -
-Linked Pages (work in progress) - 0 -
-Prospects Sites (work in progress) - 0 +
Backlinks + {{ totalbacklinks }}
Backlinks (work in progress) - 0 +
Backlinks + {{ totalbacklinks }}
-Linked Pages (work in progress) - 0 -
-Keywords Used (work in progress) - 0 +
Total Page Hits + {{ totalhits }}