@@ -1624,6 +1624,7 @@ public function getChallenge($challengeId) {
1624
1624
$ cachedChallenge ['StartDate ' ] = $ startDate ;
1625
1625
$ cachedChallenge ['EndDate ' ] = $ endDate ;
1626
1626
$ cachedChallenge ['Track ' ] = $ challenge ->track ;
1627
+ $ cachedChallenge ['IsSelfService ' ] = $ challenge ->legacy ->selfService ;
1627
1628
$ termIDs = array_column ($ challenge ->terms , 'id ' );
1628
1629
$ NDA_UUID = c ('Plugins.Topcoder.NDA_UUID ' );
1629
1630
$ cachedChallenge ['IsNDA ' ] = in_array ($ NDA_UUID , $ termIDs );
@@ -1802,7 +1803,6 @@ private static function isTopcoderAdmin($topcoderRoles = false) {
1802
1803
1803
1804
/**
1804
1805
* Check if the list of Topcoder roles includes 'Client Manager' role
1805
- * @param false $topcoderRoles
1806
1806
* @return bool true, if the list of Topcoder roles includes 'Client Manager'
1807
1807
*/
1808
1808
public static function isTopcoderClientManager () {
@@ -1818,6 +1818,22 @@ public static function isTopcoderClientManager() {
1818
1818
return false ;
1819
1819
}
1820
1820
1821
+ /**
1822
+ * Check if the challenge has self-service flag
1823
+ * @return bool true, if the challenge has self-service flag
1824
+ */
1825
+ public static function isChallengeSelfService () {
1826
+ if (!Gdn::session ()->isValid ()) {
1827
+ return false ;
1828
+ }
1829
+ $ challenge = Gdn::controller ()->data ("Challenge " );
1830
+ if ($ challenge ) {
1831
+ return $ challenge ['IsSelfService ' ];
1832
+ }
1833
+
1834
+ return false ;
1835
+ }
1836
+
1821
1837
/**
1822
1838
* Get Topcoder Role names
1823
1839
* @param false $topcoderRoles
@@ -2938,3 +2954,12 @@ function hideInMFE() {
2938
2954
return false ;
2939
2955
}
2940
2956
}
2957
+
2958
+ if (!function_exists ('isSelfService ' )) {
2959
+ function isSelfService () {
2960
+ if (!Gdn::session ()->isValid ()) {
2961
+ return false ;
2962
+ }
2963
+ return TopcoderPlugin::isChallengeSelfService ();
2964
+ }
2965
+ }
0 commit comments