Ejemplo n.º 1
0
 public function getVote($da, $user, $conv_root_id, $FILE_WEBSERVER_URL)
 {
     $re = array();
     $pre = $this->get('templating.helper.assets')->geturl('bundles/fafatimewebase/images/face/');
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $ds = $conv->getVote($da, $user, $conv_root_id, $FILE_WEBSERVER_URL);
     $re = array();
     if ($ds && $ds["we_convers_list"]["recordcount"] > 0) {
         $rowRoot = $ds["we_convers_list"]["rows"][0];
         $re["conv_id"] = $rowRoot["conv_root_id"];
         $re["create_staff"] = $rowRoot["login_account"];
         $re["create_staff_obj"] = $this->genStaff($rowRoot);
         $re["post_date"] = $rowRoot["post_date"];
         $re["conv_type_id"] = $rowRoot["conv_type_id"];
         $re["conv_content"] = $conv->replaceContent($rowRoot["conv_content"], $pre);
         $re["copy_num"] = $rowRoot["copy_num"];
         $re["reply_num"] = $rowRoot["reply_num"];
         $re["atten_num"] = $rowRoot["atten_num"];
         $re["like_num"] = (double) $rowRoot["like_num"];
         $re["iscollect"] = empty($rowRoot["atten_id"]) ? "0" : "1";
         $re["comefrom"] = $rowRoot["comefrom_d"];
         $re["likes"] = $this->genLikes($ds["we_convers_like"]["rows"], $conv_root_id);
         $re["attachs"] = $this->genAttachs($ds["we_convers_attach"]["rows"]);
         $re["replys"] = $this->genReplys($conv, $pre, $ds["we_convers_list"]["rows"], $ds["we_convers_like"]["rows"], $ds["we_convers_attach_reply"]["rows"]);
         $re["post_to_group"] = $rowRoot["post_to_group"];
         $vote_row = $ds["we_vote"]["rows"][0];
         $vote = array();
         $vote["title"] = $vote_row["title"];
         $vote["vote_all_num"] = $vote_row["vote_all_num"];
         $vote["is_multi"] = $vote_row["is_multi"];
         $vote["finishdate"] = $vote_row["finishdate"];
         $vote_options = array();
         foreach ($ds["we_vote_option"]["rows"] as &$row) {
             $vote_option = array();
             $vote_option["option_id"] = $row["option_id"];
             $vote_option["option_desc"] = $row["option_desc"];
             $vote_option["vote_num"] = $row["vote_num"];
             $vote_options[] = $vote_option;
         }
         $vote["vote_options"] = $vote_options;
         $vote["isvoted"] = $ds["we_vote_user"]["rows"][0]["c"] == 0 ? "0" : "1";
         $vote["vote_user_num"] = $vote_row["vote_user_num"];
         $re["vote"] = $vote;
     }
     return $re;
 }
Ejemplo n.º 2
0
 public function getVoteWinAction($conv_root_id)
 {
     $FILE_WEBSERVER_URL = $this->container->getParameter('FILE_WEBSERVER_URL');
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get('we_data_access');
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $ds = $conv->getVote($da, $user, $conv_root_id, $FILE_WEBSERVER_URL);
     if (count($ds["we_convers_list"]["rows"]) == 0 || count($ds["we_vote"]["rows"]) == 0 || count($ds["we_vote_option"]["rows"]) == 0) {
         return new Response("");
     }
     if ($ds["we_convers_list"]["rows"][0]["auth_level"] != 'S') {
         $ds["we_convers_list"]["rows"][0]["vip_level"] = \Justsy\BaseBundle\Common\ExperienceLevel::getLevel($ds["we_convers_list"]["rows"][0]["total_point"]);
     } else {
         $ds["we_convers_list"]["rows"][0]["vip_level"] = "1";
         //
     }
     $css_level = (int) ($ds["we_convers_list"]["rows"][0]["we_level"] / 10);
     $para = array('this' => $this, 'ds' => $ds, 'css_level' => $css_level, "trend" => $this->getRequest()->get("trend"));
     return $this->render('JustsyBaseBundle:CDisplayArea:vote_win.html.twig', $para);
 }