public function executeInput(sfWebRequest $request)
 {
     $memberId = $this->getUser()->getMemberId();
     if (!count(opCommunityIntroductionPlugin::getNotJoinCommunityFriendMemberIds($this->community->getId(), $memberId))) {
         return sfView::ERROR;
     }
     $this->form = $this->getForm();
 }
 protected function setWidgetOfFriendsMember()
 {
     $id = sfContext::getInstance()->getUser()->getMember()->getId();
     $memberList = opCommunityIntroductionPlugin::getNotJoinCommunityFriendMembers($this->community->getId(), $id);
     $memberNames = array();
     foreach ($memberList as $member) {
         $memberNames[$member->getId()] = $member->getName();
     }
     $this->setWidget('member_id_list', new sfWidgetFormSelectCheckbox(array('choices' => $memberNames, 'class' => 'memberCheckList')));
     $this->setValidator('member_id_list', new sfValidatorChoice(array('choices' => array_keys($memberNames), 'multiple' => true)));
 }
 protected function setWidgetOfFriendsMember()
 {
     $size = sfConfig::get('app_community_introduction_mobile_choice_friend_size', 5);
     $id = sfContext::getInstance()->getUser()->getMember()->getId();
     $memberList = opCommunityIntroductionPlugin::getNotJoinCommunityFriendMembers($this->community->getId(), $id, $size, true);
     $memberNames = array();
     $allMemberIds = array();
     foreach ($memberList as $member) {
         $memberNames[$member->getId()] = $member->getName();
     }
     $this->setWidget('member_id_list', new sfWidgetFormChoice(array('choices' => $memberNames)));
     $this->setValidator('member_id_list', new sfValidatorChoice(array('choices' => array_keys($memberNames))));
 }
 public function listenToPostActionEventCommunityJoin($arguments)
 {
     $memberId = sfContext::getInstance()->getUser()->getMemberId();
     $communityId = $arguments['actionInstance']->getVar('id');
     $communityMember = Doctrine::getTable('CommunityMember')->retrieveByMemberIdAndCommunityId($memberId, $communityId);
     if (!$communityMember) {
         $communityMember = new CommunityMember();
         $communityMember->setCommunityId($communityId);
         $communityMember->setMemberId($memberId);
         $communityMember->setIsPre(true);
     }
     if ($communityMember->getIsPre()) {
         $isInvited = opCommunityIntroductionPlugin::isInvitedCommunity($communityId, $memberId);
         if ($isInvited) {
             $communityMember->setIsPre(false);
             $communityMember->save();
             sfContext::getInstance()->getUser()->setFlash('notice', 'You have just joined to this %community%.');
             sfContext::getInstance()->getController()->redirect('community/home?id=' . $communityId);
         }
     }
 }
 public function executeMenu(sfWebRequest $requests)
 {
     $this->communityId = $requests->getParameter('id');
     $memberId = $this->getUser()->getMemberId();
     $this->countFriends = count(opCommunityIntroductionPlugin::getNotJoinCommunityFriendMemberIds($this->communityId, $memberId));
 }