@@ -506,9 +506,13 @@ public function download() {
506506$ csvFile ->add ($ header );
507507
508508// 回答データ整形
509+ $ choices = array ();
510+ foreach ($ content ['CircularNoticeChoice ' ] as $ choice ) {
511+ $ choices [$ choice ['id ' ]] = $ choice ;
512+ }
509513$ content = $ content ['CircularNoticeContent ' ];
510514foreach ($ targetUsers as $ targetUser ) {
511- $ answer = $ this ->__parseAnswer ($ content ['reply_type ' ], $ targetUser );
515+ $ answer = $ this ->__parseAnswer ($ content ['reply_type ' ], $ targetUser, $ choices );
512516
513517$ readDatetime = __d ('circular_notices ' , 'Unread ' );
514518if ($ targetUser ['CircularNoticeTargetUser ' ]['read_datetime ' ]) {
@@ -550,9 +554,10 @@ public function download() {
550554 *
551555 * @param string $replyType 回答種別
552556 * @param array $targetUser 回答者
557+ * @param array $choices 選択肢情報
553558 * @return null|string
554559 */
555- private function __parseAnswer ($ replyType , $ targetUser ) {
560+ private function __parseAnswer ($ replyType , $ targetUser, $ choices ) {
556561$ answer = null ;
557562switch ($ replyType ) {
558563case CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_REPLY_TYPE_TEXT :
@@ -562,6 +567,10 @@ private function __parseAnswer($replyType, $targetUser) {
562567case CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_REPLY_TYPE_MULTIPLE_SELECTION :
563568$ selectionValues = explode (CircularNoticeComponent::SELECTION_VALUES_DELIMITER ,
564569$ targetUser ['CircularNoticeTargetUser ' ]['reply_selection_value ' ]);
570+ // 取り出したreply_selection_valueの値を選択肢のラベルに変換する
571+ foreach ($ selectionValues as &$ selectVal ) {
572+ $ selectVal = $ choices [$ selectVal ]['value ' ] ?? '' ;
573+ }
565574$ answer = implode (__d ('circular_notices ' , 'Answer separator ' ), $ selectionValues );
566575break ;
567576}
0 commit comments