當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_PCP_BAO_PCP::setDisable方法代碼示例

本文整理匯總了PHP中CRM_PCP_BAO_PCP::setDisable方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_PCP_BAO_PCP::setDisable方法的具體用法?PHP CRM_PCP_BAO_PCP::setDisable怎麽用?PHP CRM_PCP_BAO_PCP::setDisable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_PCP_BAO_PCP的用法示例。


在下文中一共展示了CRM_PCP_BAO_PCP::setDisable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @param null
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         //check permission for action.
         if (!CRM_Core_Permission::checkActionPermission('CiviEvent', $this->_action)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
         }
         $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $this->_id, 'title');
         $this->assign('title', $this->_title);
         parent::preProcess();
     }
     if (!$this->_action) {
         $this->_action = CRM_Utils_Array::value('action', $_GET);
         $this->_id = CRM_Utils_Array::value('id', $_GET);
     } else {
         $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     }
     //give the context.
     if (!isset($this->_context)) {
         $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     }
     $this->assign('context', $this->_context);
     $session = CRM_Core_Session::singleton();
     $context = $session->popUserContext();
     $userID = $session->get('userID');
     //do not allow destructive actions without permissions
     $permission = FALSE;
     if (CRM_Core_Permission::check('administer CiviCRM') || $userID && CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $this->_id, 'contact_id') == $userID) {
         $permission = TRUE;
     }
     if ($permission && $this->_id) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $this->_id, 'title');
         switch ($this->_action) {
             case CRM_Core_Action::DELETE:
             case 'delete':
                 CRM_PCP_BAO_PCP::deleteById($this->_id);
                 CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $this->_title)), ts('Page Deleted'), 'success');
                 break;
             case CRM_Core_Action::DISABLE:
             case 'disable':
                 CRM_PCP_BAO_PCP::setDisable($this->_id, '0');
                 CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been disabled.", array(1 => $this->_title)), ts('Page Disabled'), 'success');
                 break;
             case CRM_Core_Action::ENABLE:
             case 'enable':
                 CRM_PCP_BAO_PCP::setDisable($this->_id, '1');
                 CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been enabled.", array(1 => $this->_title)), ts('Page Enabled'), 'success');
                 break;
         }
         if ($context) {
             CRM_Utils_System::redirect($context);
         }
     }
 }
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:63,代碼來源:PCP.php


注:本文中的CRM_PCP_BAO_PCP::setDisable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。