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 @@ +
+
+
+
+
+ +
+
-

Extra Features Coming Soon

+

Latest Backlinks

-
-

- 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 -

+
+ + + + + + + + + + + {% for a in backlinks %} + + + + + + + {% endfor %} + +
BacklinkLast CheckedStatusAction
{{ a.backlink|slice(0,75) ~ '...' }}
{% if a.lastchecked %}{{ a.lastchecked|date('d-m-Y / H:i') }}{% else %} Not Checked {% endif %}
{{ a.status }}
+ + + + +
@@ -80,14 +116,8 @@ {{keyword.status}}

-

Backlinks (work in progress) - 0 -

-

Linked Pages (work in progress) - 0 -

-

Prospects Sites (work in progress) - 0 +

Backlinks + {{ totalbacklinks }}

diff --git a/templates/sitepages/view.html.twig b/templates/sitepages/view.html.twig index 3cbac401..4e95a372 100644 --- a/templates/sitepages/view.html.twig +++ b/templates/sitepages/view.html.twig @@ -44,27 +44,63 @@
- somthing - somthing + ...... + Coming Soon
+
+
+
+
+
+ +
+
-

Extra Features Coming Soon

+

Latest Backlinks

+
+
+ + + + + + + + + + + {% for a in backlinks %} + + + + + + + {% endfor %} + +
BacklinkLast CheckedStatusAction
{{ a.backlink|slice(0,75) ~ '...' }}
{% if a.lastchecked %}{{ a.lastchecked|date('d-m-Y / H:i') }}{% else %} Not Checked {% endif %}
{{ a.status }}
+ + + + -
-

- 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 -

+
@@ -80,14 +116,11 @@ {{spage.status}}

-

Backlinks (work in progress) - 0 +

Backlinks + {{ totalbacklinks }}

-

Linked Pages (work in progress) - 0 -

-

Keywords Used (work in progress) - 0 +

Total Page Hits + {{ totalhits }}

@@ -208,6 +241,80 @@ }); }); + {% for a in backlinks %} + + {% endfor %} {% endblock %} {% block ModalArea %} diff --git a/templates/sites/keywords.html.twig b/templates/sites/keywords.html.twig index 4d9ec262..fdf70772 100644 --- a/templates/sites/keywords.html.twig +++ b/templates/sites/keywords.html.twig @@ -27,7 +27,7 @@ {% for kw in sitekeywords %} {{ kw.keyword }} - (coming soon) + {{ totalbacklinks }} {% if kw.updated %}{{ kw.updated|date('d-m-Y / H:i') }}{% else %} Not Updated {% endif %} {{ kw.status }} diff --git a/templates/sites/pages.html.twig b/templates/sites/pages.html.twig index 50027e5b..519b431b 100644 --- a/templates/sites/pages.html.twig +++ b/templates/sites/pages.html.twig @@ -18,6 +18,7 @@ Site Page Backlinks + Total Hits Last Updated Status Action @@ -27,7 +28,8 @@ {% for page in sitepages %} {{ page.url }} - (coming soon) + {{ totalbacklinks }} + {{ totalhits }} {% if page.updated %}{{ page.updated|date('d-m-Y / H:i') }}{% else %} Not Updated {% endif %} {{ page.status }}