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


PHP CRM_Campaign_BAO_Campaign::retrieve方法代码示例

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


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

示例1: preProcess

 public function preProcess()
 {
     if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
         CRM_Utils_System::permissionDenied();
     }
     //check for custom data type.
     $this->_cdType = CRM_Utils_Array::value('type', $_GET);
     $this->assign('cdType', FALSE);
     if ($this->_cdType) {
         $this->assign('cdType', TRUE);
         return CRM_Custom_Form_CustomData::preProcess($this);
     }
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('context', $this->_context);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $this->_campaignId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $title = NULL;
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $title = ts('Edit Campaign');
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         $title = ts('Delete Campaign');
     }
     if ($title) {
         CRM_Utils_System::setTitle($title);
     }
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=campaign'));
     $this->assign('action', $this->_action);
     //load the values;
     $this->_values = $this->get('values');
     if (!is_array($this->_values)) {
         $this->_values = array();
         // if we are editing
         if (isset($this->_campaignId) && $this->_campaignId) {
             $params = array('id' => $this->_campaignId);
             CRM_Campaign_BAO_Campaign::retrieve($params, $this->_values);
         }
         //lets use current object session.
         $this->set('values', $this->_values);
     }
     // when custom data is included in form.
     if (!empty($_POST['hidden_custom'])) {
         $this->set('type', 'Campaign');
         $this->set('subType', CRM_Utils_Array::value('campaign_type_id', $_POST));
         $this->set('entityId', $this->_campaignId);
         CRM_Custom_Form_CustomData::preProcess($this);
         CRM_Custom_Form_CustomData::buildQuickForm($this);
         CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:51,代码来源:Campaign.php

示例2: setDefaultValues

 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     $defaults = array();
     // if we are editing
     if (isset($this->_campaignId)) {
         $params = array('id' => $this->_campaignId);
         require_once 'CRM/Campaign/BAO/Campaign.php';
         CRM_Campaign_BAO_Campaign::retrieve($params, $defaults);
     }
     if (isset($defaults['start_date'])) {
         list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['start_date'], 'activityDateTime');
     } else {
         list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults();
     }
     if (isset($defaults['end_date'])) {
         list($defaults['end_date'], $defaults['end_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['end_date'], 'activityDateTime');
     }
     if (!isset($defaults['is_active'])) {
         $defaults['is_active'] = 1;
     }
     if (!$this->_campaignId) {
         return $defaults;
     }
     $dao = new CRM_Campaign_DAO_CampaignGroup();
     $campaignGroups = array();
     $dao->campaign_id = $this->_campaignId;
     $dao->find();
     while ($dao->fetch()) {
         $campaignGroups[$dao->entity_table][$dao->group_type][] = $dao->entity_id;
     }
     if (!empty($campaignGroups)) {
         $defaults['includeGroups'] = $campaignGroups['civicrm_group']['Include'];
     }
     return $defaults;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:42,代码来源:Campaign.php


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