public function publishVoteAction() { $request = $this->getRequest(); $user = $this->get('security.context')->getToken()->getUser(); $da = $this->get('we_data_access'); $network_domain = $request->get('network_domain'); $conv_content = $request->get('title'); $is_multi = $request->get('is_multi'); $optionvalues = $request->get('optionvalues'); $notifystaff = $request->get('notifystaff'); $attachs = $request->get('attachs'); $post_to_group = $request->get('post_to_group'); $finishdate = $request->get('finishdate'); $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id"); $conv = new \Justsy\BaseBundle\Business\Conv(); $conv->newVote($da, $user, $conv_id, $conv_content, $is_multi, $finishdate, $optionvalues, $user->get_circle_id($network_domain), $post_to_group, $notifystaff, $attachs, "00", $this->container); $this->sendPresence($conv_id, $da, $user->get_circle_id($network_domain), $post_to_group, "vote"); $re = array('success' => '1', 'conv_id' => $conv_id); $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }
public function newConvVoteAction() { $re = array("returncode" => ReturnCode::$SUCCESS); $request = $this->getRequest(); $user = $this->get('security.context')->getToken()->getUser(); $da = $this->get('we_data_access'); $conv_content = $request->get("conv_content"); $is_multi = $request->get("is_multi"); $finishdate = $request->get("finishdate"); $optionvalues = $request->get("optionvalues"); $attachs = $request->get("attachs"); $circle_id = $request->get("circle_id"); $group_id = $request->get("group_id"); $notifystaffs = $request->get("notifystaffs"); try { if (empty($conv_content) || empty($circle_id) || empty($group_id) || empty($optionvalues)) { throw new \Exception("param is null"); } $attachs = array_map(function ($item) { return trim($item); }, empty($attachs) ? array() : explode(',', $attachs)); $notifystaffs = array_map(function ($item) { return trim($item); }, empty($notifystaffs) ? array() : explode(',', $notifystaffs)); $optionvalues = array_map(function ($item) { return trim($item); }, empty($optionvalues) ? array() : explode(',', $optionvalues)); $is_multi = $is_multi == "1" ? "1" : "0"; $conv_id = \Justsy\BaseBundle\DataAccess\SysSeq::GetSeqNextValue($da, "we_convers_list", "conv_id"); $conv = new \Justsy\BaseBundle\Business\Conv(); $conv->newVote($da, $user, $conv_id, $conv_content, $is_multi, $finishdate, $optionvalues, $circle_id, $group_id, $notifystaffs, $attachs, $request->getSession()->get('comefrom'), $this->container); $cInput = new CInputAreaController(); $cInput->setContainer($this->container); $cInput->sendPresence($conv_id, $da, $circle_id, $group_id, "vote"); $re["conv"] = $this->getVote($da, $user, $conv_id, ""); } catch (\Exception $e) { $re["returncode"] = ReturnCode::$SYSERROR; $this->get('logger')->err($e); } $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }