function sendsummaryAction() { if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { return $this->redirect()->toUrl('/'); } $session = new Container('user'); $username = $session->username; $uid = $session->userid; $questionList = $session->questionList; // get All answer list $apimanager = new RESTJSONManager(); $url = Constants::PLAN_GET_ANSWERED_QUESTIONS; $url = str_replace('<UID>', $uid, $url); $result = $apimanager->PlanJSONManager('GET', $url, null, $uid); $allAnswer = json_decode($result->getBody(), true); $bodyMsg = "<table border=1>"; foreach ($allAnswer['userChoices'] as $row) { $bodyMsg .= "<tr>"; $bodyMsg .= "<td>Question</td>"; $context = $row['contextId']; $question = $row['excerptId']; $userAns = $row['userAnswer']; $bodyMsg .= "<td>" . $questionList[$context][$question]['excerpt'] . "</td>"; $bodyMsg .= "</tr>"; $bodyMsg .= "<tr><td>User Answer </td>"; $bodyMsg .= "<td>" . $userAns . "</td></tr>"; $bodyMsg .= "<tr><td>Correct Answer</td>"; $bodyMsg .= "<td>" . $questionList[$context][$question]['correctAnswer'] . "</td></tr>"; $bodyMsg .= "<tr><td>Correct Answer Description </td>"; $desc = str_replace("The answer you chose is CORRECT!", '', $questionList[$context][$question]['correctAnswerDescription']); $bodyMsg .= "<td>" . $desc . "</td></tr>"; } $bodyMsg .= "</table>"; //echo $bodyMsg; $mail = new EmailManager(); $mail->sendPersonalStatement($username, $username, $bodyMsg); $view = new JsonModel(array('flag' => true)); return $view; }
public function signupserviceAction() { $session = new Container('user'); $username = $session->username; $userid = $session->userid; $authusername = $session->username; $network = $session->network; $profilepic = $session->profilepic; $username = $this->params()->fromPost('username'); $password = $this->params()->fromPost('password'); $repassword = $this->params()->fromPost('repassword'); $agecertify = $this->params()->fromPost('agecertify'); if ($network != '') { if ($authusername != $username) { $result = new JsonModel(array('error' => "Authentication email is not maching")); return $result; } } if (filter_var($username, FILTER_VALIDATE_EMAIL) === false) { $result = new JsonModel(array('error' => "Please enter the valid email address.")); return $result; } if ($password != $repassword && $password != "") { $result = new JsonModel(array('error' => "Password is not matching.")); return $result; } if ($agecertify == null || $agecertify == '') { $result = new JsonModel(array('error' => "Please certify that your age atleast 13 and above.")); return $result; } if (!$this->getUserTable()->checkEmailAvailable($username)) { $key = md5(date('Y-m-d hh:mm:ss')); $session = new Container('global'); $regchannel = $session->channel; if ($network != '') { $userid = $this->getUserTable()->insertStudent($username, $password, $key, Constants::ROLE_STUDENT, $regchannel, $profilepic, 1); } else { $userid = $this->getUserTable()->insertStudent($username, $password, $key, Constants::ROLE_STUDENT, $regchannel, $profilepic, 0); } $this->getPlanTable()->insertUID($userid); if ($network != '') { $result = new JsonModel(array('success' => "You have successfully registered.")); return $result; } else { $mail = new EmailManager(); $mail->sendMail($username, $username, $key); $result = new JsonModel(array('success' => "You have successfully registered. Please check your Inbox for activation e-mail. Check the spam folder in case you don't see our email in your Inbox.")); return $result; } } else { $result = new JsonModel(array('error' => "This email ID already exists. Please enter a different one.")); return $result; } //} }