OSDN Git Service

add ACS webapp, sql, htdocs
[acs/acs.git] / webapp / modules / Community / views / AnswerScheduleSuccessView.class.php
diff --git a/webapp/modules/Community/views/AnswerScheduleSuccessView.class.php b/webapp/modules/Community/views/AnswerScheduleSuccessView.class.php
new file mode 100644 (file)
index 0000000..401dfde
--- /dev/null
@@ -0,0 +1,131 @@
+<?php
+
+/**
+ * ¥³¥ß¥å¥Ë¥Æ¥£¤Î¥¹¥±¥¸¥å¡¼¥ë²óÅú
+ *
+ * @author  z-satosi
+ * @version $Revision: 1.1 $
+ */
+
+class AnswerScheduleSuccessView extends BaseView
+{
+       function execute() {
+
+               $context = $this->getContext();
+               $controller = $context->getController();
+               $request =  $context->getRequest();
+               $user = $context->getUser();
+               $this->setScreenId("0001");
+               $this->setTemplate('AnswerSchedule.tpl.php');
+
+               $current_module = 'Community';
+               $current_action = 'AnswerSchedule';
+
+               // ¥í¥°¥¤¥ó¥æ¡¼¥¶¾ðÊó
+               $acs_user_info_row = $request->getAttribute('acs_user_info_row');
+               $this->setAttribute('acs_user_info_row', $acs_user_info_row);
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£¾ðÊó
+               $target_community_row =& $request->getAttribute('target_community_row');
+               $this->setAttribute('target_community_row', $target_community_row);
+
+               // ¥¹¥±¥¸¥å¡¼¥ë¥¤¥ó¥¹¥¿¥ó¥¹¤ÎÀßÄê
+               $schedule =& $request->getAttribute('schedule');
+               $this->setAttribute('schedule', $schedule);
+
+               // ¶¦ÄÌURL¥Ñ¥é¥á¡¼¥¿
+               $url_params = "community_id=" . $target_community_row['community_id'];
+
+               // ÆþÎϽªÎ»»þPOST-URL
+               $this->setAttribute('url_commit',
+                               $this->getControllerPath($current_module, $current_action));
+
+               // ·èÄê»þPOST-URL
+               $this->setAttribute('url_decide',
+                               $this->getControllerPath($current_module, 'DecideSchedule'));
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£¤ÎURL
+               $this->setAttribute('url_community_top',
+                               $this->getControllerPath($current_module, 'Index') .
+                               "&" . $url_params);
+
+               // ¥¹¥±¥¸¥å¡¼¥ëÄ´À°É½°ìÍ÷¤ÎURL
+               $this->setAttribute('url_schedule_list',
+                               $this->getControllerPath($current_module, 'Schedule') . 
+                               "&" . $url_params);
+
+               // ¼çºÅ¼Ô
+               // ¥³¥ß¥å¥Ë¥Æ¥£¾ðÊó¤Î¼èÆÀ
+               $user_community_row =& ACSUser::get_user_profile_row($schedule->user_community_id);
+               $this->setAttribute('user_community_name', $user_community_row['community_name']);
+               $this->setAttribute('user_community_name_url', 
+                               $this->getControllerPath(DEFAULT_MODULE, DEFAULT_ACTION) . 
+                               '&id='.$schedule->user_community_id);
+
+               // ²óÅú°ìÍ÷
+               $answer_selection =& $schedule->get_answer_selection();
+               $html_options_answer_selection = array();
+               $answer_detail_text = "";
+               foreach ($answer_selection as $key => $val) {
+                       if ($val['answer_char'] != ""){
+                               $html_options_answer_selection[$key] = $val['answer_char'];
+                               if ($answer_detail_text != ""){
+                                       $answer_detail_text .= "<br>";
+                               }
+                               $answer_detail_text .= 
+                                               htmlspecialchars($val['answer_char']) . "..." .
+                                               ACSMsg::get_msg('Community', 'AnswerScheduleSuccessView.class.php', 'M001') . ":" . 
+                                                       htmlspecialchars($val['answer_score']);
+                               if ($val['answer_detail']) {
+                                       $answer_detail_text .= " " .
+                                                       ACSMsg::get_msg('Community', 'AnswerScheduleSuccessView.class.php', 'M002') . ":" . 
+                                                       htmlspecialchars($val['answer_detail']);
+                               }
+                       }
+               }
+
+               $this->setAttribute('html_options_answer_selection', $html_options_answer_selection);
+               $this->setAttribute('answer_detail_text', $answer_detail_text);
+
+               // ¥¹¥±¥¸¥å¡¼¥ë¸õÊäÆü»þ
+               $this->setAttribute('adjustment_dates_count', 
+                               $schedule->get_adjustment_dates_count());
+               $adjustment_dates_list =& $schedule->get_adjustment_dates();
+               $this->setAttribute('adjustment_dates_list', $adjustment_dates_list);
+               
+               // ¾õÂÖ
+               if($schedule->is_fixed()){
+                       $schedule_status = ACSMsg::get_msg('Community', 'AnswerScheduleSuccessView.class.php', 'M003') . 
+                                       "&nbsp;&nbsp;·èÄêÆü:" . 
+                                       $adjustment_dates_list[$schedule->decide_adjustment_date_id]['date_string'] ;
+               }else{
+                       $schedule_status = $schedule->is_close() ? ACSMsg::get_msg('Community', 'AnswerScheduleSuccessView.class.php', 'M004') : 
+                                                               ACSMsg::get_msg('Community', 'AnswerScheduleSuccessView.class.php', 'M005');
+               }
+               $this->setAttribute('schedule_status', $schedule_status);
+
+               // ¥¹¥±¥¸¥å¡¼¥ë»²²Ã¾ðÊó
+               $schedule_participant_list =& $request->getAttribute('schedule_participant_list');
+               $this->setAttribute('schedule_participant', 
+                               $request->getAttribute('schedule_participant'));
+               $this->setAttribute('schedule_participant_list', $schedule_participant_list);
+
+               // ½¸·×¾ðÊó
+               $total_count = array();
+               $total_score = array();
+               foreach ($adjustment_dates_list as $adjustment_date_id => $adjustment_date_array) {
+                       foreach ($schedule_participant_list as 
+                                       $user_community_id => $schedule_participant) {
+                               $answer_no = $schedule_participant->get_answer($adjustment_date_id);
+                               $total_count[$adjustment_date_id][$answer_no]++;
+                               $total_score[$adjustment_date_id] += 
+                                               $answer_selection[$answer_no]['answer_score'];
+                       }
+               }
+               $this->setAttribute('total_count',$total_count);
+               $this->setAttribute('total_score',$total_score);
+
+               return parent::execute();
+       }
+}
+?>