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


PHP CRM_Core_PseudoConstant::staticGroup方法代码示例

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


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

示例1: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     // get the list of all the groups
     if ($this->_context == 'user') {
         $onlyPublicGroups = CRM_Utils_Request::retrieve('onlyPublicGroups', 'Boolean', $this, FALSE);
         $allGroups = CRM_Core_PseudoConstant::staticGroup($onlyPublicGroups);
     } else {
         $allGroups = CRM_Core_PseudoConstant::group();
     }
     // Arrange groups into hierarchical listing (child groups follow their parents and have indentation spacing in title)
     $groupHierarchy = CRM_Contact_BAO_Group::getGroupsHierarchy($allGroups, NULL, '  ', TRUE);
     // get the list of groups contact is currently in ("Added") or unsubscribed ("Removed").
     $currentGroups = CRM_Contact_BAO_GroupContact::getGroupList($this->_contactId);
     // Remove current groups from drowdown options ($groupSelect)
     if (is_array($currentGroups)) {
         // Compare array keys, since the array values (group title) in $groupList may have extra spaces for indenting child groups
         $groupSelect = array_diff_key($groupHierarchy, $currentGroups);
     } else {
         $groupSelect = $groupHierarchy;
     }
     $groupSelect = array('' => ts('- select group -')) + $groupSelect;
     if (count($groupSelect) > 1) {
         $session = CRM_Core_Session::singleton();
         // user dashboard
         if (strstr($session->readUserContext(), 'user')) {
             $msg = ts('Join a Group');
         } else {
             $msg = ts('Add to a group');
         }
         $this->addField('group_id', array('class' => 'crm-action-menu action-icon-plus', 'placeholder' => $msg, 'options' => $groupSelect));
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Add'), 'isDefault' => TRUE)));
     }
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:38,代码来源:GroupContact.php

示例2: buildQuickForm

 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $attributes = CRM_Core_DAO::getAttribute('CRM_ACL_DAO_EntityRole');
     $aclRoles = array('' => ts('- select -')) + CRM_Core_OptionGroup::values('acl_role');
     $this->add('select', 'acl_role_id', ts('ACL Role'), $aclRoles, TRUE);
     $label = ts('Assigned To');
     $group = array('' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup(FALSE, 'Access');
     $this->add('select', 'entity_id', $label, $group, TRUE, array('class' => 'crm-select2 huge'));
     $this->add('checkbox', 'is_active', ts('Enabled?'));
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:20,代码来源:EntityRole.php

示例3: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $attributes = CRM_Core_DAO::getAttribute('CRM_ACL_DAO_EntityRole');
     require_once 'CRM/Core/OptionGroup.php';
     $aclRoles = array('' => ts('- select -')) + CRM_Core_OptionGroup::values('acl_role');
     $this->add('select', 'acl_role_id', ts('ACL Role'), $aclRoles, true);
     require_once 'CRM/ACL/BAO/EntityRole.php';
     $label = ts('Assigned To');
     $group = array('' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup(false, 'Access');
     $this->add('select', 'entity_id', $label, $group, true);
     $this->add('checkbox', 'is_active', ts('Enabled?'));
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:22,代码来源:EntityRole.php

示例4: __construct

 /**
  * Class constructor.
  */
 public function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Constituent Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_pledge' => array('dao' => 'CRM_Pledge_DAO_Pledge', 'fields' => array('pledge_create_date' => array('title' => ts('Pledge Made'), 'required' => TRUE), 'financial_type_id' => array('title' => ts('Financial Type'), 'required' => TRUE), 'frequency_unit' => array('title' => ts('Frequency Unit')), 'installments' => array('title' => ts('Installments')), 'amount' => array('title' => ts('Amount'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_MONEY), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'status_id' => array('title' => ts('Status'))), 'filters' => array('pledge_create_date' => array('title' => ts('Pledge Made'), 'operatorType' => CRM_Report_Form::OP_DATE), 'pledge_amount' => array('title' => ts('Pledged Amount'), 'operatorType' => CRM_Report_Form::OP_INT), 'currency' => array('title' => ts('Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'financial_type_id' => array('title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'pledge_status_id' => array('name' => 'status_id', 'title' => ts('Pledge Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('contribution_status')), 'installments' => array('title' => ts('Installments'), 'type' => CRM_Utils_Type::T_INT)), 'grouping' => 'pledge-fields'), 'civicrm_pledge_payment' => array('dao' => 'CRM_Pledge_DAO_PledgePayment', 'fields' => array('scheduled_date' => array('title' => ts('Next Payment Due'), 'type' => CRM_Utils_Type::T_DATE, 'required' => TRUE), 'scheduled_amount' => array('type' => CRM_Utils_Type::T_MONEY, 'title' => ts('Next Payment Amount'))), 'filters' => array('scheduled_date' => array('title' => ts('Next Payment Due'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE)), 'grouping' => 'pledge-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'), 'default' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => NULL), 'grouping' => 'contact-fields'), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'type' => CRM_Utils_Type::T_INT, 'group' => TRUE, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::staticGroup()))));
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_pledge']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_pledge']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns, 'type' => CRM_Utils_Type::T_INT);
     }
     $this->_tagFilter = TRUE;
     $this->_currencyColumn = 'civicrm_pledge_currency';
     parent::__construct();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:23,代码来源:Pbnp.php

示例5: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->_mappingID = $mappingID = NULL;
     if ($this->_action & CRM_Core_Action::DELETE) {
         $reminderName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'title');
         $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
         if ($this->_context == 'event') {
             $this->_eventId = CRM_Utils_Request::retrieve('eventId', 'Integer', $this);
         }
         $this->assign('reminderName', $reminderName);
         return;
     } elseif ($this->_action & CRM_Core_Action::UPDATE) {
         $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'mapping_id');
         $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
         if ($this->_context == 'event') {
             $this->_eventId = CRM_Utils_Request::retrieve('eventId', 'Integer', $this);
         }
     }
     if (!empty($_POST) && CRM_Utils_Array::value('entity', $_POST)) {
         $mappingID = $_POST['entity'][0];
     } elseif ($this->_mappingID) {
         $mappingID = $this->_mappingID;
     }
     $this->add('text', 'title', ts('Title'), array('size' => 45, 'maxlength' => 128), TRUE);
     $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection($mappingID);
     extract($selectionOptions);
     if (empty($sel1)) {
         CRM_Core_Error::fatal('Could not find mapping for scheduled reminders.');
     }
     $this->assign('entityMapping', json_encode($entityMapping));
     $this->assign('recipientMapping', json_encode($recipientMapping));
     $sel =& $this->add('hierselect', 'entity', ts('Entity'), array('name' => 'entity[0]', 'style' => 'vertical-align: top;'), TRUE);
     $sel->setOptions(array($sel1, $sel2, $sel3));
     if (is_a($sel->_elements[1], 'HTML_QuickForm_select')) {
         // make second selector a multi-select -
         $sel->_elements[1]->setMultiple(TRUE);
         $sel->_elements[1]->setSize(5);
     }
     if (is_a($sel->_elements[2], 'HTML_QuickForm_select')) {
         // make third selector a multi-select -
         $sel->_elements[2]->setMultiple(TRUE);
         $sel->_elements[2]->setSize(5);
     }
     //get the frequency units.
     $this->_freqUnits = array('hour' => 'hour') + CRM_Core_OptionGroup::values('recur_frequency_units');
     //pass the mapping ID in UPDATE mode
     $mappings = CRM_Core_BAO_ActionSchedule::getMapping($mappingID);
     $numericOptions = CRM_Core_SelectValues::getNumericOptions(0, 30);
     //reminder_interval
     $this->add('select', 'start_action_offset', ts('When'), $numericOptions);
     foreach ($this->_freqUnits as $val => $label) {
         $freqUnitsDisplay[$val] = ts('%1(s)', array(1 => $label));
     }
     $this->addDate('absolute_date', ts('Start Date'), FALSE, array('formatType' => 'mailing'));
     //reminder_frequency
     $this->add('select', 'start_action_unit', ts('Frequency'), $freqUnitsDisplay, TRUE);
     $condition = array('before' => ts('before'), 'after' => ts('after'));
     //reminder_action
     $this->add('select', 'start_action_condition', ts('Action Condition'), $condition);
     $this->add('select', 'start_action_date', ts('Date Field'), $sel4, TRUE);
     $this->addElement('checkbox', 'is_repeat', ts('Repeat'), NULL, array('onclick' => "return showHideByValue('is_repeat',true,'repeatFields','table-row','radio',false);"));
     $this->add('select', 'repetition_frequency_unit', ts('every'), $freqUnitsDisplay);
     $this->add('select', 'repetition_frequency_interval', ts('every'), $numericOptions);
     $this->add('select', 'end_frequency_unit', ts('until'), $freqUnitsDisplay);
     $this->add('select', 'end_frequency_interval', ts('until'), $numericOptions);
     $this->add('select', 'end_action', ts('Repetition Condition'), $condition, TRUE);
     $this->add('select', 'end_date', ts('Date Field'), $sel4, TRUE);
     $recipient = 'activity_contacts';
     $recipientListingOptions = array();
     if ($mappingID) {
         $recipient = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $mappingID, 'entity_recipient');
     }
     $this->add('select', 'recipient', ts('Recipient(s)'), $sel5[$recipient], FALSE, array('onClick' => "showHideByValue('recipient','manual','recipientManual','table-row','select',false); showHideByValue('recipient','group','recipientGroup','table-row','select',false);"));
     if (CRM_Utils_Array::value('is_recipient_listing', $_POST)) {
         $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($_POST['entity'][0], $_POST['recipient']);
     } elseif (CRM_Utils_Array::value('recipient_listing', $this->_values)) {
         $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($this->_values['mapping_id'], $this->_values['recipient']);
     }
     $recipientListing = $this->add('select', 'recipient_listing', ts('Recipient Listing'), $recipientListingOptions);
     $recipientListing->setMultiple(TRUE);
     $this->add('hidden', 'is_recipient_listing', empty($recipientListingOptions) ? FALSE : TRUE, array('id' => 'is_recipient_listing'));
     //autocomplete url
     $dataUrl = CRM_Utils_System::url('civicrm/ajax/rest', 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=activity&reset=1', FALSE, NULL, FALSE);
     $this->assign('dataUrl', $dataUrl);
     //tokeninput url
     $tokenUrl = CRM_Utils_System::url('civicrm/ajax/checkemail', 'noemail=1', FALSE, NULL, FALSE);
     $this->assign('tokenUrl', $tokenUrl);
     $this->add('text', 'recipient_manual_id', ts('Manual Recipients'));
     $this->addElement('select', 'group_id', ts('Group'), CRM_Core_PseudoConstant::staticGroup());
     CRM_Mailing_BAO_Mailing::commonCompose($this);
     $this->add('text', 'subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_ActionSchedule', 'subject'));
     $this->add('checkbox', 'is_active', ts('Send email'));
     $this->addFormRule(array('CRM_Admin_Form_ScheduleReminders', 'formRule'));
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:ScheduleReminders.php

示例6: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     //get the context
     $context = $this->get('context');
     if ($this->_searchBasedMailing) {
         $context = 'search';
     }
     $this->assign('context', $context);
     $this->add('text', 'name', ts('Name Your Mailing'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), TRUE);
     //CRM-7362 --add campaigns.
     $mailingId = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
     $campaignId = NULL;
     if ($mailingId) {
         $campaignId = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailingId, 'campaign_id');
     }
     CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
     //dedupe on email option
     $this->addElement('checkbox', 'dedupe_email', ts('Remove duplicate emails?'));
     //get the mailing groups.
     $groups = CRM_Core_PseudoConstant::group('Mailing');
     $mailings = CRM_Mailing_PseudoConstant::completed();
     if (!$mailings) {
         $mailings = array();
     }
     // run the groups through a hook so users can trim it if needed
     CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
     //when the context is search add base group's.
     if ($this->_searchBasedMailing) {
         //get the static groups
         $staticGroups = CRM_Core_PseudoConstant::staticGroup(FALSE, 'Mailing');
         $this->add('select', 'baseGroup', ts('Unsubscription Group'), array('' => ts('- select -')) + $staticGroups, TRUE);
     }
     $inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     //as we are having hidden smart group so no need.
     if (!$this->_searchBasedMailing) {
         $this->addRule('includeGroups', ts('Please select a group to be mailed.'), 'required');
     }
     $outG =& $this->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $inG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $inM =& $this->addElement('advmultiselect', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $outM =& $this->addElement('advmultiselect', 'excludeMailings', ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $inM->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outM->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $urls = array('' => ts('- select -'), -1 => ts('CiviCRM Search')) + CRM_Contact_Page_CustomSearch::info();
     $this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
     //FIXME : currently we are hiding save an continue later when
     //search base mailing, we should handle it when we fix CRM-3876
     $buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', 'isDefault' => TRUE), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
     if ($this->_searchBasedMailing) {
         $buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')));
     }
     $this->addButtons($buttons);
     $this->assign('groupCount', count($groups));
     $this->assign('mailingCount', count($mailings));
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:66,代码来源:Group.php

示例7: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     // get the list of all the groups
     if ($this->_context == 'user') {
         $onlyPublicGroups = CRM_Utils_Request::retrieve('onlyPublicGroups', 'Boolean', $this, false);
         $allGroups = CRM_Core_PseudoConstant::staticGroup($onlyPublicGroups);
     } else {
         $allGroups = CRM_Core_PseudoConstant::group();
     }
     // get the list of groups for the contact
     $currentGroups = CRM_Contact_BAO_GroupContact::getGroupList($this->_contactId);
     if (is_array($currentGroups)) {
         $groupList = array_diff($allGroups, $currentGroups);
     } else {
         $groupList = $allGroups;
     }
     $groupList[''] = ts('- select group -');
     asort($groupList);
     if (count($groupList) > 1) {
         $session = CRM_Core_Session::singleton();
         // user dashboard
         if (strstr($session->readUserContext(), 'user')) {
             $msg = ts('Join a Group');
         } else {
             $msg = ts('Add to a group');
         }
         $this->add('select', 'group_id', $msg, $groupList, true);
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Add'), 'isDefault' => true)));
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:36,代码来源:GroupContact.php

示例8: browse

 /**
  * Browse all acls.
  *
  * @return void
  */
 public function browse()
 {
     // get all acl's sorted by weight
     $entityRoles = array();
     $dao = new CRM_ACL_DAO_EntityRole();
     $dao->find();
     $aclRoles = CRM_Core_OptionGroup::values('acl_role');
     $groups = CRM_Core_PseudoConstant::staticGroup();
     while ($dao->fetch()) {
         $entityRoles[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $entityRoles[$dao->id]);
         $entityRoles[$dao->id]['acl_role'] = $aclRoles[$dao->acl_role_id];
         $entityRoles[$dao->id]['entity'] = $groups[$dao->entity_id];
         // form all action links
         $action = array_sum(array_keys($this->links()));
         if ($dao->is_active) {
             $action -= CRM_Core_Action::ENABLE;
         } else {
             $action -= CRM_Core_Action::DISABLE;
         }
         $entityRoles[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), FALSE, 'entityRole.manage.action', 'EntityRole', $dao->id);
     }
     $this->assign('rows', $entityRoles);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:29,代码来源:EntityRole.php

示例9: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     //get the context
     $context = $this->get('context');
     if ($this->_searchBasedMailing) {
         $context = 'search';
     }
     $this->assign('context', $context);
     $this->add('text', 'name', ts('Name Your Mailing'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), TRUE);
     $hiddenMailingGroup = NULL;
     $campaignId = NULL;
     //CRM-7362 --add campaigns.
     if ($this->_mailingID) {
         $campaignId = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'campaign_id');
         $hiddenMailingGroup = CRM_Mailing_BAO_Mailing::hiddenMailingGroup($this->_mailingID);
     }
     CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
     //dedupe on email option
     $this->addElement('checkbox', 'dedupe_email', ts('Remove duplicate emails?'));
     //get the mailing groups.
     $groups = CRM_Core_PseudoConstant::group('Mailing');
     if ($hiddenMailingGroup) {
         $groups[$hiddenMailingGroup] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $hiddenMailingGroup, 'title');
     }
     $mailings = CRM_Mailing_PseudoConstant::completed();
     if (!$mailings) {
         $mailings = array();
     }
     // run the groups through a hook so users can trim it if needed
     CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
     //when the context is search add base group's.
     if ($this->_searchBasedMailing) {
         //get the static groups
         $staticGroups = CRM_Core_PseudoConstant::staticGroup(FALSE, 'Mailing');
         $this->add('select', 'baseGroup', ts('Unsubscription Group'), array('' => ts('- select -')) + $staticGroups, TRUE);
     }
     if (count($groups) <= 10) {
         // setting minimum height to 2 since widget looks strange when size (height) is 1
         $groupSize = max(count($groups), 2);
     } else {
         $groupSize = 10;
     }
     $inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => $groupSize, 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect'));
     //as we are having hidden smart group so no need.
     if (!$this->_searchBasedMailing) {
         $this->addRule('includeGroups', ts('Please select a group to be mailed.'), 'required');
     }
     $outG =& $this->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => $groupSize, 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect'));
     $inG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     if (count($mailings) <= 10) {
         // setting minimum height to 2 since widget looks strange when size (height) is 1
         $mailingSize = max(count($mailings), 2);
     } else {
         $mailingSize = 10;
     }
     $inM =& $this->addElement('advmultiselect', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => $mailingSize, 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect'));
     $outM =& $this->addElement('advmultiselect', 'excludeMailings', ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => $mailingSize, 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect'));
     $inM->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outM->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $urls = array('' => ts('- select -'), -1 => ts('CiviCRM Search')) + CRM_Contact_Page_CustomSearch::info();
     $this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
     $buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', 'isDefault' => TRUE), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
     $this->addButtons($buttons);
     $this->assign('groupCount', count($groups));
     $this->assign('mailingCount', count($mailings));
     if (count($groups) == 0 && count($mailings) == 0 && !$this->_searchBasedMailing) {
         CRM_Core_Error::statusBounce("To send a mailing, you must have a valid group of recipients - either at least one group that's a Mailing List or at least one previous mailing or start from a search");
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:80,代码来源:Group.php

示例10: __construct

 /**
  */
 public function __construct()
 {
     $this->_columns = array('civicrm_employer' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('organization_name' => array('title' => ts('Employer Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'filters' => array('organization_name' => array('title' => ts('Employer Name'), 'operatorType' => CRM_Report_Form::OP_STRING))), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Employee Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'middle_name' => array('title' => ts('Middle Name')), 'last_name' => array('title' => ts('Last Name')), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'job_title' => array('title' => ts('Job Title'), 'default' => TRUE), 'gender_id' => array('title' => ts('Gender')), 'birth_date' => array('title' => ts('Birth Date')), 'age' => array('title' => ts('Age'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())'), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Employee Name')), 'source' => array('title' => ts('Contact Source'), 'type' => CRM_Utils_Type::T_STRING), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'grouping' => 'contact-fields'), 'civicrm_relationship' => array('dao' => 'CRM_Contact_DAO_Relationship', 'fields' => array('start_date' => array('title' => ts('Employee Since'), 'default' => TRUE)), 'filters' => array('start_date' => array('title' => ts('Employee Since'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-fields', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-fields', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'grouping' => 'contact-fields', 'fields' => array('street_address' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'filters' => array('country_id' => array('title' => ts('Country'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::country(NULL, FALSE)), 'state_province_id' => array('title' => ts('State/Province'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::stateProvince()))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'type' => CRM_Utils_Type::T_INT, 'group' => TRUE, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::staticGroup()))));
     $this->_tagFilter = TRUE;
     parent::__construct();
 }
开发者ID:sdekok,项目名称:civicrm-core,代码行数:8,代码来源:CurrentEmployer.php

示例11: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     //get the context
     $context = $this->get('context');
     if ($this->_searchBasedMailing) {
         $context = 'search';
     }
     $this->assign('context', $context);
     $this->add('text', 'name', ts('Name Your Mailing'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), TRUE);
     $hiddenMailingGroup = NULL;
     $campaignId = NULL;
     //CRM-7362 --add campaigns.
     if ($this->_mailingID) {
         $campaignId = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'campaign_id');
         $hiddenMailingGroup = CRM_Mailing_BAO_Mailing::hiddenMailingGroup($this->_mailingID);
     }
     CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
     //dedupe on email option
     $this->addElement('checkbox', 'dedupe_email', ts('Remove duplicate emails?'));
     // location types
     $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('id' => 'display_name'));
     $this->addElement('select', 'location_type_id', ts("Location Type"), array('' => ts('Automatic')) + $locationTypes);
     $methods = CRM_Core_SelectValues::emailSelectMethods();
     $this->addElement('select', 'email_selection_method', ts("Email Selection Method"), $methods);
     //get the mailing groups.
     $groups = CRM_Core_PseudoConstant::nestedGroup('Mailing');
     if ($hiddenMailingGroup) {
         $groups[$hiddenMailingGroup] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $hiddenMailingGroup, 'title');
     }
     $mailings = CRM_Mailing_PseudoConstant::completed();
     if (!$mailings) {
         $mailings = array();
     }
     // run the groups through a hook so users can trim it if needed
     CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
     //when the context is search add base group's.
     if ($this->_searchBasedMailing) {
         //get the static groups
         $staticGroups = CRM_Core_PseudoConstant::staticGroup(FALSE, 'Mailing');
         $this->add('select', 'baseGroup', ts('Unsubscription Group'), array('' => ts('- select -')) + CRM_Contact_BAO_Group::getGroupsHierarchy($staticGroups, NULL, '&nbsp;&nbsp;', TRUE), TRUE, array('class' => 'crm-select2 huge'));
     }
     $select2style = array('multiple' => TRUE, 'style' => 'width: 100%; max-width: 60em;', 'class' => 'crm-select2', 'placeholder' => ts('- select -'));
     $this->add('select', 'includeGroups', ts('Include Group(s)'), $groups, !$this->_searchBasedMailing, $select2style);
     $this->add('select', 'excludeGroups', ts('Exclude Group(s)'), $groups, FALSE, $select2style);
     $this->add('select', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, FALSE, $select2style);
     $this->add('select', 'excludeMailings', ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, FALSE, $select2style);
     $this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
     $buttons = array(array('type' => 'next', 'name' => ts('Next'), 'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', 'isDefault' => TRUE), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
     $this->addButtons($buttons);
     $this->assign('groupCount', count($groups));
     $this->assign('mailingCount', count($mailings));
     if (count($groups) == 0 && count($mailings) == 0 && !$this->_searchBasedMailing) {
         CRM_Core_Error::statusBounce("To send a mailing, you must have a valid group of recipients - either at least one group that's a Mailing List or at least one previous mailing or start from a search");
     }
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:60,代码来源:Group.php

示例12: __construct

 function __construct()
 {
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name' => array('title' => ts('Constituent Name'), 'required' => true, 'no_repeat' => true), 'id' => array('no_display' => true, 'required' => true)), 'grouping' => 'contact-fields'), 'civicrm_pledge' => array('dao' => 'CRM_Pledge_DAO_Pledge', 'fields' => array('pledge_create_date' => array('title' => ts('Pledged Date'), 'required' => true), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'requried' => true), 'amount' => array('title' => ts('Amount'), 'required' => true, 'type' => CRM_Utils_Type::T_MONEY), 'status_id' => array('title' => ts('Status'))), 'filters' => array('pledge_create_date' => array('title' => 'Pledged Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionType())), 'grouping' => 'pledge-fields'), 'civicrm_pledge_payment' => array('dao' => 'CRM_Pledge_DAO_Payment', 'fields' => array('scheduled_date' => array('title' => ts('Due Date'), 'type' => CRM_Utils_Type::T_DATE, 'required' => true)), 'grouping' => 'pledge-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => null, 'city' => null, 'postal_code' => null, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'), 'default' => true)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => null), 'grouping' => 'contact-fields'), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'group' => true, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::staticGroup()))));
     parent::__construct();
 }
开发者ID:bhirsch,项目名称:civicrm,代码行数:5,代码来源:Pbnp.php

示例13: __construct

 function __construct()
 {
     $this->_columns = array('civicrm_employer' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('organization_name' => array('title' => ts('Employer Name'), 'required' => true, 'no_repeat' => true), 'id' => array('no_display' => true, 'required' => true)), 'filters' => array('organization_name' => array('title' => ts('Employer Name'), 'operatorType' => CRM_Report_Form::OP_STRING))), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name' => array('title' => ts('Employee Name'), 'required' => true), 'job_title' => array('title' => ts('Job Title'), 'default' => true), 'gender_id' => array('title' => ts('Gender')), 'id' => array('no_display' => true, 'required' => true)), 'filters' => array('sort_name' => array('title' => ts('Employee Name')), 'id' => array('no_display' => true)), 'grouping' => 'contact-fields'), 'civicrm_relationship' => array('dao' => 'CRM_Contact_DAO_Relationship', 'fields' => array('start_date' => array('title' => ts('Employee Since'), 'default' => true)), 'filters' => array('start_date' => array('title' => ts('Employee Since'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-fields', 'fields' => array('email' => array('title' => ts('Email'), 'default' => true))), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'grouping' => 'contact-fields', 'fields' => array('street_address' => null, 'city' => null, 'postal_code' => null, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'filters' => array('country_id' => array('title' => ts('Country'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::country(null, false)), 'state_province_id' => array('title' => ts('State/Province'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::stateProvince()))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'group' => true, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::staticGroup()))));
     parent::__construct();
 }
开发者ID:bhirsch,项目名称:civicrm,代码行数:5,代码来源:CurrentEmployer.php

示例14: buildInstanceAndButtons

 function buildInstanceAndButtons()
 {
     require_once 'CRM/Report/Form/Instance.php';
     CRM_Report_Form_Instance::buildForm($this);
     $label = $this->_id ? ts('Update Report') : ts('Create Report');
     $this->addElement('submit', $this->_instanceButtonName, $label);
     $this->addElement('submit', $this->_printButtonName, ts('Print Report'));
     $this->addElement('submit', $this->_pdfButtonName, ts('PDF'));
     if ($this->_instanceForm) {
         $this->assign('instanceForm', true);
     }
     $label = $this->_id ? ts('Print Report') : ts('Print Preview');
     $this->addElement('submit', $this->_printButtonName, $label);
     $label = $this->_id ? ts('PDF') : ts('Preview PDF');
     $this->addElement('submit', $this->_pdfButtonName, $label);
     $label = $this->_id ? ts('Export to CSV') : ts('Preview CSV');
     if ($this->_csvSupported) {
         $this->addElement('submit', $this->_csvButtonName, $label);
     }
     if (CRM_Core_Permission::check('administer Reports') && $this->_add2groupSupported) {
         $this->addElement('select', 'groups', ts('Group'), array('' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup());
         $this->assign('group', true);
     }
     //$this->addElement('select', 'select_add_to_group_id', ts('Group'), $groupList);
     $label = ts('Add these Contacts to Group');
     $this->addElement('submit', $this->_groupButtonName, $label, array('onclick' => 'return checkGroup();'));
     $this->addChartOptions();
     $this->addButtons(array(array('type' => 'submit', 'name' => ts('Preview Report'), 'isDefault' => true)));
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:29,代码来源:Form.php

示例15: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     require_once 'CRM/Mailing/PseudoConstant.php';
     //get the context
     $context = $this->get('context');
     if ($this->_searchBasedMailing) {
         $context = 'search';
     }
     $this->assign('context', $context);
     $this->add('text', 'name', ts('Name Your Mailing'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), true);
     //get the mailing groups.
     $groups =& CRM_Core_PseudoConstant::group('Mailing');
     $mailings =& CRM_Mailing_PseudoConstant::completed();
     if (!$mailings) {
         $mailings = array();
     }
     // run the groups through a hook so users can trim it if needed
     require_once 'CRM/Utils/Hook.php';
     CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
     //when the context is search add base group's.
     if ($this->_searchBasedMailing) {
         //get the static groups
         $staticGroups = CRM_Core_PseudoConstant::staticGroup(false, 'Mailing');
         $this->add('select', 'baseGroup', ts('Base Group'), array('' => ts('- select -')) + $staticGroups, true);
     }
     $inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     //as we are having hidden smart group so no need.
     if (!$this->_searchBasedMailing) {
         $this->addRule('includeGroups', ts('Please select a group to be mailed.'), 'required');
     }
     $outG =& $this->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $inG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $inM =& $this->addElement('advmultiselect', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $outM =& $this->addElement('advmultiselect', 'excludeMailings', ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $inM->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outM->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     require_once 'CRM/Contact/Page/CustomSearch.php';
     $urls = array('' => ts('- select -'), -1 => ts('CiviCRM Search')) + CRM_Contact_Page_CustomSearch::info();
     $this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
     //FIXME : currently we are hiding save an continue later when
     //search base mailing, we should handle it when we fix CRM-3876
     $buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', 'isDefault' => true), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
     if ($this->_searchBasedMailing) {
         $buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')));
     }
     $this->addButtons($buttons);
     $this->assign('groupCount', count($groups));
     $this->assign('mailingCount', count($mailings));
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:60,代码来源:Group.php


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