File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1682,7 +1682,7 @@ public function getCoursesCampus(int $campusId = 0): array
1682
1682
*
1683
1683
* @throws Exception
1684
1684
*/
1685
- public function getSessionsCampus (int $ campusId = 0 ): array
1685
+ public function getSessionsCampus (int $ campusId = 0 , bool $ getExtraFields = false ): array
1686
1686
{
1687
1687
self ::protectAdminEndpoint ();
1688
1688
@@ -1695,12 +1695,18 @@ public function getSessionsCampus(int $campusId = 0): array
1695
1695
);
1696
1696
$ shortList = [];
1697
1697
foreach ($ list as $ session ) {
1698
- $ shortList [] = [
1698
+ $ bundle = [
1699
1699
'id ' => $ session ['id ' ],
1700
1700
'name ' => $ session ['name ' ],
1701
1701
'access_start_date ' => $ session ['access_start_date ' ],
1702
1702
'access_end_date ' => $ session ['access_end_date ' ],
1703
1703
];
1704
+ if ($ getExtraFields ) {
1705
+ $ extraFieldValues = new ExtraFieldValue ('session ' );
1706
+ $ extraFields = $ extraFieldValues ->getAllValuesByItem ($ session ['id ' ]);
1707
+ $ bundle ['extra_fields ' ] = $ extraFields ;
1708
+ }
1709
+ $ shortList [] = $ bundle ;
1704
1710
}
1705
1711
1706
1712
return $ shortList ;
Original file line number Diff line number Diff line change 794
794
if (!empty ($ _POST ['id_campus ' ])) {
795
795
$ campusId = (int ) $ _POST ['id_campus ' ];
796
796
}
797
+ $ getExtraFields = false ;
798
+ if (!empty ($ _POST ['get_extra_fields ' ]) && ('false ' != $ _POST ['get_extra_fields ' ])) {
799
+ $ getExtraFields = true ;
800
+ }
797
801
Event::addEvent (LOG_WS .$ action , 'id_campus ' , $ campusId );
798
- $ data = $ restApi ->getSessionsCampus ($ campusId );
802
+ $ data = $ restApi ->getSessionsCampus ($ campusId, $ getExtraFields );
799
803
$ restResponse ->setData ($ data );
800
804
break ;
801
805
case Rest::ADD_COURSES_SESSION :
You can’t perform that action at this time.
0 commit comments