Example #1
0
 public function getReplyAction()
 {
     $re = array("returncode" => ReturnCode::$SUCCESS);
     $request = $this->getRequest();
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get('we_data_access');
     $conv_id = $request->get("conv_id");
     $pageindex = $request->get("pageindex");
     $pagesize = 15;
     $pre = $this->get('templating.helper.assets')->geturl('bundles/fafatimewebase/images/face/');
     try {
         if (empty($pageindex)) {
             $pageindex = 1;
         }
         $conv = new \Justsy\BaseBundle\Business\Conv();
         $ds = $conv->getReply($da, $user, $conv_id, "", $pageindex, $pagesize);
         $we_convers_lists = array_merge(array(0), $ds["we_convers_list"]["rows"]);
         $re["replys"] = $this->genReplys($conv, $pre, $we_convers_lists, $ds["we_convers_like"]["rows"], $ds["we_convers_attach_reply"]["rows"]);
     } 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;
 }
 public function getReplyAction()
 {
     $FILE_WEBSERVER_URL = $this->container->getParameter('FILE_WEBSERVER_URL');
     $user = $this->get('security.context')->getToken()->getUser();
     $request = $this->getRequest();
     $conv_root_id = $request->get("conv_root_id");
     $pagesize = 50;
     $pageindex = $request->get("pageindex");
     if (empty($pageindex)) {
         $pageindex = 1;
     }
     $da = $this->get('we_data_access');
     $conv = new \Justsy\BaseBundle\Business\Conv();
     $ds = $conv->getReply($da, $user, $conv_root_id, $FILE_WEBSERVER_URL, $pageindex, $pagesize);
     $pagecount = ceil($ds["we_convers_list"]["recordcount"] / $pagesize);
     return $this->render('JustsyBaseBundle:CDisplayArea:reply_pagelist.html.twig', array('trend' => $request->get("trend"), 'this' => $this, 'ds' => $ds, 'pageindex' => $pageindex, 'pagecount' => $pagecount));
 }