@@ -1203,12 +1203,18 @@ public function view(Portfolio $item)
1203
1203
;
1204
1204
}
1205
1205
1206
- $ comments = $ commentsQueryBuilder
1207
- ->orderBy ('comment.root, comment.lft ' , 'ASC ' )
1208
- ->setParameter ('item ' , $ item )
1209
- ->getQuery ()
1210
- ->getArrayResult ()
1211
- ;
1206
+ if (true === api_get_configuration_value ('portfolio_show_base_course_post_in_sessions ' )
1207
+ && $ this ->session && !$ item ->getSession () && !$ item ->isDuplicatedInSession ($ this ->session )
1208
+ ) {
1209
+ $ comments = [];
1210
+ } else {
1211
+ $ comments = $ commentsQueryBuilder
1212
+ ->orderBy ('comment.root, comment.lft ' , 'ASC ' )
1213
+ ->setParameter ('item ' , $ item )
1214
+ ->getQuery ()
1215
+ ->getArrayResult ()
1216
+ ;
1217
+ }
1212
1218
1213
1219
$ clockIcon = Display::returnFontAwesomeIcon ('clock-o ' , '' , true );
1214
1220
@@ -3762,6 +3768,9 @@ private function getItemsForIndex(
3762
3768
$ currentUserId = api_get_user_id ();
3763
3769
3764
3770
if ($ this ->course ) {
3771
+ $ showBaseContentInSession = $ this ->session
3772
+ && true === api_get_configuration_value ('portfolio_show_base_course_post_in_sessions ' );
3773
+
3765
3774
$ queryBuilder = $ this ->em ->createQueryBuilder ();
3766
3775
$ queryBuilder
3767
3776
->select ('pi ' )
@@ -3771,7 +3780,9 @@ private function getItemsForIndex(
3771
3780
$ queryBuilder ->setParameter ('course ' , $ this ->course );
3772
3781
3773
3782
if ($ this ->session ) {
3774
- $ queryBuilder ->andWhere ('pi.session = :session ' );
3783
+ $ queryBuilder ->andWhere (
3784
+ $ showBaseContentInSession ? 'pi.session = :session OR pi.session IS NULL ' : 'pi.session = :session '
3785
+ );
3775
3786
$ queryBuilder ->setParameter ('session ' , $ this ->session );
3776
3787
} else {
3777
3788
$ queryBuilder ->andWhere ('pi.session IS NULL ' );
@@ -3894,6 +3905,15 @@ private function getItemsForIndex(
3894
3905
$ queryBuilder ->orderBy ('pi.creationDate ' , 'DESC ' );
3895
3906
3896
3907
$ items = $ queryBuilder ->getQuery ()->getResult ();
3908
+
3909
+ if ($ showBaseContentInSession ) {
3910
+ $ items = array_filter (
3911
+ $ items ,
3912
+ fn (Portfolio $ item ) => !($ this ->session && !$ item ->getSession () && $ item ->isDuplicatedInSession ($ this ->session ))
3913
+ );
3914
+ }
3915
+
3916
+ return $ items ;
3897
3917
} else {
3898
3918
$ itemsCriteria = [];
3899
3919
$ itemsCriteria ['category ' ] = null ;
0 commit comments