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
16821682 *
16831683 * @throws Exception
16841684 */
1685- public function getSessionsCampus (int $ campusId = 0 ): array
1685+ public function getSessionsCampus (int $ campusId = 0 , bool $ getExtraFields = false ): array
16861686 {
16871687 self ::protectAdminEndpoint ();
16881688
@@ -1695,12 +1695,18 @@ public function getSessionsCampus(int $campusId = 0): array
16951695 );
16961696 $ shortList = [];
16971697 foreach ($ list as $ session ) {
1698- $ shortList [] = [
1698+ $ bundle = [
16991699 'id ' => $ session ['id ' ],
17001700 'name ' => $ session ['name ' ],
17011701 'access_start_date ' => $ session ['access_start_date ' ],
17021702 'access_end_date ' => $ session ['access_end_date ' ],
17031703 ];
1704+ if ($ getExtraFields ) {
1705+ $ extraFieldValues = new ExtraFieldValue ('session ' );
1706+ $ extraFields = $ extraFieldValues ->getAllValuesByItem ($ session ['id ' ]);
1707+ $ bundle ['extra_fields ' ] = $ extraFields ;
1708+ }
1709+ $ shortList [] = $ bundle ;
17041710 }
17051711
17061712 return $ shortList ;
Original file line number Diff line number Diff line change 794794 if (!empty ($ _POST ['id_campus ' ])) {
795795 $ campusId = (int ) $ _POST ['id_campus ' ];
796796 }
797+ $ getExtraFields = false ;
798+ if (!empty ($ _POST ['get_extra_fields ' ]) && ('false ' != $ _POST ['get_extra_fields ' ])) {
799+ $ getExtraFields = true ;
800+ }
797801 Event::addEvent (LOG_WS .$ action , 'id_campus ' , $ campusId );
798- $ data = $ restApi ->getSessionsCampus ($ campusId );
802+ $ data = $ restApi ->getSessionsCampus ($ campusId, $ getExtraFields );
799803 $ restResponse ->setData ($ data );
800804 break ;
801805 case Rest::ADD_COURSES_SESSION :
You can’t perform that action at this time.
0 commit comments