public function indexpcAction($network_domain, $name)
 {
     $user = $this->get('security.context')->getToken()->getUser();
     $FILE_WEBSERVER_URL = $this->container->getParameter('FILE_WEBSERVER_URL');
     $curr_circle_id = $user->get_circle_id($network_domain);
     $sqls = array();
     $params = array();
     //取出当前圈子中该用户参与的群组
     $sql1 = "select a.group_id, a.group_name, a.group_photo_path, concat('{$FILE_WEBSERVER_URL}', ifnull(a.group_photo_path, '')) group_photo_url\nfrom we_groups a, we_group_staff b \nwhere a.group_id=b.group_id\n  and b.login_account=?\n  and a.circle_id=?";
     $params1 = array();
     $params1[] = (string) $user->getUserName();
     $params1[] = (string) $curr_circle_id;
     $sqls[] = $sql1;
     $params[] = $params1;
     //当用户数小于100时,取出当前圈子中所有用户
     $sql1 = "select a.login_account, ifnull(a.nick_name, a.login_account) nick_name\nfrom we_staff a, we_circle_staff b\nwhere a.login_account=b.login_account\n  and b.circle_id=?";
     $params1 = array();
     $params1[] = (string) $curr_circle_id;
     $sqls[] = $sql1;
     $params[] = $params1;
     $da = $this->get('we_data_access');
     $da->PageSize = 100;
     $da->PageIndex = 0;
     $ds = $da->GetDatas(array("we_groups", "we_staff"), $sqls, $params);
     $this->groups_array = $ds["we_groups"]["rows"];
     $this->groups = json_encode($ds["we_groups"]["rows"]);
     $this->staffs = json_encode($ds["we_staff"]["recordcount"] > count($ds["we_staff"]["rows"]) ? array() : $ds["we_staff"]["rows"]);
     if ($name == "foo") {
         return $this->render('JustsyBaseBundle:CInputArea:index_pc.html.twig', array('this' => $this, 'ismanager' => $user->is_in_manager_circles($network_domain), 'network_domain' => $network_domain));
     } elseif ($name == "group") {
         $g_id = $this->get("request")->get('groupid');
         $groupObj = new \Justsy\BaseBundle\Controller\GroupController();
         $groupObj->setContainer($this->container);
         $isManager = $groupObj->isManager($g_id, $user->getUserName());
         return $this->render('JustsyBaseBundle:CInputArea:groupInputArea_pc.html.twig', array('this' => $this, 'ismanager' => $isManager, 'network_domain' => $network_domain, 'groupid' => $g_id));
     } elseif ($name == "notice") {
         return $this->render('JustsyBaseBundle:Notice:pushNotice.html.twig', array('this' => $this, 'network_domain' => $network_domain));
     }
 }
Beispiel #2
0
 public function exitgroupAction()
 {
     $re = array("returncode" => ReturnCode::$SUCCESS);
     $user = $this->get('security.context')->getToken()->getUser();
     $request = $this->getRequest();
     $group_id = $request->get("group_id");
     $circle_id = $request->get("circle_id");
     $da = $this->get('we_data_access');
     try {
         if (empty($group_id)) {
             $re["returncode"] = ReturnCode::$SYSERROR;
             $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
             $response->headers->set('Content-Type', 'text/json');
             return $response;
         }
         $this->get("logger")->err("---------quit group --------------" . $group_id);
         $this->get("logger")->err("---------quit group --------------" . $user->getUserName());
         $sql = "select fafa_groupid,group_name from we_groups where group_id=? or fafa_groupid=? ";
         $ds = $da->GetData('we_groups', $sql, array((string) $group_id, (string) $group_id));
         $fafa_groupid = $ds['we_groups']['rows'][0]['fafa_groupid'];
         $group_name = $ds['we_groups']['rows'][0]['group_name'];
         $sql = "call p_quitgroup(?, ?, 0)";
         $params = array();
         $params[] = (string) $group_id;
         $params[] = (string) $user->getUserName();
         $ds = $da->GetData("p_quitgroup", $sql, $params);
         //变更版本信息
         $this->get("logger")->err("---------quit group --------------");
         $eno = $user->eno;
         $verchange = new \Justsy\BaseBundle\Management\VersionChange($da, $this->get("logger"));
         $result = $verchange->SetVersionChange(2, $group_id, $eno);
         if ($ds["p_quitgroup"]["rows"][0]["recode"] == "0") {
             $send = new \Justsy\BaseBundle\Controller\GroupController();
             $send->setContainer($this->container);
             //向客户端发送即时通知
             $message = Utils::makeHTMLElementTag('employee', $user->fafa_jid, $user->nick_name) . "退出了群组【" . Utils::makeHTMLElementTag('group', $fafa_groupid, $group_name) . "】";
             $send->sendPresenceGroup($fafa_groupid, "group_deletemeber", $message);
         } else {
             $re["returncode"] = ReturnCode::$SYSERROR;
             $this->get('logger')->err("quitGroup Error group_id:" . $group_id . " msg:" . $ds["p_quitgroup"]["rows"][0]["remsg"]);
         }
     } 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;
 }