Exemplo n.º 1
0
 function setContext()
 {
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
     $session = CRM_Core_Session::singleton();
     $qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
     //validate the qfKey
     if (!CRM_Utils_Rule::qfKey($qfKey)) {
         $qfKey = NULL;
     }
     switch ($context) {
         case 'search':
             $urlParams = 'force=1';
             if ($qfKey) {
                 $urlParams .= "&qfKey={$qfKey}";
             }
             $this->assign('searchKey', $qfKey);
             $url = CRM_Utils_System::url('civicrm/grant/search', $urlParams);
             break;
         case 'dashboard':
             $url = CRM_Utils_System::url('civicrm/grant', 'reset=1');
             break;
         case 'edit':
             $url = CRM_utils_System::url('civicrm/contact/view/grant', 'reset=1&id=' . $this->_id . '&cid=' . $this->_contactId . '&action=view&context=grant&selectedChild=grant');
             break;
         case 'grant':
             $url = CRM_Utils_System::url('civicrm/contact/view', 'action=browse&selectedChild=grant&cid=' . $this->_contactId);
             break;
         case 'standalone':
             $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
             break;
         default:
             $cid = NULL;
             if ($this->_contactId) {
                 $cid = '&cid=' . $this->_contactId;
             }
             $url = CRM_Utils_System::url('civicrm/grant/search', 'reset=1&force=1' . $cid);
             break;
     }
     $session->pushUserContext($url);
     if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
         CRM_Grant_BAO_Grant::del($this->_id);
         CRM_Utils_System::redirect($url);
     }
 }
Exemplo n.º 2
0
 function setContext()
 {
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
     $session =& CRM_Core_Session::singleton();
     switch ($context) {
         case 'search':
             $url = CRM_Utils_System::url('civicrm/grant/search', 'force=1');
             break;
         case 'dashboard':
             $url = CRM_Utils_System::url('civicrm/grant', 'reset=1');
             break;
         case 'edit':
             $url = CRM_utils_System::url('civicrm/contact/view/grant', 'reset=1&id=' . $this->_id . '&cid=' . $this->_contactId . '&action=view&context=grant&selectedChild=grant');
             break;
         case 'grant':
             $url = CRM_Utils_System::url('civicrm/contact/view', 'action=browse&selectedChild=grant&cid=' . $this->_contactId);
             break;
         case 'standalone':
             $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
             break;
         default:
             $cid = null;
             if ($this->_contactId) {
                 $cid = '&cid=' . $this->_contactId;
             }
             $url = CRM_Utils_System::url('civicrm/grant/search', 'reset=1&force=1' . $cid);
             break;
     }
     $session->pushUserContext($url);
     if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
         require_once 'CRM/Grant/BAO/Grant.php';
         CRM_Grant_BAO_Grant::del($this->_id);
         CRM_Utils_System::redirect($url);
     }
 }