当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contribute_PseudoConstant::pcpStatus方法代码示例

本文整理汇总了PHP中CRM_Contribute_PseudoConstant::pcpStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_PseudoConstant::pcpStatus方法的具体用法?PHP CRM_Contribute_PseudoConstant::pcpStatus怎么用?PHP CRM_Contribute_PseudoConstant::pcpStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contribute_PseudoConstant的用法示例。


在下文中一共展示了CRM_Contribute_PseudoConstant::pcpStatus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 /**
  * Get all PCP Statuses.
  *
  * The static array pcpStatus is returned
  *
  *
  * @param string $column
  * @return array
  *   array reference of all PCP activity statuses
  */
 public static function &pcpStatus($column = 'label')
 {
     if (NULL === self::$pcpStatus) {
         self::$pcpStatus = array();
     }
     if (!array_key_exists($column, self::$pcpStatus)) {
         self::$pcpStatus[$column] = array();
         self::$pcpStatus[$column] = CRM_Core_OptionGroup::values('pcp_status', FALSE, FALSE, FALSE, NULL, $column);
     }
     return self::$pcpStatus[$column];
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:21,代码来源:PseudoConstant.php

示例2: getPcpDashboardInfo

 /**
  * Return PCP  Block info for dashboard.
  *
  * @param int $contactId
  *
  * @return array
  *   array of Pcp if found
  */
 public static function getPcpDashboardInfo($contactId)
 {
     $links = self::pcpLinks();
     $query = "\nSELECT * FROM civicrm_pcp pcp\nWHERE pcp.is_active = 1\n  AND pcp.contact_id = %1\nORDER BY page_type, page_id";
     $params = array(1 => array($contactId, 'Integer'));
     $pcpInfoDao = CRM_Core_DAO::executeQuery($query, $params);
     $pcpInfo = array();
     $hide = $mask = array_sum(array_keys($links['all']));
     $contactPCPPages = array();
     $event = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
     $contribute = CRM_Contribute_PseudoConstant::contributionPage();
     $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus();
     $approved = CRM_Utils_Array::key('Approved', $pcpStatus);
     while ($pcpInfoDao->fetch()) {
         $mask = $hide;
         if ($links) {
             $replace = array('pcpId' => $pcpInfoDao->id, 'pcpBlock' => $pcpInfoDao->pcp_block_id, 'pageComponent' => $pcpInfoDao->page_type);
         }
         $pcpLink = $links['all'];
         $class = '';
         if ($pcpInfoDao->status_id != $approved || $pcpInfoDao->is_active != 1) {
             $class = 'disabled';
             if (!$pcpInfoDao->tellfriend) {
                 $mask -= CRM_Core_Action::DETACH;
             }
         }
         if ($pcpInfoDao->is_active == 1) {
             $mask -= CRM_Core_Action::ENABLE;
         } else {
             $mask -= CRM_Core_Action::DISABLE;
         }
         $action = CRM_Core_Action::formLink($pcpLink, $mask, $replace, ts('more'), FALSE, 'pcp.dashboard.active', 'PCP', $pcpInfoDao->id);
         $component = $pcpInfoDao->page_type;
         $pageTitle = CRM_Utils_Array::value($pcpInfoDao->page_id, ${$component});
         $pcpInfo[] = array('pageTitle' => $pageTitle, 'pcpId' => $pcpInfoDao->id, 'pcpTitle' => $pcpInfoDao->title, 'pcpStatus' => $pcpStatus[$pcpInfoDao->status_id], 'action' => $action, 'class' => $class);
         $contactPCPPages[$pcpInfoDao->page_type][] = $pcpInfoDao->page_id;
     }
     $excludePageClause = $clause = NULL;
     if (!empty($contactPCPPages)) {
         foreach ($contactPCPPages as $component => $entityIds) {
             $excludePageClause[] = "\n( target_entity_type = '{$component}'\nAND target_entity_id NOT IN ( " . implode(',', $entityIds) . ") )";
         }
         $clause = ' AND ' . implode(' OR ', $excludePageClause);
     }
     $query = "\nSELECT *\nFROM civicrm_pcp_block block\nLEFT JOIN civicrm_pcp pcp ON pcp.pcp_block_id = block.id\nWHERE block.is_active = 1\n{$clause}\nGROUP BY block.id\nORDER BY target_entity_type, target_entity_id\n";
     $pcpBlockDao = CRM_Core_DAO::executeQuery($query);
     $pcpBlock = array();
     $mask = 0;
     while ($pcpBlockDao->fetch()) {
         if ($links) {
             $replace = array('pageId' => $pcpBlockDao->target_entity_id, 'pageComponent' => $pcpBlockDao->target_entity_type);
         }
         $pcpLink = $links['add'];
         $action = CRM_Core_Action::formLink($pcpLink, $mask, $replace, ts('more'), FALSE, 'pcp.dashboard.other', "{$pcpBlockDao->target_entity_type}_PCP", $pcpBlockDao->target_entity_id);
         $component = $pcpBlockDao->target_entity_type;
         if ($pageTitle = CRM_Utils_Array::value($pcpBlockDao->target_entity_id, ${$component})) {
             $pcpBlock[] = array('pageId' => $pcpBlockDao->target_entity_id, 'pageTitle' => $pageTitle, 'action' => $action);
         }
     }
     return array($pcpBlock, $pcpInfo);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:69,代码来源:PCP.php

示例3: preProcess


//.........这里部分代码省略.........
         }
         // also set cancel subscription url
         if (CRM_Utils_Array::value('is_recur', $this->_paymentProcessor) && CRM_Utils_Array::value('is_recur', $this->_values)) {
             $this->_values['cancelSubscriptionUrl'] = $this->_paymentObject->cancelSubscriptionURL();
         }
         if ((isset($postProfileType) && $postProfileType == 'Membership' || isset($preProfileType) && $preProfileType == 'Membership') && !$this->_membershipBlock['is_active']) {
             CRM_Core_Error::fatal(ts('This page includes a Profile with Membership fields - but the Membership Block is NOT enabled. Please notify the site administrator.'));
         }
         require_once 'CRM/Pledge/BAO/PledgeBlock.php';
         $pledgeBlock = CRM_Pledge_BAO_PledgeBlock::getPledgeBlock($this->_id);
         if ($pledgeBlock) {
             $this->_values['pledge_block_id'] = CRM_Utils_Array::value('id', $pledgeBlock);
             $this->_values['max_reminders'] = CRM_Utils_Array::value('max_reminders', $pledgeBlock);
             $this->_values['initial_reminder_day'] = CRM_Utils_Array::value('initial_reminder_day', $pledgeBlock);
             $this->_values['additional_reminder_day'] = CRM_Utils_Array::value('additional_reminder_day', $pledgeBlock);
             //set pledge id in values
             $pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this);
             //authenticate pledge user for pledge payment.
             if ($pledgeId) {
                 $this->_values['pledge_id'] = $pledgeId;
                 self::authenticatePledgeUser();
             }
         }
         $this->set('values', $this->_values);
         $this->set('fields', $this->_fields);
     }
     require_once 'CRM/Contribute/BAO/PCP.php';
     $pcpId = CRM_Utils_Request::retrieve('pcpId', 'Positive', $this);
     if ($pcpId) {
         require_once 'CRM/Core/OptionGroup.php';
         $approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name');
         $prms = array('entity_id' => $this->_values['id'], 'entity_table' => 'civicrm_contribution_page');
         require_once 'CRM/Contribute/PseudoConstant.php';
         $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus();
         CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_PCPBlock', $prms, $pcpBlock);
         $prms = array('id' => $pcpId);
         CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_PCP', $prms, $pcpInfo);
         //start and end date of the contribution page
         $startDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('start_date', $this->_values));
         $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $this->_values));
         $now = time();
         if ($pcpInfo['contribution_page_id'] != $this->_values['id']) {
             $statusMessage = ts('This contribution page is not related to the Personal Campaign Page you have just visited. However you can still make a contribution here.');
             CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$this->_values['id']}", false, null, false, true));
         } else {
             if ($pcpInfo['status_id'] != $approvedId) {
                 $statusMessage = ts('The Personal Campaign Page you have just visited is currently %1. However you can still support the campaign by making a contribution here.', array(1 => $pcpStatus[$pcpInfo['status_id']]));
                 CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
             } else {
                 if (!CRM_Utils_Array::value('is_active', $pcpBlock)) {
                     $statusMessage = ts('Personal Campaign Pages are currently not enabled for this contribution page. However you can still support the campaign by making a contribution here.');
                     CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
                 } else {
                     if (!CRM_Utils_Array::value('is_active', $pcpInfo)) {
                         $statusMessage = ts('The Personal Campaign Page you have just visited is current inactive. However you can still make a contribution here.');
                         CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
                     } else {
                         if ($startDate && $startDate > $now || $endDate && $endDate < $now) {
                             $customStartDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('start_date', $this->_values));
                             $customEndDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('end_date', $this->_values));
                             if ($startDate && $endDate) {
                                 $statusMessage = ts('The Personal Campaign Page you have just visited is only active between %1 to %2. However you can still support the campaign by making a contribution here.', array(1 => $customStartDate, 2 => $customEndDate));
                                 CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
                             } else {
                                 if ($startDate) {
                                     $statusMessage = ts('The Personal Campaign Page you have just visited will be active beginning on %1. However you can still support the campaign by making a contribution here.', array(1 => $customStartDate));
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:67,代码来源:ContributionBase.php

示例4: array

 /**
  * Get all the pcp status
  *
  * @access public
  * @return array - array reference of all pcp status
  * @static
  */
 public static function &pcpStatus()
 {
     self::$pcpStatus = array();
     if (!self::$pcpStatus) {
         self::$pcpStatus = CRM_Core_OptionGroup::values("pcp_status");
     }
     return self::$pcpStatus;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:15,代码来源:PseudoConstant.php

示例5: sendStatusUpdate

 /**
  * Function to send notfication email to supporter 
  * 1. when their PCP status is changed by site admin.
  * 2. when supporter initially creates a Personal Campaign Page ($isInitial set to true).
  * 
  * @param int $pcpId      campaign page id
  * @param int $newStatus  pcp status id
  * @param int $isInitial  is it the first time, campaign page has been created by the user
  *
  * @return null
  * @access public
  * @static
  *
  */
 static function sendStatusUpdate($pcpId, $newStatus, $isInitial = false)
 {
     require_once 'CRM/Contribute/PseudoConstant.php';
     $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus();
     $config =& CRM_Core_Config::singleton();
     if (!isset($pcpStatus[$newStatus])) {
         return false;
     }
     require_once 'CRM/Utils/Mail.php';
     require_once 'Mail/mime.php';
     require_once 'CRM/Contact/BAO/Contact/Location.php';
     //set loginUrl
     $loginUrl = $config->userFrameworkBaseURL;
     switch (ucfirst($config->userFramework)) {
         case 'Joomla':
             $loginUrl = str_replace('administrator/', '', $loginUrl);
             $loginUrl .= 'index.php?option=com_user&view=login';
             break;
         case 'Drupal':
             $loginUrl .= 'user';
             break;
     }
     // used in subject templates
     $contribPageTitle = self::getPcpContributionPageTitle($pcpId);
     $tplParams = array('loginUrl' => $loginUrl, 'contribPageTitle' => $contribPageTitle);
     //get the default domain email address.
     require_once 'CRM/Core/BAO/Domain.php';
     list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail();
     if (!$domainEmailAddress || $domainEmailAddress == 'info@FIXME.ORG') {
         CRM_Core_Error::fatal(ts('The site administrator needs to enter a valid \'FROM Email Address\' in Administer CiviCRM &raquo; Configure &raquo; Domain Information. The email address used may need to be a valid mail account with your email service provider.'));
     }
     $receiptFrom = '"' . $domainEmailName . '" <' . $domainEmailAddress . '>';
     // get recipient (supporter) name and email
     $params = array('id' => $pcpId);
     CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_PCP', $params, $pcpInfo);
     list($name, $address) = CRM_Contact_BAO_Contact_Location::getEmailDetails($pcpInfo['contact_id']);
     // get pcp block info
     list($blockId, $eid) = self::getPcpBlockEntityId($pcpId);
     $params = array('id' => $blockId);
     CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_PCPBlock', $params, $pcpBlockInfo);
     // assign urls required in email template
     if ($pcpStatus[$newStatus] == 'Approved') {
         $tplParams['isTellFriendEnabled'] = $pcpBlockInfo['is_tellfriend_enabled'];
         if ($pcpBlockInfo['is_tellfriend_enabled']) {
             $pcpTellFriendURL = CRM_Utils_System::url('civicrm/friend', "reset=1&eid={$eid}&blockId={$blockId}&page=pcp", true, null, false);
             $tplParams['pcpTellFriendURL'] = $pcpTellFriendURL;
         }
     }
     $pcpInfoURL = CRM_Utils_System::url('civicrm/contribute/pcp/info', "reset=1&id={$pcpId}", true, null, false);
     $tplParams['pcpInfoURL'] = $pcpInfoURL;
     $tplParams['contribPageTitle'] = $contribPageTitle;
     if ($emails = CRM_Utils_Array::value('notify_email', $pcpBlockInfo)) {
         $emailArray = explode(',', $emails);
         $tplParams['pcpNotifyEmailAddress'] = $emailArray[0];
     }
     // get appropriate message based on status
     $tplParams['pcpStatus'] = $pcpStatus[$newStatus];
     $tplName = $isInitial ? 'pcp_supporter_notify' : 'pcp_status_change';
     require_once 'CRM/Core/BAO/MessageTemplates.php';
     list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate(array('groupName' => 'msg_tpl_workflow_contribution', 'valueName' => $tplName, 'contactId' => $pcpInfo['contact_id'], 'tplParams' => $tplParams, 'from' => $receiptFrom, 'toName' => $name, 'toEmail' => $address));
     return $sent;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:76,代码来源:PCP.php

示例6: array

 /**
  * Get all the pcp status
  *
  * @access public
  * @return array - array reference of all pcp status
  * @static
  */
 public static function &pcpStatus()
 {
     self::$pcpStatus = array();
     if (!self::$pcpStatus) {
         require_once "CRM/Core/OptionGroup.php";
         self::$pcpStatus = CRM_Core_OptionGroup::values("pcp_status");
     }
     return self::$pcpStatus;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:16,代码来源:PseudoConstant.php

示例7: run

 /**
  * 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.
  *
  * @return void
  * @access public
  *
  */
 function run()
 {
     $session =& CRM_Core_Session::singleton();
     $config =& CRM_Core_Config::singleton();
     $permissionCheck = false;
     $statusMessage = '';
     if ($config->userFramework != 'Joomla') {
         $permissionCheck = CRM_Core_Permission::check('administer CiviCRM');
     }
     //get the pcp id.
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, false);
     $prms = array('id' => $this->_id);
     CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_PCP', $prms, $pcpInfo);
     if (empty($pcpInfo)) {
         $statusMessage = ts('The personal campaign page you requested is currently unavailable.');
         CRM_Core_Error::statusBounce($statusMessage, $config->userFrameworkBaseURL);
     }
     CRM_Utils_System::setTitle($pcpInfo['title']);
     $this->assign('pcp', $pcpInfo);
     require_once 'CRM/Contribute/PseudoConstant.php';
     require_once 'CRM/Core/OptionGroup.php';
     $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus();
     $approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name');
     // check if PCP is created by anonymous user
     $anonymousPCP = CRM_Utils_Request::retrieve('ap', 'Boolean', $this);
     if ($anonymousPCP) {
         $loginUrl = $config->userFrameworkBaseURL;
         switch (ucfirst($config->userFramework)) {
             case 'Joomla':
                 $loginUrl = str_replace('administrator/', '', $loginUrl);
                 $loginUrl .= 'index.php?option=com_user&view=login';
                 break;
             case 'Drupal':
                 $loginUrl .= 'user';
                 break;
         }
         $anonMessage = ts('Once you\'ve received your new account welcome email, you can <a href=%1>click here</a> to login and promote your campaign page.', array(1 => $loginUrl));
         CRM_Core_Session::setStatus($anonMessage);
     } else {
         $statusMessage = ts('The personal campaign page you requested is currently unavailable. However you can still support the campaign by making a contribution here.');
     }
     if (!$pcpInfo['is_active']) {
         // form is inactive, forward to main contribution page
         CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
     } else {
         if ($pcpInfo['status_id'] != $approvedId && !$permissionCheck) {
             if ($pcpInfo['contact_id'] != $session->get('userID')) {
                 // PCP not approved. Forward everyone except admin and owner to main contribution page
                 CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
             }
         } else {
             $getStatus = CRM_Contribute_BAO_PCP::getStatus($this->_id);
             if (!$getStatus) {
                 // PCP not enabled for this contribution page. Forward everyone to main contribution page
                 CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$pcpInfo['contribution_page_id']}", false, null, false, true));
             }
         }
     }
     $default = array();
     CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_ContributionPage', 'id', $pcpInfo['contribution_page_id'], $default, array('start_date', 'end_date'));
     require_once "CRM/Contribute/PseudoConstant.php";
     $this->assign('pageName', CRM_Contribute_PseudoConstant::contributionPage($pcpInfo['contribution_page_id'], true));
     if ($pcpInfo['contact_id'] == $session->get('userID')) {
         $owner = $default[$pcpInfo['contribution_page_id']];
         $owner['status'] = CRM_Utils_Array::value($pcpInfo['status_id'], $pcpStatus);
         $this->assign('owner', $owner);
         require_once 'CRM/Contribute/BAO/PCP.php';
         $link = CRM_Contribute_BAO_PCP::pcpLinks();
         unset($link['all'][CRM_Core_Action::ENABLE]);
         $hints = array(CRM_Core_Action::UPDATE => ts('Change the content and appearance of your page'), CRM_Core_Action::DETACH => ts('Send emails inviting your friends to support your campaign!'), CRM_Core_Action::BROWSE => ts('Update your personal contact information'), CRM_Core_Action::DISABLE => ts('De-activate the page (you can re-activate it later)'), CRM_Core_Action::DELETE => ts('Remove the page (this cannot be undone!)'));
         CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_PCPBlock', $pcpInfo['contribution_page_id'], 'entity_id', $blockValues, array('is_tellfriend_enabled'));
         $blockId = array_pop($blockValues);
         $replace = array('id' => $this->_id, 'block' => $blockId['id']);
         if (!CRM_Utils_Array::value('is_tellfriend_enabled', $blockId) || CRM_Utils_Array::value('status_id', $pcpInfo) != $approvedId) {
             unset($link['all'][CRM_Core_Action::DETACH]);
         }
         $this->assign('links', $link['all']);
         $this->assign('hints', $hints);
         $this->assign('replace', $replace);
     }
     $honor = CRM_Contribute_BAO_PCP::honorRoll($this->_id);
     if ($file_id = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $this->_id, 'file_id', 'entity_id')) {
         $image = '<img src="' . CRM_Utils_System::url('civicrm/file', "reset=1&id={$file_id}&eid={$this->_id}") . '" />';
         $this->assign('image', $image);
     }
     $totalAmount = CRM_Contribute_BAO_PCP::thermoMeter($this->_id);
     $achieved = round($totalAmount / $pcpInfo['goal_amount'] * 100, 2);
     if ($linkText = CRM_Contribute_BAO_PCP::getPcpBlockStatus($pcpInfo['contribution_page_id'])) {
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdev,代码行数:101,代码来源:PCPInfo.php


注:本文中的CRM_Contribute_PseudoConstant::pcpStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。