/**
  * Executes delete action
  *
  * @param sfRequest $request A redirect object
  */
 public function executeDelete($request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($this->communityEventComment->isDeletable($this->getUser()->getMemberId()));
     $this->communityEventComment->delete();
     $this->getUser()->setFlash('notice', 'The comment was deleted successfully.');
     $this->redirect('@communityEvent_show?id=' . $this->communityEvent->getId());
 }
 /**
  * Executes delete action
  *
  * @param sfRequest $request A request object
  */
  public function executeDelete($request)
  {
    switch ($request->getParameter('target'))
    {
    case 'friend':
      $fromId = $this->id;
      $toId = $this->getUser()->getMemberId();
      break;
    case 'my':
    default:
      $fromId = $this->getUser()->getMemberId();
      $toId = $this->id;
      break;
    }
    $this->introFriend = Doctrine::getTable('IntroFriend')->getByFromAndTo($fromId, $toId);
    $this->forward404Unless($this->introFriend);

    // return uri
    switch ($request->getParameter('from'))
    {
    case 'list':
      $this->uri = $this->getController()->genUrl('@obj_introfriend?id='.$toId);
      break;
    case 'manage':
    default:
      $this->uri = $this->getController()->genUrl('@friend_manage');
    }

    // delete
    if ($request->isMethod('post'))
    {
      $request->checkCSRFProtection();
      $this->introFriend->delete();
      $this->getUser()->setFlash('notice', 'The introductory essay was deleted.');
      $this->redirect($this->uri);
    }
  }
 /**
  * Executes delete action
  *
  * @param sfRequest $request A request object
  */
 public function executeDelete($request)
 {
     $request->checkCSRFProtection();
     $this->communityTopic->delete();
     $this->getUser()->setFlash('notice', 'The %community% topic was deleted successfully.');
     $this->redirect('community/home?id=' . $this->community->getId());
 }
 /**
  * Executes dropMember action
  *
  * @param sfRequest $request A request object
  */
 public function executeDropMember($request)
 {
     $this->redirectUnless($this->isAdmin || $this->isSubAdmin, '@error');
     $member = Doctrine::getTable('Member')->find($request->getParameter('member_id'));
     $this->forward404Unless($member);
     $isCommunityMember = Doctrine::getTable('CommunityMember')->isMember($member->getId(), $this->id);
     $this->redirectUnless($isCommunityMember, '@error');
     $isAdmin = Doctrine::getTable('CommunityMember')->isAdmin($member->getId(), $this->id);
     $isSubAdmin = Doctrine::getTable('CommunityMember')->isSubAdmin($member->getId(), $this->id);
     $this->redirectIf($isAdmin || $isSubAdmin, '@error');
     if ($request->isMethod(sfWebRequest::POST)) {
         $request->checkCSRFProtection();
         Doctrine::getTable('CommunityMember')->quit($member->getId(), $this->id);
         $this->redirect('@community_memberManage?id=' . $this->id);
     }
     $this->member = $member;
     $this->community = Doctrine::getTable('Community')->find($this->id);
     return sfView::INPUT;
 }
Ejemplo n.º 5
0
 /**
  * Executes sortProfileOption action
  *
  * @param sfRequest $request A request object
  */
 public function executeSortProfileOption($request)
 {
     if ($request->isXmlHttpRequest()) {
         $request->checkCSRFProtection();
         $parameters = $request->getParameterHolder();
         $keys = $parameters->getNames();
         foreach ($keys as $key) {
             if (preg_match('/^profile_options_\\d+$/', $key, $match)) {
                 $order = $parameters->get($match[0]);
                 for ($i = 0; $i < count($order); $i++) {
                     $profileOption = Doctrine::getTable('ProfileOption')->find($order[$i]);
                     if ($profileOption) {
                         $profileOption->setSortOrder($i * 10);
                         $profileOption->save();
                     }
                 }
                 break;
             }
         }
     }
     return sfView::NONE;
 }
Ejemplo n.º 6
0
 /**
  * Executes unlink action
  *
  * @param sfRequest $request A request object
  */
 public function executeUnlink($request)
 {
     $this->redirectToHomeIfIdIsNotValid();
     if (!$this->relation->isFriend()) {
         $this->getUser()->setFlash('error', 'This member is not your %friend%.');
         $this->redirect('friend/manage');
     }
     if ($request->isMethod(sfWebRequest::POST)) {
         $request->checkCSRFProtection();
         $this->relation->removeFriend();
         $this->redirect('friend/manage');
     }
     $this->member = Doctrine::getTable('Member')->find($this->id);
     return sfView::INPUT;
 }