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


PHP CRM_Contact_BAO_Group::groupTypeCondition方法代码示例

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


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

示例1: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     // add the email address
     $this->add('text', 'email', ts('Email'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', 'email'), TRUE);
     $this->addRule('email', ts("Please enter a valid email address."), 'email');
     if (!$this->_groupID) {
         // create a selector box of all public groups
         $groupTypeCondition = CRM_Contact_BAO_Group::groupTypeCondition('Mailing');
         $query = "\nSELECT   id, title, description\n  FROM   civicrm_group\n WHERE   ( saved_search_id = 0\n    OR     saved_search_id IS NULL )\n   AND   visibility != 'User and User Admin Only'\n   AND   {$groupTypeCondition}\nORDER BY title";
         $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
         $rows = array();
         while ($dao->fetch()) {
             $row = array();
             $row['id'] = $dao->id;
             $row['title'] = $dao->title;
             $row['description'] = $dao->description;
             $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $row['id'];
             $this->addElement('checkbox', $row['checkbox'], NULL, NULL);
             $rows[] = $row;
         }
         if (empty($rows)) {
             CRM_Core_Error::fatal(ts('There are no public mailing list groups to display.'));
         }
         $this->assign('rows', $rows);
         $this->addFormRule(array('CRM_Mailing_Form_Subscribe', 'formRule'));
     }
     $addCaptcha = TRUE;
     // if recaptcha is not configured, then dont add it
     // CRM-11316 Only enable ReCAPTCHA for anonymous visitors
     $config = CRM_Core_Config::singleton();
     $session = CRM_Core_Session::singleton();
     $contactID = $session->get('userID');
     if (empty($config->recaptchaPublicKey) || empty($config->recaptchaPrivateKey) || $contactID) {
         $addCaptcha = FALSE;
     } else {
         // if this is POST request and came from a block,
         // lets add recaptcha only if already present
         // gross hack for now
         if (!empty($_POST) && !array_key_exists('recaptcha_challenge_field', $_POST)) {
             $addCaptcha = FALSE;
         }
     }
     if ($addCaptcha) {
         // add captcha
         $captcha = CRM_Utils_ReCAPTCHA::singleton();
         $captcha->add($this);
         $this->assign('isCaptcha', TRUE);
     }
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Subscribe'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:kidaa30,项目名称:yes,代码行数:55,代码来源:Subscribe.php

示例2:

 /**
  * Get all permissioned groups from database
  *
  * The static array group is returned, and if it's
  * called the first time, the <b>Group DAO</b> is used
  * to get all the groups.
  *
  * Note: any database errors will be trapped by the DAO.
  *
  * @access public
  * @static
  *
  * @return array - array reference of all groups.
  *
  */
 public static function &staticGroup($onlyPublic = FALSE, $groupType = NULL, $excludeHidden = TRUE)
 {
     if (!self::$staticGroup) {
         $condition = 'saved_search_id = 0 OR saved_search_id IS NULL';
         if ($onlyPublic) {
             $condition .= " AND visibility != 'User and User Admin Only'";
         }
         if ($groupType) {
             $condition .= ' AND ' . CRM_Contact_BAO_Group::groupTypeCondition($groupType);
         }
         if ($excludeHidden) {
             $condition .= ' AND is_hidden != 1 ';
         }
         self::populate(self::$staticGroup, 'CRM_Contact_DAO_Group', FALSE, 'title', 'is_active', $condition, 'title');
     }
     return self::$staticGroup;
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:32,代码来源:PseudoConstant.php

示例3:

 /**
  * Get all permissioned groups from database
  *
  * The static array group is returned, and if it's
  * called the first time, the <b>Group DAO</b> is used 
  * to get all the groups.
  *
  * Note: any database errors will be trapped by the DAO.
  *
  * @access public
  * @static
  *
  * @return array - array reference of all groups.
  *
  */
 public static function &staticGroup($onlyPublic = false, $groupType = null)
 {
     if (!self::$staticGroup) {
         $condition = 'saved_search_id = 0 OR saved_search_id IS NULL';
         if ($onlyPublic) {
             $condition .= " AND visibility != 'User and User Admin Only'";
         }
         if ($groupType) {
             require_once 'CRM/Contact/BAO/Group.php';
             $condition .= ' AND ' . CRM_Contact_BAO_Group::groupTypeCondition($groupType);
         }
         self::populate(self::$staticGroup, 'CRM_Contact_DAO_Group', false, 'title', 'is_active', $condition, 'title');
     }
     return self::$staticGroup;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:30,代码来源:PseudoConstant.php


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