Skip to content

Commit 2b48071

Browse files
authored
Merge pull request #95 from topcoder-platform/issues-563
Issues-563: Fixed breadcrumbs
2 parents bce6c43 + 6ab8686 commit 2b48071

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Topcoder/class.topcoder.plugin.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ function gdn_dispatcher_beforeControllerMethod_handler($sender, $args){
867867
]);
868868

869869
$groupID = false;
870+
$categoryModel = new CategoryModel();
870871
if($args['Controller'] instanceof DiscussionController) {
871872
if(array_key_exists('discussionid', $methodArgs)) {
872873
$discussionID = $methodArgs['discussionid'];
@@ -888,7 +889,6 @@ function gdn_dispatcher_beforeControllerMethod_handler($sender, $args){
888889
$discussionModel = new DiscussionModel();
889890
$discussion = $discussionModel->getID($discussionID);
890891
if($discussion->CategoryID){
891-
$categoryModel = new CategoryModel();
892892
$category = $categoryModel->getID($discussion->CategoryID);
893893
$groupID = $category->GroupID;
894894
}
@@ -899,16 +899,28 @@ function gdn_dispatcher_beforeControllerMethod_handler($sender, $args){
899899
$discussionModel = new DiscussionModel();
900900
$discussion = $discussionModel->getID($comment->DiscussionID);
901901
if($discussion->CategoryID){
902-
$categoryModel = new CategoryModel();
903902
$category = $categoryModel->getID($discussion->CategoryID);
904903
$groupID = $category->GroupID;
905904
}
906905
}
906+
} else if($args['Controller'] instanceof CategoriesController) {
907+
if (array_key_exists('categoryidentifier', $methodArgs)) {
908+
$categoryUrlCode = $methodArgs['categoryidentifier'];
909+
if($categoryUrlCode) {
910+
$category = $categoryModel->getByCode($categoryUrlCode);
911+
$groupID = val('GroupID', $category);
912+
}
913+
}
907914
}
908915

909916
if($groupID && $groupID > 0) {
910917
$groupModel = new GroupModel();
911918
$group = $groupModel->getByGroupID($groupID);
919+
$category = $categoryModel->getByCode($group->ChallengeID);
920+
$categoryID= val('CategoryID', $category);
921+
Gdn::controller()->setData('Breadcrumbs.Options.GroupCategoryID', $categoryID);
922+
Gdn::controller()->setData('Breadcrumbs.Options.GroupID', $groupID);
923+
Gdn::controller()->setData('Breadcrumbs.Options.ChallengeID', $group->ChallengeID);
912924
if ($group->ChallengeID) {
913925
$this->setTopcoderProjectData($args['Controller'], $group->ChallengeID);
914926
}
@@ -1547,6 +1559,7 @@ public function getChallenge($challengeId) {
15471559
}
15481560
$cachedChallenge['StartDate'] = $startDate;
15491561
$cachedChallenge['EndDate'] = $endDate;
1562+
$cachedChallenge['Track'] = $challenge->track;
15501563
$termIDs = array_column($challenge->terms, 'id');
15511564
$NDA_UUID = c('Plugins.Topcoder.NDA_UUID');
15521565
$cachedChallenge['IsNDA'] = in_array($NDA_UUID, $termIDs);

0 commit comments

Comments
 (0)