Ejemplo n.º 1
0
 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the  
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  *
  * @param
  * @return void
  * @access public
  */
 function run()
 {
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse');
     if ($action & CRM_Core_Action::REVERT) {
         $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false);
         CRM_Contribute_BAO_PCP::setIsActive($id, 0);
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
     } elseif ($action & CRM_Core_Action::RENEW) {
         $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false);
         CRM_Contribute_BAO_PCP::setIsActive($id, 1);
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
     } elseif ($action & CRM_Core_Action::DELETE) {
         $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false);
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
         $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_PCP_PCP', 'Personal Campaign Page', CRM_Core_Action::DELETE);
         //$this->setContext( $id, $action );
         $controller->set('id', $id);
         $controller->process();
         return $controller->run();
     }
     // finally browse
     $this->browse();
     // parent run
     parent::run();
 }