本文整理汇总了PHP中CRM_Core_BAO_File::buildAttachment方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_File::buildAttachment方法的具体用法?PHP CRM_Core_BAO_File::buildAttachment怎么用?PHP CRM_Core_BAO_File::buildAttachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_File
的用法示例。
在下文中一共展示了CRM_Core_BAO_File::buildAttachment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* @param CRM_Core_Form $form
*/
public static function preProcess(&$form)
{
//get multi client case configuration
$xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
$form->_allowMultiClient = (bool) $xmlProcessorProcess->getAllowMultipleCaseClients();
if ($form->_context == 'caseActivity') {
$contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $form);
$atype = CRM_Core_OptionGroup::getValue('activity_type', 'Change Case Start Date', 'name');
$caseId = CRM_Utils_Array::first($form->_caseId);
$form->assign('changeStartURL', CRM_Utils_System::url('civicrm/case/activity', "action=add&reset=1&cid={$contactID}&caseid={$caseId}&atype={$atype}"));
return;
}
$form->_context = CRM_Utils_Request::retrieve('context', 'String', $form);
$form->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $form);
$form->assign('context', $form->_context);
// check if the case type id passed in url is a valid one
$caseTypeId = CRM_Utils_Request::retrieve('ctype', 'Positive', $form);
$caseTypes = CRM_Case_PseudoConstant::caseType();
$form->_caseTypeId = array_key_exists($caseTypeId, $caseTypes) ? $caseTypeId : NULL;
// check if the case status id passed in url is a valid one
$caseStatusId = CRM_Utils_Request::retrieve('case_status_id', 'Positive', $form);
$caseStatus = CRM_Case_PseudoConstant::caseStatus();
$form->_caseStatusId = array_key_exists($caseStatusId, $caseStatus) ? $caseStatusId : NULL;
// Add attachments
CRM_Core_BAO_File::buildAttachment($form, 'civicrm_activity', $form->_activityId);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/case', 'reset=1'));
}
示例2: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
$this->add('text', 'pcp_title', ts('Title'), NULL, TRUE);
$this->add('textarea', 'pcp_intro_text', ts('Welcome'), NULL, TRUE);
$this->add('text', 'goal_amount', ts('Your Goal'), NULL, TRUE);
$this->addRule('goal_amount', ts('Goal Amount should be a numeric value'), 'money');
$attributes = array();
if ($this->_component == 'event') {
if ($this->get('action') & CRM_Core_Action::ADD) {
$attributes = array('value' => ts('Join Us'), 'onClick' => 'select();');
}
$this->add('text', 'donate_link_text', ts('Sign up Button'), $attributes);
} else {
if ($this->get('action') & CRM_Core_Action::ADD) {
$attributes = array('value' => ts('Donate Now'), 'onClick' => 'select();');
}
$this->add('text', 'donate_link_text', ts('Donation Button'), $attributes);
}
$attrib = array('rows' => 8, 'cols' => 60);
$this->add('textarea', 'page_text', ts('Your Message'), NULL, FALSE);
$maxAttachments = 1;
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_pcp', $this->_pageId, $maxAttachments);
$this->addElement('checkbox', 'is_thermometer', ts('Progress Bar'));
$this->addElement('checkbox', 'is_honor_roll', ts('Honor Roll'), NULL);
if ($this->_pageId) {
$params = array('id' => $this->_pageId);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $params, $pcpInfo);
$owner_notification_option = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCPBlock', $pcpInfo['pcp_block_id'], 'owner_notify_id');
} else {
$owner_notification_option = CRM_PCP_BAO_PCP::getOwnerNotificationId($this->controller->get('component_page_id'), $this->_component ? $this->_component : 'contribute');
}
if ($owner_notification_option == CRM_Core_OptionGroup::getValue('pcp_owner_notify', 'owner_chooses', 'name')) {
$this->assign('owner_notification_option', TRUE);
$this->addElement('checkbox', 'is_notify', ts('Notify me via email when someone donates to my page'), NULL);
}
$this->addElement('checkbox', 'is_active', ts('Active'));
if ($this->_context == 'dashboard') {
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin/pcp', 'reset=1'));
}
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->addFormRule(array('CRM_PCP_Form_Campaign', 'formRule'), $this);
}
示例3: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
require_once 'CRM/Core/OptionGroup.php';
require_once 'CRM/Grant/BAO/Grant.php';
$attributes = CRM_Core_DAO::getAttribute('CRM_Grant_DAO_Grant');
$grantType = CRM_Core_OptionGroup::values('grant_type');
$this->add('select', 'grant_type_id', ts('Grant Type'), array('' => ts('- select -')) + $grantType, true);
$grantStatus = CRM_Core_OptionGroup::values('grant_status');
$this->add('select', 'status_id', ts('Grant Status'), array('' => ts('- select -')) + $grantStatus, true);
$this->addDate('application_received_date', ts('Application Received'), false, array('formatType' => 'custom'));
$this->addDate('decision_date', ts('Grant Decision'), false, array('formatType' => 'custom'));
$this->addDate('money_transfer_date', ts('Money Transferred'), false, array('formatType' => 'custom'));
$this->addDate('grant_due_date', ts('Grant Report Due'), false, array('formatType' => 'custom'));
$this->addElement('checkbox', 'grant_report_received', ts('Grant Report Received?'), null);
$this->add('textarea', 'rationale', ts('Rationale'), $attributes['rationale']);
$this->add('text', 'amount_total', ts('Amount Requested'), null, true);
$this->addRule('amount_total', ts('Please enter a valid amount.'), 'money');
$this->add('text', 'amount_granted', ts('Amount Granted'));
$this->addRule('amount_granted', ts('Please enter a valid amount.'), 'money');
$this->add('text', 'amount_requested', ts('Amount Requested<br />(original currency)'));
$this->addRule('amount_requested', ts('Please enter a valid amount.'), 'money');
$noteAttrib = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Note');
$this->add('textarea', 'note', ts('Notes'), $noteAttrib['note']);
//build custom data
CRM_Custom_Form_Customdata::buildQuickForm($this);
// add attachments part
require_once 'CRM/Core/BAO/File.php';
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_grant', $this->_id);
// make this form an upload since we dont know if the custom data injected dynamically
// is of type file etc $uploadNames = $this->get( 'uploadNames' );
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'upload', 'name' => ts('Save and New'), 'js' => array('onclick' => "return verify( );"), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
if ($this->_context == 'standalone') {
require_once 'CRM/Contact/Form/NewContact.php';
CRM_Contact_Form_NewContact::buildQuickForm($this);
$this->addFormRule(array('CRM_Grant_Form_Grant', 'formRule'), $this);
}
}
示例4: buildQuickForm
//.........这里部分代码省略.........
break;
case 'cc':
$form->_ccContactIds[] = $contactId;
break;
case 'bcc':
$form->_bccContactIds[] = $contactId;
break;
}
$form->_allContactIds[] = $contactId;
}
}
$setDefaults = TRUE;
}
}
//get the group of contacts as per selected by user in case of Find Activities
if (!empty($form->_activityHolderIds)) {
$contact = $form->get('contacts');
$form->_allContactIds = $form->_contactIds = $contact;
}
// check if we need to setdefaults and check for valid contact emails / communication preferences
if (is_array($form->_allContactIds) && $setDefaults) {
$returnProperties = array('sort_name' => 1, 'email' => 1, 'do_not_email' => 1, 'is_deceased' => 1, 'on_hold' => 1, 'display_name' => 1, 'preferred_mail_format' => 1);
// get the details for all selected contacts ( to, cc and bcc contacts )
list($form->_contactDetails) = CRM_Utils_Token::getTokenDetails($form->_allContactIds, $returnProperties, FALSE, FALSE);
// make a copy of all contact details
$form->_allContactDetails = $form->_contactDetails;
// perform all validations
foreach ($form->_allContactIds as $key => $contactId) {
$value = $form->_contactDetails[$contactId];
if ($value['do_not_email'] || empty($value['email']) || !empty($value['is_deceased']) || $value['on_hold']) {
$suppressedEmails++;
// unset contact details for contacts that we won't be sending email. This is prevent extra computation
// during token evaluation etc.
unset($form->_contactDetails[$contactId]);
} else {
$email = $value['email'];
// build array's which are used to setdefaults
if (in_array($contactId, $form->_toContactIds)) {
$form->_toContactDetails[$contactId] = $form->_contactDetails[$contactId];
// If a particular address has been specified as the default, use that instead of contact's primary email
if (!empty($form->_toEmail) && $form->_toEmail['contact_id'] == $contactId) {
$email = $form->_toEmail['email'];
}
$toArray[] = array('text' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "{$contactId}::{$email}");
} elseif (in_array($contactId, $form->_ccContactIds)) {
$ccArray[] = array('text' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "{$contactId}::{$email}");
} elseif (in_array($contactId, $form->_bccContactIds)) {
$bccArray[] = array('text' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "{$contactId}::{$email}");
}
}
}
if (empty($toArray)) {
CRM_Core_Error::statusBounce(ts('Selected contact(s) do not have a valid email address, or communication preferences specify DO NOT EMAIL, or they are deceased or Primary email address is On Hold.'));
}
}
$form->assign('toContact', json_encode($toArray));
$form->assign('ccContact', json_encode($ccArray));
$form->assign('bccContact', json_encode($bccArray));
$form->assign('suppressedEmails', $suppressedEmails);
$form->assign('totalSelectedContacts', count($form->_contactIds));
$form->add('text', 'subject', ts('Subject'), 'size=50 maxlength=254', TRUE);
$form->add('select', 'fromEmailAddress', ts('From'), $form->_fromEmails, TRUE, array('class' => 'crm-select2 huge'));
CRM_Mailing_BAO_Mailing::commonCompose($form);
// add attachments
CRM_Core_BAO_File::buildAttachment($form, NULL);
if ($form->_single) {
// also fix the user context stack
if ($form->_caseId) {
$ccid = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseContact', $form->_caseId, 'contact_id', 'case_id');
$url = CRM_Utils_System::url('civicrm/contact/view/case', "&reset=1&action=view&cid={$ccid}&id={$form->_caseId}");
} elseif ($form->_context) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
} else {
$url = CRM_Utils_System::url('civicrm/contact/view', "&show=1&action=browse&cid={$form->_contactIds[0]}&selectedChild=activity");
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
$form->addDefaultButtons(ts('Send Email'), 'upload', 'cancel');
} else {
$form->addDefaultButtons(ts('Send Email'), 'upload');
}
$fields = array('followup_assignee_contact_id' => array('type' => 'entityRef', 'label' => ts('Assigned to'), 'attributes' => array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0)))), 'followup_activity_type_id' => array('type' => 'select', 'label' => ts('Followup Activity'), 'attributes' => array('' => '- ' . ts('select activity') . ' -') + CRM_Core_PseudoConstant::ActivityType(FALSE), 'extra' => array('class' => 'crm-select2')), 'followup_activity_subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')));
//add followup date
$form->addDateTime('followup_date', ts('in'), FALSE, array('formatType' => 'activityDateTime'));
foreach ($fields as $field => $values) {
if (!empty($fields[$field])) {
$attribute = CRM_Utils_Array::value('attributes', $values);
$required = !empty($values['required']);
if ($values['type'] == 'select' && empty($attribute)) {
$form->addSelect($field, array('entity' => 'activity'), $required);
} elseif ($values['type'] == 'entityRef') {
$form->addEntityRef($field, $values['label'], $attribute, $required);
} else {
$form->add($values['type'], $field, $values['label'], $attribute, $required, CRM_Utils_Array::value('extra', $values));
}
}
}
$form->addFormRule(array('CRM_Contact_Form_Task_EmailCommon', 'formRule'), $form);
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js', 0, 'html-header');
}
示例5: buildQuickForm
/**
* Build the form
*
* @access public
* @return void
*/
static function buildQuickForm(&$form)
{
$toArray = $ccArray = $bccArray = array();
$suppressedEmails = 0;
$to = $form->add('text', 'to', ts('To'), '', true);
$cc = $form->add('text', 'cc_id', ts('CC'));
$bcc = $form->add('text', 'bcc_id', ts('BCC'));
$elements = array('cc', 'bcc');
foreach ($elements as $element) {
if (${$element}->getValue()) {
preg_match_all('!"(.*?)"\\s+<\\s*(.*?)\\s*>!', ${$element}->getValue(), $matches);
$elementValues = array();
for ($i = 0; $i < count($matches[0]); $i++) {
$name = '"' . $matches[1][$i] . '" <' . $matches[2][$i] . '>';
$elementValues[] = array('name' => $name, 'id' => $matches[0][$i]);
}
$var = "{$element}Contact";
$form->assign($var, json_encode($elementValues));
}
}
// when form is submitted recompute contactIds
$allToEmails = array();
if ($to->getValue()) {
$allToEmails = explode(',', $to->getValue());
$form->_contactIds = array();
foreach ($allToEmails as $value) {
list($contactId, $email) = explode('::', $value);
$form->_contactIds[] = $contactId;
$form->_toContactEmails[] = $email;
}
}
if (is_array($form->_contactIds)) {
$returnProperties = array('sort_name' => 1, 'email' => 1, 'do_not_email' => 1, 'on_hold' => 1, 'display_name' => 1, 'preferred_mail_format' => 1);
require_once 'CRM/Mailing/BAO/Mailing.php';
list($form->_contactDetails) = CRM_Mailing_BAO_Mailing::getDetails($form->_contactIds, $returnProperties, false, false);
// make a copy of all contact details
$form->_allContactDetails = $form->_contactDetails;
foreach ($form->_contactIds as $key => $contactId) {
$value = $form->_contactDetails[$contactId];
if ($value['do_not_email'] || empty($value['email']) || $value['is_deceased'] || $value['on_hold']) {
$suppressedEmails++;
// unset contact details for contacts that we won't be sending email. This is prevent extra computation
// during token evaluation etc.
unset($form->_contactDetails[$contactId]);
} else {
if (empty($form->_toContactEmails)) {
$email = $value['email'];
} else {
$email = $form->_toContactEmails[$key];
}
$toArray[] = array('name' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "{$contactId}::{$email}");
}
}
if (empty($toArray)) {
CRM_Core_Error::statusBounce(ts('Selected contact(s) do not have a valid email address, or communication preferences specify DO NOT EMAIL, or they are deceased or Primary email address is On Hold).'));
}
}
$form->assign('toContact', json_encode($toArray));
$form->assign('suppressedEmails', $suppressedEmails);
$form->assign('noEmails', $form->_noEmails);
$session =& CRM_Core_Session::singleton();
$userID = $session->get('userID');
list($fromDisplayName, $fromEmail, $fromDoNotEmail) = CRM_Contact_BAO_Contact::getContactDetails($userID);
if (!$fromEmail) {
CRM_Core_Error::statusBounce(ts('Your user record does not have a valid email address'));
}
if (!trim($fromDisplayName)) {
$fromDisplayName = $fromEmail;
}
$form->assign('totalSelectedContacts', count($form->_contactIds));
$from = "{$fromDisplayName} <{$fromEmail}>";
$form->_fromEmails = array('0' => $from) + CRM_Core_PseudoConstant::fromEmailAddress();
$form->add('text', 'subject', ts('Subject'), 'size=50 maxlength=254', true);
$selectEmails = $form->_fromEmails;
foreach (array_keys($selectEmails) as $k) {
$selectEmails[$k] = htmlspecialchars($selectEmails[$k]);
}
$form->add('select', 'fromEmailAddress', ts('From'), $selectEmails, true);
require_once "CRM/Mailing/BAO/Mailing.php";
CRM_Mailing_BAO_Mailing::commonCompose($form);
// add attachments
require_once 'CRM/Core/BAO/File.php';
CRM_Core_BAO_File::buildAttachment($form, null);
if ($form->_single) {
// also fix the user context stack
if ($form->_caseId) {
$ccid = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseContact', $form->_caseId, 'contact_id', 'case_id');
$url = CRM_Utils_System::url('civicrm/contact/view/case', "&reset=1&action=view&cid={$ccid}&id={$form->_caseId}");
} else {
if ($form->_context) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
} else {
$url = CRM_Utils_System::url('civicrm/contact/view', "&show=1&action=browse&cid={$form->_contactIds[0]}&selectedChild=activity");
}
//.........这里部分代码省略.........
示例6: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$this->add('text', 'title', ts('Title'), null, true);
$this->add('textarea', 'intro_text', ts('Welcome'), null, true);
$this->add('text', 'goal_amount', ts('Your Goal'), null, true);
$this->addRule('goal_amount', ts('Goal Amount should be a numeric value'), 'money');
$attributes = array();
if ($this->get('action') & CRM_Core_Action::ADD) {
$attributes = array('value' => ts('Donate Now'), 'onClick' => 'select();');
}
$this->add('text', 'donate_link_text', ts('Donation Button'), $attributes);
$attrib = array('rows' => 8, 'cols' => 60);
// $this->addWysiwyg( 'page_text', ts('Your Message'), $attrib );
$this->add('textarea', 'page_text', ts('Your Message'), null, false);
$maxAttachments = 1;
require_once 'CRM/Core/BAO/File.php';
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_pcp', $this->_pageId, $maxAttachments);
$this->addElement('checkbox', 'is_thermometer', ts('Progress Bar'));
$this->addElement('checkbox', 'is_honor_roll', ts('Honor Roll'), null);
$this->addElement('checkbox', 'is_active', ts('Active'));
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->addFormRule(array('CRM_Contribute_Form_PCP_Campaign', 'formRule'), $this);
}
示例7: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Grant_DAO_Grant');
$this->addSelect('grant_type_id', array('onChange' => "CRM.buildCustomData( 'Grant', this.value );"), TRUE);
//need to assign custom data type and subtype to the template
$this->assign('customDataType', 'Grant');
$this->assign('customDataSubType', $this->_grantType);
$this->assign('entityID', $this->_id);
$this->addSelect('status_id', array(), TRUE);
$this->addDate('application_received_date', ts('Application Received'), FALSE, array('formatType' => 'custom'));
$this->addDate('decision_date', ts('Grant Decision'), FALSE, array('formatType' => 'custom'));
$this->addDate('money_transfer_date', ts('Money Transferred'), FALSE, array('formatType' => 'custom'));
$this->addDate('grant_due_date', ts('Grant Report Due'), FALSE, array('formatType' => 'custom'));
$this->addElement('checkbox', 'grant_report_received', ts('Grant Report Received?'), NULL);
$this->add('textarea', 'rationale', ts('Rationale'), $attributes['rationale']);
$this->add('text', 'amount_total', ts('Amount Requested'), NULL, TRUE);
$this->addRule('amount_total', ts('Please enter a valid amount.'), 'money');
$this->add('text', 'amount_granted', ts('Amount Granted'));
$this->addRule('amount_granted', ts('Please enter a valid amount.'), 'money');
$this->add('text', 'amount_requested', ts('Amount Requested<br />(original currency)'));
$this->addRule('amount_requested', ts('Please enter a valid amount.'), 'money');
$noteAttrib = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Note');
$this->add('textarea', 'note', ts('Notes'), $noteAttrib['note']);
// add attachments part
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_grant', $this->_id);
// make this form an upload since we dont know if the custom data injected dynamically
// is of type file etc $uploadNames = $this->get( 'uploadNames' );
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'upload', 'name' => ts('Save and New'), 'js' => array('onclick' => "return verify( );"), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
if ($this->_context == 'standalone') {
$this->addEntityRef('contact_id', ts('Applicant'), array('create' => TRUE), TRUE);
}
}
示例8: buildQuickForm
/**
* Build the form
*
* @access public
*
* @return void
*/
static function buildQuickForm(&$form)
{
$toArray = $ccArray = $bccArray = array();
$suppressedEmails = 0;
//here we are getting logged in user id as array but we need target contact id. CRM-5988
$cid = $form->get('cid');
if ($cid) {
$form->_contactIds = array($cid);
}
$to = $form->add('text', 'to', ts('To'), '', TRUE);
$cc = $form->add('text', 'cc_id', ts('CC'));
$bcc = $form->add('text', 'bcc_id', ts('BCC'));
$elements = array('cc', 'bcc');
foreach ($elements as $element) {
if (${$element}->getValue()) {
preg_match_all('!"(.*?)"\\s+<\\s*(.*?)\\s*>!', ${$element}->getValue(), $matches);
$elementValues = array();
for ($i = 0; $i < count($matches[0]); $i++) {
$name = '"' . $matches[1][$i] . '" <' . $matches[2][$i] . '>';
$elementValues[] = array('name' => $name, 'id' => $matches[0][$i]);
}
$var = "{$element}Contact";
$form->assign($var, json_encode($elementValues));
}
}
$toSetDefault = TRUE;
if (property_exists($form, '_context') && $form->_context == 'standalone') {
$toSetDefault = FALSE;
}
// when form is submitted recompute contactIds
$allToEmails = array();
if ($to->getValue()) {
$allToEmails = explode(',', $to->getValue());
$form->_contactIds = array();
foreach ($allToEmails as $value) {
list($contactId, $email) = explode('::', $value);
if ($contactId) {
$form->_contactIds[] = $contactId;
$form->_toContactEmails[] = $email;
}
}
$toSetDefault = TRUE;
}
//get the group of contacts as per selected by user in case of Find Activities
if (!empty($form->_activityHolderIds)) {
$contact = $form->get('contacts');
$form->_contactIds = $contact;
}
if (is_array($form->_contactIds) && $toSetDefault) {
$returnProperties = array('sort_name' => 1, 'email' => 1, 'do_not_email' => 1, 'is_deceased' => 1, 'on_hold' => 1, 'display_name' => 1, 'preferred_mail_format' => 1);
list($form->_contactDetails) = CRM_Utils_Token::getTokenDetails($form->_contactIds, $returnProperties, FALSE, FALSE);
// make a copy of all contact details
$form->_allContactDetails = $form->_contactDetails;
foreach ($form->_contactIds as $key => $contactId) {
$value = $form->_contactDetails[$contactId];
if ($value['do_not_email'] || empty($value['email']) || CRM_Utils_Array::value('is_deceased', $value) || $value['on_hold']) {
$suppressedEmails++;
// unset contact details for contacts that we won't be sending email. This is prevent extra computation
// during token evaluation etc.
unset($form->_contactDetails[$contactId]);
} else {
if (empty($form->_toContactEmails)) {
$email = $value['email'];
} else {
$email = $form->_toContactEmails[$key];
}
$toArray[] = array('name' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "{$contactId}::{$email}");
}
}
if (empty($toArray)) {
CRM_Core_Error::statusBounce(ts('Selected contact(s) do not have a valid email address, or communication preferences specify DO NOT EMAIL, or they are deceased or Primary email address is On Hold.'));
}
}
$form->assign('toContact', json_encode($toArray));
$form->assign('suppressedEmails', $suppressedEmails);
$form->assign('totalSelectedContacts', count($form->_contactIds));
$form->add('text', 'subject', ts('Subject'), 'size=50 maxlength=254', TRUE);
$form->add('select', 'fromEmailAddress', ts('From'), $form->_fromEmails, TRUE);
CRM_Mailing_BAO_Mailing::commonCompose($form);
// add attachments
CRM_Core_BAO_File::buildAttachment($form, NULL);
if ($form->_single) {
// also fix the user context stack
if ($form->_caseId) {
$ccid = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseContact', $form->_caseId, 'contact_id', 'case_id');
$url = CRM_Utils_System::url('civicrm/contact/view/case', "&reset=1&action=view&cid={$ccid}&id={$form->_caseId}");
} elseif ($form->_context) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
} else {
$url = CRM_Utils_System::url('civicrm/contact/view', "&show=1&action=browse&cid={$form->_contactIds[0]}&selectedChild=activity");
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
//.........这里部分代码省略.........
示例9: preProcess
//.........这里部分代码省略.........
$this->_currentlyViewedContactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
}
$this->_activityTypeId = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
$this->assign('atype', $this->_activityTypeId);
if (!$this->_activityTypeId && $this->_activityId) {
$this->_activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'activity_type_id');
}
//Assigning Activity type name
if ($this->_activityTypeId) {
require_once 'CRM/Core/OptionGroup.php';
$activityTName = CRM_Core_OptionGroup::values('activity_type', false, false, false, 'AND v.value = ' . $this->_activityTypeId, 'name');
if ($activityTName[$this->_activityTypeId]) {
$this->assign('activityTName', $activityTName[$this->_activityTypeId]);
}
}
//check the mode when this form is called either single or as
//search task action
if ($this->_activityTypeId || $this->_context == 'standalone' || $this->_currentlyViewedContactId) {
$this->_single = true;
$this->assign('urlPath', 'civicrm/activity');
} else {
//set the appropriate action
$advanced = null;
$builder = null;
$session =& CRM_Core_Session::singleton();
$advanced = $session->get('isAdvanced');
$builder = $session->get('isSearchBuilder');
$searchType = "basic";
if ($advanced == 1) {
$this->_action = CRM_Core_Action::ADVANCED;
$searchType = "advanced";
} else {
if ($advanced == 2 && ($builder = 1)) {
$this->_action = CRM_Core_Action::PROFILE;
$searchType = "builder";
} else {
if ($advanced == 3) {
$searchType = "custom";
}
}
}
parent::preProcess();
$this->_single = false;
$this->assign('urlPath', "civicrm/contact/search/{$searchType}");
$this->assign('urlPathVar', "_qf_Activity_display=true&qfKey={$this->controller->_key}");
}
$this->assign('single', $this->_single);
$this->assign('action', $this->_action);
if ($this->_action & CRM_Core_Action::VIEW) {
// get the tree of custom fields
$this->_groupTree =& CRM_Core_BAO_CustomGroup::getTree("Activity", $this, $this->_activityId, 0, $this->_activityTypeId);
}
if ($this->_activityTypeId) {
//set activity type name and description to template
require_once 'CRM/Core/BAO/OptionValue.php';
list($this->_activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($this->_activityTypeId);
$this->assign('activityTypeName', $this->_activityTypeName);
$this->assign('activityTypeDescription', $activityTypeDescription);
}
$url = null;
// set user context
if (in_array($this->_context, array('standalone', 'home', 'search'))) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
} else {
if ($this->_context != 'caseActivity') {
$url = CRM_Utils_System::url('civicrm/contact/view', "action=browse&reset=1&cid={$this->_currentlyViewedContactId}&selectedChild=activity");
}
}
if ($url) {
$session->pushUserContext($url);
}
// hack to retrieve activity type id from post variables
if (!$this->_activityTypeId) {
$this->_activityTypeId = CRM_Utils_Array::value('activity_type_id', $_POST);
}
// when custom data is included in this page
if (CRM_Utils_Array::value("hidden_custom", $_POST)) {
// we need to set it in the session for the below code to work
// CRM-3014
//need to assign custom data subtype to the template
$this->set('type', 'Activity');
$this->set('subType', $this->_activityTypeId);
$this->set('entityId', $this->_activityId);
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
// add attachments part
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_activity', $this->_activityId);
// figure out the file name for activity type, if any
if ($this->_activityTypeId && ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, $this->_crmDir))) {
require_once "CRM/{$this->_crmDir}/Form/Activity/{$this->_activityTypeFile}.php";
$this->assign('activityTypeFile', $this->_activityTypeFile);
$this->assign('crmDir', $this->_crmDir);
}
$this->setFields();
if ($this->_activityTypeFile) {
eval("CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}::preProcess( \$this );");
}
}
示例10: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
$this->add('text', 'subject', ts('Subject:'), array('size' => 20));
$this->add('textarea', 'note', ts('Note:'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Note', 'note'), TRUE);
$this->add('select', 'privacy', ts('Privacy:'), CRM_Core_OptionGroup::values('note_privacy'));
$this->add('hidden', 'parent_id');
// add attachments part
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_note', $this->_id, NULL, TRUE);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例11: wordmailmerge_civicrm_buildForm
function wordmailmerge_civicrm_buildForm($formName, &$form)
{
require_once 'CRM/Core/DAO/MessageTemplate.php';
require_once 'CRM/Core/BAO/File.php';
require_once 'CRM/Core/DAO.php';
if ($formName == 'CRM_Admin_Form_MessageTemplates') {
$action = $form->getVar('_action');
$template = CRM_Core_Smarty::singleton();
$form->assign('action', $action);
$templatePath = realpath(dirname(__FILE__) . "/templates");
$config = CRM_Core_Config::singleton();
if ($action == CRM_Core_Action::UPDATE) {
$msgTemplateId = $form->getVar('_defaultValues')['id'];
$sql = "SELECT * FROM veda_civicrm_wordmailmerge WHERE msg_template_id = %1";
$params = array(1 => array($msgTemplateId, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
while ($dao->fetch()) {
$fileId = $dao->file_id;
}
if (!empty($fileId)) {
$mysql = "SELECT * FROM civicrm_file WHERE id = %1";
$params = array(1 => array($fileId, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($mysql, $params);
while ($dao->fetch()) {
$default['fileID'] = $dao->id;
$default['mime_type'] = $dao->mime_type;
$default['fileName'] = $dao->uri;
$default['cleanName'] = CRM_Utils_File::cleanFileName($dao->uri);
$default['fullPath'] = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $dao->uri;
$default['url'] = CRM_Utils_System::url('civicrm/file', "reset=1&id={$dao->id}&eid={$msgTemplateId}");
$default['href'] = "<a href=\"{$default['url']}\">{$default['cleanName']}</a>";
$default['tag'] = CRM_Core_BAO_EntityTag::getTag($dao->id, 'civicrm_file');
$default['deleteURLArgs'] = CRM_Core_BAO_File::deleteURLArgs('civicrm_msg_template', $msgTemplateId, $dao->id);
}
$defaults[$dao->id] = $default;
$form->assign('defaults', $defaults);
}
}
CRM_Core_BAO_File::buildAttachment($form, 'civicrm_msg_template', '', 1);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'reset=1'));
CRM_Core_Region::instance('page-body')->add(array('template' => "{$templatePath}/CRM/Wordmailmerge/testfield.tpl"));
}
}
示例12: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$session = CRM_Core_Session::singleton();
require_once 'CRM/Core/PseudoConstant.php';
$formEmailAddress = CRM_Core_PseudoConstant::fromEmailAddress('from_email_address');
if (empty($formEmailAddress)) {
//redirect user to enter from email address.
$url = CRM_Utils_System::url('civicrm/admin/options/from_email_address', 'group=from_email_address&action=add&reset=1');
$status = ts("There is no valid from email address present. You can add here <a href='%1'>Add From Email Address.</a>", array(1 => $url));
$session->setStatus($status);
} else {
foreach ($formEmailAddress as $key => $email) {
$formEmailAddress[$key] = htmlspecialchars($formEmailAddress[$key]);
}
}
$this->add('select', 'from_email_address', ts('From Email Address'), array('' => '- select -') + $formEmailAddress, true);
$this->add('text', 'subject', ts('Mailing Subject'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'subject'), true);
$attributes = array('onclick' => "showHideUpload();");
$options = array(ts('Upload Content'), ts('Compose On-screen'));
$this->addRadio('upload_type', ts('I want to'), $options, $attributes, " ");
require_once 'CRM/Mailing/BAO/Mailing.php';
CRM_Mailing_BAO_Mailing::commonCompose($this);
$this->addElement('file', 'textFile', ts('Upload TEXT Message'), 'size=30 maxlength=60');
$this->setMaxFileSize(1024 * 1024);
$this->addRule('textFile', ts('File size should be less than 1 MByte'), 'maxfilesize', 1024 * 1024);
$this->addRule('textFile', ts('File must be in UTF-8 encoding'), 'utf8File');
$this->addElement('file', 'htmlFile', ts('Upload HTML Message'), 'size=30 maxlength=60');
$this->setMaxFileSize(1024 * 1024);
$this->addRule('htmlFile', ts('File size should be less than %1 MByte(s)', array(1 => 1)), 'maxfilesize', 1024 * 1024);
$this->addRule('htmlFile', ts('File must be in UTF-8 encoding'), 'utf8File');
//fix upload files when context is search. CRM-3711
$ssID = $this->get('ssID');
if ($this->_searchBasedMailing && $ssID) {
$this->set('uploadNames', array('textFile', 'htmlFile'));
}
require_once 'CRM/Core/BAO/File.php';
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_mailing', $this->_mailingID);
require_once 'CRM/Mailing/PseudoConstant.php';
$this->add('select', 'header_id', ts('Mailing Header'), array('' => ts('- none -')) + CRM_Mailing_PseudoConstant::component('Header'));
$this->add('select', 'footer_id', ts('Mailing Footer'), array('' => ts('- none -')) + CRM_Mailing_PseudoConstant::component('Footer'));
$this->addFormRule(array('CRM_Mailing_Form_Upload', 'formRule'), $this);
//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' => 'back', 'name' => ts('<< Previous')), array('type' => 'upload', 'name' => ts('Next >>'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'upload', 'name' => ts('Save & Continue Later'), 'subName' => 'save'), array('type' => 'cancel', 'name' => ts('Cancel')));
if ($this->_searchBasedMailing && $ssID) {
$buttons = array(array('type' => 'back', 'name' => ts('<< Previous')), array('type' => 'upload', 'name' => ts('Next >>'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')));
}
$this->addButtons($buttons);
}
示例13: preProcess
//.........这里部分代码省略.........
$this->_action = CRM_Core_Action::PROFILE;
break;
case 'custom':
$this->_action = CRM_Core_Action::COPY;
$searchType = $seachPath;
break;
}
parent::preProcess();
$this->_single = false;
$this->assign('urlPath', "civicrm/contact/search/{$searchType}");
$this->assign('urlPathVar', "_qf_Activity_display=true&qfKey={$this->controller->_key}");
}
$this->assign('single', $this->_single);
$this->assign('action', $this->_action);
if ($this->_action & CRM_Core_Action::VIEW) {
// get the tree of custom fields
$this->_groupTree =& CRM_Core_BAO_CustomGroup::getTree('Activity', $this, $this->_activityId, 0, $this->_activityTypeId);
}
if ($this->_activityTypeId) {
//set activity type name and description to template
require_once 'CRM/Core/BAO/OptionValue.php';
list($this->_activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($this->_activityTypeId);
$this->assign('activityTypeName', $this->_activityTypeName);
$this->assign('activityTypeDescription', $activityTypeDescription);
}
// set user context
$urlParams = $urlString = null;
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
//validate the qfKey
require_once 'CRM/Utils/Rule.php';
if (!CRM_Utils_Rule::qfKey($qfKey)) {
$qfKey = null;
}
if ($this->_context == 'fulltext') {
$keyName = '&qfKey';
$urlParams = 'force=1';
$urlString = 'civicrm/contact/search/custom';
if ($this->_action == CRM_Core_Action::UPDATE) {
$keyName = '&key';
$urlParams .= '&context=fulltext&action=view';
$urlString = 'civicrm/contact/view/activity';
}
if ($qfKey) {
$urlParams .= "{$keyName}={$qfKey}";
}
$this->assign('searchKey', $qfKey);
} else {
if (in_array($this->_context, array('standalone', 'home'))) {
$urlParams = 'reset=1';
$urlString = 'civicrm/dashboard';
} else {
if ($this->_context == 'search') {
$urlParams = 'force=1';
if ($qfKey) {
$urlParams .= "&qfKey={$qfKey}";
}
if ($this->_compContext == 'advanced') {
$urlString = 'civicrm/contact/search/advanced';
}
$this->assign('searchKey', $qfKey);
} else {
if ($this->_context != 'caseActivity') {
$urlParams = "action=browse&reset=1&cid={$this->_currentlyViewedContactId}&selectedChild=activity";
$urlString = 'civicrm/contact/view';
}
}
}
}
if ($urlString) {
$session->pushUserContext(CRM_Utils_System::url($urlString, $urlParams));
}
// hack to retrieve activity type id from post variables
if (!$this->_activityTypeId) {
$this->_activityTypeId = CRM_Utils_Array::value('activity_type_id', $_POST);
}
// when custom data is included in this page
if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
// we need to set it in the session for the below code to work
// CRM-3014
//need to assign custom data subtype to the template
$this->set('type', 'Activity');
$this->set('subType', $this->_activityTypeId);
$this->set('entityId', $this->_activityId);
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
// add attachments part
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_activity', $this->_activityId);
// figure out the file name for activity type, if any
if ($this->_activityTypeId && ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, $this->_crmDir))) {
require_once "CRM/{$this->_crmDir}/Form/Activity/{$this->_activityTypeFile}.php";
$this->assign('activityTypeFile', $this->_activityTypeFile);
$this->assign('crmDir', $this->_crmDir);
}
$this->setFields();
if ($this->_activityTypeFile) {
eval("CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}::preProcess( \$this );");
}
}
示例14: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
$session = CRM_Core_Session::singleton();
$config = CRM_Core_Config::singleton();
$options = array();
$tempVar = FALSE;
// this seems so hacky, not sure what we are doing here and why. Need to investigate and fix
$session->getVars($options, "CRM_Mailing_Controller_Send_{$this->controller->_key}");
$fromEmailAddress = CRM_Core_OptionGroup::values('from_email_address');
if (empty($fromEmailAddress)) {
//redirect user to enter from email address.
$url = CRM_Utils_System::url('civicrm/admin/options/from_email_address', 'action=add&reset=1');
$status = ts("There is no valid from email address present. You can add here <a href='%1'>Add From Email Address.</a>", array(1 => $url));
$session->setStatus($status, ts('Notice'));
} else {
foreach ($fromEmailAddress as $key => $email) {
$fromEmailAddress[$key] = htmlspecialchars($fromEmailAddress[$key]);
}
}
$this->add('select', 'from_email_address', ts('From Email Address'), array('' => '- select -') + $fromEmailAddress, TRUE);
//Added code to add custom field as Reply-To on form when it is enabled from Mailer settings
if ((int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'replyTo') && empty($options['override_verp'])) {
$this->add('select', 'reply_to_address', ts('Reply-To'), array('' => '- select -') + $fromEmailAddress);
} elseif (!empty($options['override_verp'])) {
$trackReplies = TRUE;
$this->assign('trackReplies', $trackReplies);
}
$this->add('text', 'subject', ts('Mailing Subject'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'subject'), TRUE);
$attributes = array('onclick' => "showHideUpload();");
$options = array(ts('Upload Content'), ts('Compose On-screen'));
$this->addRadio('upload_type', ts('I want to'), $options, $attributes, " ");
CRM_Mailing_BAO_Mailing::commonCompose($this);
$this->addElement('file', 'textFile', ts('Upload TEXT Message'), 'size=30 maxlength=60');
$this->addUploadElement('textFile');
$this->setMaxFileSize(1024 * 1024);
$this->addRule('textFile', ts('File size should be less than 1 MByte'), 'maxfilesize', 1024 * 1024);
$this->addRule('textFile', ts('File must be in UTF-8 encoding'), 'utf8File');
$this->addElement('file', 'htmlFile', ts('Upload HTML Message'), 'size=30 maxlength=60');
$this->addUploadElement('htmlFile');
$this->setMaxFileSize(1024 * 1024);
$this->addRule('htmlFile', ts('File size should be less than %1 MByte(s)', array(1 => 1)), 'maxfilesize', 1024 * 1024);
$this->addRule('htmlFile', ts('File must be in UTF-8 encoding'), 'utf8File');
//fix upload files when context is search. CRM-3711
$ssID = $this->get('ssID');
if ($this->_searchBasedMailing && $ssID) {
$this->set('uploadNames', array('textFile', 'htmlFile'));
}
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_mailing', $this->_mailingID);
$this->add('select', 'header_id', ts('Mailing Header'), array('' => ts('- none -')) + CRM_Mailing_PseudoConstant::component('Header'));
$this->add('select', 'footer_id', ts('Mailing Footer'), array('' => ts('- none -')) + CRM_Mailing_PseudoConstant::component('Footer'));
$this->addFormRule(array('CRM_Mailing_Form_Upload', 'formRule'), $this);
$buttons = array(array('type' => 'back', 'name' => ts('Previous')), array('type' => 'upload', 'name' => ts('Next'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'upload', 'name' => ts('Save & Continue Later'), 'subName' => 'save'), array('type' => 'cancel', 'name' => ts('Cancel')));
$this->addButtons($buttons);
}
示例15: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
$this->add('text', 'pcp_title', ts('Title'), NULL, TRUE);
$this->add('textarea', 'pcp_intro_text', ts('Welcome'), NULL, TRUE);
$this->add('text', 'goal_amount', ts('Your Goal'), NULL, TRUE);
$this->addRule('goal_amount', ts('Goal Amount should be a numeric value'), 'money');
$attributes = array();
if ($this->_component == 'event') {
if ($this->get('action') & CRM_Core_Action::ADD) {
$attributes = array('value' => ts('Join Us'), 'onClick' => 'select();');
}
$this->add('text', 'donate_link_text', ts('Sign up Button'), $attributes);
} else {
if ($this->get('action') & CRM_Core_Action::ADD) {
$attributes = array('value' => ts('Donate Now'), 'onClick' => 'select();');
}
$this->add('text', 'donate_link_text', ts('Donation Button'), $attributes);
}
$attrib = array('rows' => 8, 'cols' => 60);
$this->add('textarea', 'page_text', ts('Your Message'), null, false);
$maxAttachments = 1;
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_pcp', $this->_pageId, $maxAttachments);
//MV: added the custom fields in PCP form
if (CRM_Core_Permission::check('administer CiviCRM')) {
CRM_Custom_Form_CustomData::buildQuickForm($this);
}
//end
$this->addElement('checkbox', 'is_thermometer', ts('Progress Bar'));
$this->addElement('checkbox', 'is_honor_roll', ts('Honor Roll'), NULL);
$this->addElement('checkbox', 'is_active', ts('Active'));
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->addFormRule(array('CRM_PCP_Form_Campaign', 'formRule'), $this);
}