* @param array $params (reference ) an assoc array of name/value pairs
*
* @return CRM_Contact_BAO_Group object
- * @access public
* @static
*/
public static function add(&$params) {
* @param array $params (reference ) an assoc array of name/value pairs
*
* @return boolean
- * @access public
* @static
*/
public static function dataExists(&$params) {
* @param array $values output values of the object
*
* @return array (reference) the values that could be potentially assigned to smarty
- * @access public
* @static
*/
public static function getValues(&$params, &$values) {
* @param int $tracking
*
* @return array (total, added, notAdded) count of contacts added to group
- * @access public
* @static
*/
static function addContactsToGroup(
* @param null $tracking
*
* @return array (total, removed, notRemoved) count of contacts removed to group
- * @access public
* @static
*/
static function removeContactsFromGroup(
*
* @param bool $visibility
*
- * @access public
*
* @return array $values this array has key-> group id and value group title
* @static
* @param string $method If we want the subscription history details for a specific method
*
* @return object of group contact
- * @access public
* @static
*/
public static function getMembershipDetail($contactId, $groupID, $method = 'Email') {
*
*
* @return groupID
- * @access public
* @static
*/
public static function getGroupId($groupContactID) {
* @param string $method
*
* @return void
- * @access public
* @static
*/
public static function create(&$params, $contactId, $visibility = FALSE, $method = 'Admin') {
* @param null $tracking
*
* @return array (total, added, notAdded) count of contacts added to group
- * @access public
* @static
*/
static function bulkAddContactsToGroup(
return array($numContactsAdded, $numContactsNotAdded);
}
-}
+ /**
+ * Get options for a given field.
+ * @see CRM_Core_DAO::buildOptions
+ *
+ * @param String $fieldName
+ * @param String $context : @see CRM_Core_DAO::buildOptionsContext
+ * @param Array $props : whatever is known about this dao object
+ *
+ * @return Array|bool
+ */
+ public static function buildOptions($fieldName, $context = NULL, $props = array()) {
+ $params = array();
+
+ $options = CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
+
+ // Sort group list by hierarchy
+ // TODO: This will only work when api.entity is "group_contact". What about others?
+ if (($fieldName == 'group' || $fieldName == 'group_id') && ($context == 'search' || $context == 'create')) {
+ $options = CRM_Contact_BAO_Group::getGroupsHierarchy($options, NULL, '- ', TRUE);
+ }
+
+ return $options;
+ }
+}