コード例 #1
0
ファイル: Rule.php プロジェクト: archcidburnziso/civicrm-core
 static function qfKey($key)
 {
     return $key ? CRM_Core_Key::valid($key) : FALSE;
 }
コード例 #2
0
ファイル: Tab.php プロジェクト: archcidburnziso/civicrm-core
 function setContext()
 {
     $qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
     $context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
     $compContext = CRM_Utils_Request::retrieve('compContext', 'String', $this);
     //swap the context.
     if ($context == 'search' && $compContext) {
         $context = $compContext;
     } else {
         $compContext = NULL;
     }
     // make sure we dont get tricked with a bad key
     // so check format
     if (!CRM_Core_Key::valid($qfKey)) {
         $qfKey = NULL;
     }
     $session = CRM_Core_Session::singleton();
     switch ($context) {
         case 'user':
             $url = CRM_Utils_System::url('civicrm/user', 'reset=1');
             break;
         case 'dashboard':
             $url = CRM_Utils_System::url('civicrm/contribute', 'reset=1');
             break;
         case 'pledgeDashboard':
             $url = CRM_Utils_System::url('civicrm/pledge', 'reset=1');
             break;
         case 'contribution':
             $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactId}&selectedChild=contribute");
             break;
         case 'search':
         case 'advanced':
             $extraParams = "force=1";
             if ($qfKey) {
                 $extraParams .= "&qfKey={$qfKey}";
             }
             $this->assign('searchKey', $qfKey);
             if ($context == 'advanced') {
                 $url = CRM_Utils_System::url('civicrm/contact/search/advanced', $extraParams);
             } else {
                 $url = CRM_Utils_System::url('civicrm/contribute/search', $extraParams);
             }
             break;
         case 'home':
             $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
             break;
         case 'activity':
             $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactId}&selectedChild=activity");
             break;
         case 'member':
         case 'membership':
             $componentId = CRM_Utils_Request::retrieve('compId', 'Positive', $this);
             $componentAction = CRM_Utils_Request::retrieve('compAction', 'Integer', $this);
             $context = 'membership';
             $searchKey = NULL;
             if ($compContext) {
                 $context = 'search';
                 if ($qfKey) {
                     $searchKey = "&key={$qfKey}";
                 }
                 $compContext = "&compContext={$compContext}";
             }
             if ($componentAction & CRM_Core_Action::VIEW) {
                 $action = 'view';
             } else {
                 $action = 'update';
             }
             $url = CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action={$action}&id={$componentId}&cid={$this->_contactId}&context={$context}&selectedChild=member{$searchKey}{$compContext}");
             break;
         case 'participant':
             $componentId = CRM_Utils_Request::retrieve('compId', 'Positive', $this);
             $componentAction = CRM_Utils_Request::retrieve('compAction', 'Integer', $this);
             $context = 'participant';
             $searchKey = NULL;
             if ($compContext) {
                 $context = 'search';
                 if ($qfKey) {
                     $searchKey = "&key={$qfKey}";
                 }
                 $compContext = "&compContext={$compContext}";
             }
             if ($componentAction == CRM_Core_Action::VIEW) {
                 $action = 'view';
             } else {
                 $action = 'update';
             }
             $url = CRM_Utils_System::url('civicrm/contact/view/participant', "reset=1&action={$action}&id={$componentId}&cid={$this->_contactId}&context={$context}&selectedChild=event{$searchKey}{$compContext}");
             break;
         case 'pledge':
             $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactId}&selectedChild=pledge");
             break;
         case 'standalone':
             $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
             break;
         case 'fulltext':
             $keyName = '&qfKey';
             $urlParams = 'force=1';
             $urlString = 'civicrm/contact/search/custom';
             if ($this->_action == CRM_Core_Action::UPDATE) {
                 if ($this->_contactId) {
                     $urlParams .= '&cid=' . $this->_contactId;
                 }
                 $keyName = '&key';
                 $urlParams .= '&context=fulltext&action=view';
                 $urlString = 'civicrm/contact/view/contribution';
             }
             if ($qfKey) {
                 $urlParams .= "{$keyName}={$qfKey}";
             }
             $this->assign('searchKey', $qfKey);
             $url = CRM_Utils_System::url($urlString, $urlParams);
             break;
         default:
             $cid = NULL;
             if ($this->_contactId) {
                 $cid = '&cid=' . $this->_contactId;
             }
             $url = CRM_Utils_System::url('civicrm/contribute/search', 'reset=1&force=1' . $cid);
             break;
     }
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext($url);
 }
コード例 #3
0
ファイル: Rule.php プロジェクト: hampelm/Ginsberg-CiviDemo
 static function qfKey($key)
 {
     require_once 'CRM/Core/Key.php';
     return $key ? CRM_Core_Key::valid($key) : false;
 }