public function executePostExperience(sfWebRequest $request) { $tmpRequest = $_REQUEST; $ratee = $tmpRequest['ratee']; $posting_id = $tmpRequest['posting_id']; unset($tmpRequest['ratee']); unset($tmpRequest['posting_id']); unset($tmpRequest['submit']); $questions = Questions::getSurveyQuestions(); $arr_questions = array(); foreach ($questions as $val) { $arr_questions[$val->getId()] = array('questions' => $val->getQuestions(), 'answer_type' => $val->getAnswerType(), 'is_average' => $val->getIsAverage()); } $surveyComments = array(); foreach ($tmpRequest as $index => $v) { $replace_string = str_replace("question_", "", $index); $id = $replace_string; $answer_type = $arr_questions[$id]['answer_type']; $value = 0; switch ($answer_type) { case 1: $value = $v * 20; // per star is eq 20% break; case 2: $value = $v == 1 ? 100 : 0; // yes = 100 and no = 0 break; case 3: $value = addslashes($v); if ($id == 5) { $surveyComments['comments'] = addslashes($v); } break; } //insert to survey result table. $Data = array(); $Data['participant_id'] = $_SESSION['userId']; $Data['ratee'] = $ratee; $Data['result'] = $value; $Data['question_id'] = $id; $Data['posting_id'] = $posting_id; $RatersGroupId = SurveyResults::saveResults($Data); } if ($RatersGroupId !== FALSE) { $surveyComments['member_id'] = $_SESSION['userId']; $surveyComments['rater_group_id'] = $RatersGroupId; SurveyComments::saveComments($surveyComments); } $member = new Member(); $member->setId($ratee); $to = $member->getMemberInfo('nick_name'); $recipient = $member->getMemberInfo('email'); $member->setId($_SESSION['userId']); $from = $member->getMemberInfo('nick_name'); $body = '<div style="font-family:tahoma;font-size:12px;"> Hi <b>' . $to . '</b>, <br/> <p> <b> ' . $from . ' </b> has rated your recent HangOut Today Experience. Log in now and leave your response. </p> <blockqoute> <div> Go to your Account and Click <b>Rate HangOut</b> By not leaving a response from <b> ' . $from . ' </b> from your HangOut together, you will not be able to create or reply to any new posts. <br/><br/> Log in Now or click the following link <a href="http://hangout.com">HangOutToday.com</a> </div> </blockqoute> <br/> </div>'; Requester::updateRequesterSurveyStatus($ratee, $posting_id, $_SESSION['userId']); CustomHangout::email($recipient, $body, 'HangOutToday', 'HangOutToday Notification'); $this->redirect("/index.php/home/surveyDone"); }