/**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     $this->addElement('text', 'api_key', ts('API Key'), array('size' => 48));
     $status = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
     foreach ($status as $id => $Name) {
         $this->addElement('checkbox', "participant_status_id[{$id}]", NULL, $Name);
     }
     $accessToken = CRM_Core_BAO_Setting::getItem(self::WEBINAR_SETTING_GROUP, 'access_token', NULL, FALSE);
     $organizerKey = CRM_Core_BAO_Setting::getItem(self::WEBINAR_SETTING_GROUP, 'organizer_key', NULL, FALSE);
     if ($accessToken && $organizerKey) {
         $upcomingWebinars = CRM_Gotowebinar_Form_Setting::findUpcomingWebinars();
         if (isset($upcomingWebinars['int_err_code']) and $upcomingWebinars['int_err_code'] != '') {
             $this->assign('error', $upcomingWebinars);
         } else {
             $this->assign('responseKey', TRUE);
             $this->assign('upcomingWebinars', $upcomingWebinars);
             $buttons = array(array('type' => 'submit', 'name' => ts('Save Status')));
             $this->addButtons($buttons);
         }
     } else {
         $this->add('text', "email_address", ts('Email Address'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', 'email'), TRUE);
         $this->add('text', "password", ts('Password'), array('size' => 48), TRUE);
         $buttons = array(array('type' => 'submit', 'name' => ts('Connect To My GoToWebinar')));
         // Add the Buttons.
         $this->addButtons($buttons);
         $this->assign('initial', TRUE);
     }
 }
 /**
  * Build the form object.
  *
  *
  * @return void
  */
 public function buildQuickForm()
 {
     if ($this->_search) {
         return;
     }
     $attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey');
     $this->add('text', 'petition_title', ts('Title'), $attributes['title']);
     //campaigns
     $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
     $this->add('select', 'petition_campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns);
     $this->set('petitionCampaigns', $campaigns);
     $this->assign('petitionCampaigns', json_encode($campaigns));
     //build the array of all search params.
     $this->_searchParams = array();
     foreach ($this->_elements as $element) {
         $name = $element->_attributes['name'];
         $label = $element->_label;
         if ($name == 'qfKey') {
             continue;
         }
         $this->_searchParams[$name] = $label ? $label : $name;
     }
     $this->set('searchParams', $this->_searchParams);
     $this->assign('searchParams', json_encode($this->_searchParams));
 }
示例#3
0
 /**
  * Build the form - it consists of
  *    - displaying the QILL (query in local language)
  *    - displaying elements for saving the search
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Smart Group'));
     require_once "CRM/Event/BAO/Query.php";
     // get the qill
     $query =& new CRM_Event_BAO_Query($this->get('formValues'));
     $qill = $query->qill();
     // need to save qill for the smarty template
     $this->assign('qill', $qill);
     // the name and description are actually stored with the group and not the saved search
     $this->add('text', 'title', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), true);
     $this->addElement('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
     // get the group id for the saved search
     $groupId = null;
     if (isset($this->_id)) {
         $params = array('saved_search_id' => $this->_id);
         require_once "CRM/Contact/BAO/Group.php";
         CRM_Contact_BAO_Group::retrieve($params, $values);
         $groupId = $values['id'];
         $this->addDefaultButtons(ts('Update Smart Group'));
     } else {
         $this->addDefaultButtons(ts('Save Smart Group'));
     }
     $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $groupId, 'title'));
 }
 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     if ($this->_id) {
         $name = $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'name'));
         $name->freeze();
         $this->assign('id', $this->_id);
     }
     $this->add('text', 'label', ts('Label'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'label'), TRUE);
     $this->addRule('label', ts('A membership status with this label already exists. Please select another label.'), 'objectExists', array('CRM_Member_DAO_MembershipStatus', $this->_id, 'name'));
     $this->add('select', 'start_event', ts('Start Event'), CRM_Core_SelectValues::eventDate(), TRUE);
     $this->add('select', 'start_event_adjust_unit', ts('Start Event Adjustment'), array('' => ts('- select -')) + CRM_Core_SelectValues::unitList());
     $this->add('text', 'start_event_adjust_interval', ts('Start Event Adjust Interval'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'start_event_adjust_interval'));
     $this->add('select', 'end_event', ts('End Event'), array('' => ts('- select -')) + CRM_Core_SelectValues::eventDate());
     $this->add('select', 'end_event_adjust_unit', ts('End Event Adjustment'), array('' => ts('- select -')) + CRM_Core_SelectValues::unitList());
     $this->add('text', 'end_event_adjust_interval', ts('End Event Adjust Interval'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'end_event_adjust_interval'));
     $this->add('checkbox', 'is_current_member', ts('Current Membership?'));
     $this->add('checkbox', 'is_admin', ts('Administrator Only?'));
     $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'weight'));
     $this->add('checkbox', 'is_default', ts('Default?'));
     $this->add('checkbox', 'is_active', ts('Enabled?'));
 }
示例#5
0
 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'label_a_b', ts('Relationship Label-A to B'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'label_a_b'), true);
     $this->addRule('label_a_b', ts('Label already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'label_a_b'));
     $this->add('text', 'label_b_a', ts('Relationship Label-B to A'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'label_b_a'));
     $this->addRule('label_b_a', ts('Label already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'label_b_a'));
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'description'));
     require_once 'CRM/Contact/BAO/ContactType.php';
     $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
     // add select for contact type
     $contactTypeA =& $this->add('select', 'contact_types_a', ts('Contact Type A') . ' ', array('' => ts('- select -')) + $contactTypes);
     $contactTypeB =& $this->add('select', 'contact_types_b', ts('Contact Type B') . ' ', array('' => ts('- select -')) + $contactTypes);
     $isActive =& $this->add('checkbox', 'is_active', ts('Enabled?'));
     //only selected field should be allow for edit, CRM-4888
     if ($this->_id && CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $this->_id, 'is_reserved')) {
         foreach (array('contactTypeA', 'contactTypeB', 'isActive') as $field) {
             ${$field}->freeze();
         }
     }
     if ($this->_action & CRM_Core_Action::VIEW) {
         $this->freeze();
         $url = CRM_Utils_System::url('civicrm/admin/reltype&reset=1');
         $location = "window.location='{$url}'";
         $this->addElement('button', 'done', ts('Done'), array('onclick' => $location));
     }
 }
示例#6
0
 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->setPageTitle(ts('Mail Account'));
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     //get the attributes.
     $attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_MailSettings');
     //build setting form
     $this->add('text', 'name', ts('Name'), $attributes['name'], TRUE);
     $this->add('text', 'domain', ts('Email Domain'), $attributes['domain'], TRUE);
     $this->addRule('domain', ts('Email domain must use a valid internet domain format (e.g. \'example.org\').'), 'domain');
     $this->add('text', 'localpart', ts('Localpart'), $attributes['localpart']);
     $this->add('text', 'return_path', ts('Return-Path'), $attributes['return_path']);
     $this->addRule('return_path', ts('Return-Path must use a valid email address format.'), 'email');
     $this->add('select', 'protocol', ts('Protocol'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol'), TRUE);
     $this->add('text', 'server', ts('Server'), $attributes['server']);
     $this->add('text', 'username', ts('Username'), array('autocomplete' => 'off'));
     $this->add('password', 'password', ts('Password'), array('autocomplete' => 'off'));
     $this->add('text', 'source', ts('Source'), $attributes['source']);
     $this->add('checkbox', 'is_ssl', ts('Use SSL?'));
     $usedfor = array(1 => ts('Bounce Processing'), 0 => ts('Email-to-Activity Processing'));
     $this->add('select', 'is_default', ts('Used For?'), $usedfor);
 }
示例#7
0
 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->setPageTitle(ts('Location Type'));
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_LocationType', 'name'), TRUE);
     $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_LocationType', $this->_id));
     $this->addRule('name', ts('Name can only consist of alpha-numeric characters'), 'variable');
     $this->add('text', 'display_name', ts('Display Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_LocationType', 'display_name'), TRUE);
     $this->add('text', 'vcard_name', ts('vCard Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_LocationType', 'vcard_name'));
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_LocationType', 'description'));
     $this->add('checkbox', 'is_active', ts('Enabled?'));
     $this->add('checkbox', 'is_default', ts('Default?'));
     if ($this->_action & CRM_Core_Action::UPDATE) {
         if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_reserved')) {
             $this->freeze(array('name', 'description', 'is_active'));
         }
         if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_default')) {
             $this->freeze(array('is_default'));
         }
     }
 }
 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if ($this->_id) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'name');
         CRM_Utils_System::setTitle($this->_title . ' - ' . ts('Financial Type'));
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'name'), TRUE);
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'description'));
     $this->add('checkbox', 'is_deductible', ts('Tax-Deductible?'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'is_deductible'));
     $this->add('checkbox', 'is_active', ts('Enabled?'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'is_active'));
     $this->add('checkbox', 'is_reserved', ts('Reserved?'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'is_reserved'));
     if ($this->_action == CRM_Core_Action::UPDATE) {
         $this->assign('aid', $this->_id);
     }
     if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'is_reserved', 'vid')) {
         $this->freeze(array('is_active'));
     }
     //$this->addFormRule( array( 'CRM_Financial_Form_FinancialType', 'formRule'), $this );
 }
示例#9
0
 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         CRM_Core_BAO_Navigation::retrieve($params, $this->_defaults);
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'label', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'label'), true);
     $this->add('text', 'url', ts('Url'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'url'));
     require_once 'CRM/Core/Permission.php';
     $permissions = CRM_Core_Permission::basicPermissions(true);
     $include =& $this->addElement('advmultiselect', 'permission', ts('Permission') . ' ', $permissions, array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect'));
     $include->setButtonAttributes('add', array('value' => ts('Add >>')));
     $include->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $operators = array('AND' => 'AND', 'OR' => 'OR');
     $this->add('select', 'permission_operator', ts('Operator'), $operators);
     $this->add('checkbox', 'has_separator', ts('Separator?'));
     $active = $this->add('checkbox', 'is_active', ts('Enabled?'));
     if ($this->_defaults['name'] == 'Home') {
         $active->freeze();
     } else {
         $parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
         if (isset($this->_id)) {
             unset($parentMenu[$this->_id]);
         }
         // also unset home.
         $homeMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Home', 'id', 'name');
         unset($parentMenu[$homeMenuId]);
         $parent = $this->add('select', 'parent_id', ts('Parent'), array('' => ts('-- select --')) + $parentMenu);
     }
 }
示例#10
0
 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     //get the attributes.
     $attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_MailSettings');
     //build setting form
     $this->add('text', 'name', ts('Name'), $attributes['name'], true);
     $this->add('text', 'domain', ts('Email Domain'), $attributes['domain'], true);
     $this->addRule('domain', ts('Email domain must use a valid internet domain format (e.g. \'example.org\').'), 'domain');
     $this->add('text', 'localpart', ts('Localpart'), $attributes['localpart']);
     $this->add('text', 'return_path', ts('Return-Path'), $attributes['return_path']);
     $this->addRule('return_path', ts('Return-Path must use a valid email address format.'), 'email');
     require_once 'CRM/Core/PseudoConstant.php';
     $this->add('select', 'protocol', ts('Protocol'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::mailProtocol(), true);
     $this->add('text', 'server', ts('Server'), $attributes['server']);
     $this->add('text', 'username', ts('Username'), array('autocomplete' => 'off'));
     $this->add('password', 'password', ts('Password'), array('autocomplete' => 'off'));
     $this->add('text', 'source', ts('Source'), $attributes['source']);
     $this->add('checkbox', 'is_ssl', ts('Use SSL?'));
     $this->add('checkbox', 'is_default', ts('Default Option?'));
 }
示例#11
0
 /**
  * Build the form object.
  *
  * It consists of
  *    - displaying the QILL (query in local language)
  *    - displaying elements for saving the search
  */
 public function buildQuickForm()
 {
     // @todo sync this more with CRM_Group_Form_Edit.
     $query = new CRM_Contact_BAO_Query($this->get('queryParams'));
     $this->assign('qill', $query->qill());
     // Values from the search form
     $formValues = $this->controller->exportValues();
     // the name and description are actually stored with the group and not the saved search
     $this->add('text', 'title', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), TRUE);
     $this->addElement('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
     $groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE);
     unset($groupTypes['Access Control']);
     if (!CRM_Core_Permission::access('CiviMail')) {
         $isWorkFlowEnabled = CRM_Mailing_Info::workflowEnabled();
         if ($isWorkFlowEnabled && !CRM_Core_Permission::check('create mailings') && !CRM_Core_Permission::check('schedule mailings') && !CRM_Core_Permission::check('approve mailings')) {
             unset($groupTypes['Mailing List']);
         }
     }
     if (!empty($groupTypes)) {
         $this->addCheckBox('group_type', ts('Group Type'), $groupTypes, NULL, NULL, NULL, NULL, '&nbsp;&nbsp;&nbsp;');
     }
     //CRM-14190
     CRM_Group_Form_Edit::buildParentGroups($this);
     // get the group id for the saved search
     $groupID = NULL;
     if (isset($this->_id)) {
         $groupID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $this->_id, 'id', 'saved_search_id');
         $this->addDefaultButtons(ts('Update Smart Group'));
     } else {
         $this->addDefaultButtons(ts('Save Smart Group'));
         $this->assign('partiallySelected', $formValues['radio_ts'] != 'ts_all');
     }
     $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $groupID, 'title'));
 }
示例#12
0
 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'name'), true);
     $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_OptionGroup', $this->_id));
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'description'));
     $element = $this->add('checkbox', 'is_active', ts('Enabled?'));
     if ($this->_action & CRM_Core_Action::UPDATE) {
         if (in_array($this->_values['name'], array('encounter_medium', 'case_type', 'case_status'))) {
             static $caseCount = null;
             require_once 'CRM/Case/BAO/Case.php';
             if (!isset($caseCount)) {
                 $caseCount = CRM_Case_BAO_Case::caseCount(null, false);
             }
             if ($caseCount > 0) {
                 $element->freeze();
             }
         }
         if ($this->_values['is_reserved']) {
             $this->freeze(array('name', 'description', 'is_active'));
         }
     }
     $this->assign('id', $this->_id);
 }
示例#13
0
文件: Tag.php 项目: bhirsch/voipdev
 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_action == CRM_Core_Action::DELETE) {
         if ($this->_id && ($tag = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Tag', $this->_id, 'name', 'parent_id'))) {
             CRM_Core_Session::setStatus(ts("This tag cannot be deleted! You must Delete all its child tags ('%1', etc) prior to deleting this tag.", array(1 => $tag)));
             $url = CRM_Utils_System::url('civicrm/admin/tag', "reset=1");
             CRM_Utils_System::redirect($url);
             return true;
         } else {
             $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         }
     } else {
         $this->applyFilter('__ALL__', 'trim');
         $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'name'), true);
         $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Tag', $this->_id));
         $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'description'));
         //@lobo haven't a clue why the checkbox isn't displayed (it should be checked by default
         $this->add('checkbox', 'is_selectable', ts("If it's a tag or a category"));
         $allTag = array('' => '- ' . ts('select') . ' -') + CRM_Core_PseudoConstant::tag();
         if ($this->_id) {
             unset($allTag[$this->_id]);
         }
         $this->add('select', 'parent_id', ts('Parent Tag'), $allTag);
         parent::buildQuickForm();
     }
 }
 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     $this->addElement('checkbox', 'premiums_active', ts('Premiums Section Enabled?'), NULL, array('onclick' => "premiumBlock(this);"));
     $this->addElement('text', 'premiums_intro_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium', 'premiums_intro_title'));
     $this->add('textarea', 'premiums_intro_text', ts('Introductory Message'), 'rows=5, cols=50');
     $this->add('text', 'premiums_contact_email', ts('Contact Email') . ' ', CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium', 'premiums_contact_email'));
     $this->addRule('premiums_contact_email', ts('Please enter a valid email address for Contact Email') . ' ', 'email');
     $this->add('text', 'premiums_contact_phone', ts('Contact Phone'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium', 'premiums_contact_phone'));
     $this->addRule('premiums_contact_phone', ts('Please enter a valid phone number.'), 'phone');
     $this->addElement('checkbox', 'premiums_display_min_contribution', ts('Display Minimum Contribution Amount?'));
     $showForm = TRUE;
     if ($this->_single) {
         if ($this->_id) {
             $daoPremium = new CRM_Contribute_DAO_Premium();
             $daoPremium->entity_id = $this->_id;
             $daoPremium->entity_table = 'civicrm_contribution_page';
             $daoPremium->premiums_active = 1;
             if ($daoPremium->find(TRUE)) {
                 $showForm = FALSE;
             }
         }
     }
     $this->assign('showForm', $showForm);
     parent::buildQuickForm();
     $premiumPage = new CRM_Contribute_Page_Premium();
     $premiumPage->browse();
 }
示例#15
0
 public function buildQuickForm()
 {
     $parent = $this->controller->getParent();
     $nameTextLabel = $parent->_sms ? ts('SMS Name') : ts('Mailing Name');
     $this->add('text', 'mailing_name', $nameTextLabel, CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'title'));
     CRM_Core_Form_Date::buildDateRange($this, 'mailing', 1, '_from', '_to', ts('From'), FALSE);
     $this->add('text', 'sort_name', ts('Created or Sent by'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($this);
     // CRM-15434 - Fix mailing search by status in non-English languages
     $statusVals = CRM_Core_SelectValues::getMailingJobStatus();
     foreach ($statusVals as $statusId => $statusName) {
         $this->addElement('checkbox', "mailing_status[{$statusId}]", NULL, $statusName);
     }
     $this->addElement('checkbox', 'status_unscheduled', NULL, ts('Draft / Unscheduled'));
     $this->addYesNo('is_archived', ts('Mailing is Archived'), TRUE);
     // Search by language, if multi-lingual
     $enabledLanguages = CRM_Core_I18n::languages(TRUE);
     if (count($enabledLanguages) > 1) {
         $this->addElement('select', 'language', ts('Language'), array('' => ts('- all languages -')) + $enabledLanguages, array('class' => 'crm-select2'));
     }
     if ($parent->_sms) {
         $this->addElement('hidden', 'sms', $parent->_sms);
     }
     $this->add('hidden', 'hidden_find_mailings', 1);
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
 }
示例#16
0
文件: Search.php 项目: kidaa30/yes
 public function buildQuickForm()
 {
     $this->add('text', 'title', ts('Find'), CRM_Core_DAO::getAttribute('CRM_Batch_DAO_Batch', 'title'));
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
     parent::buildQuickForm();
     $this->assign('suppressForm', TRUE);
 }
示例#17
0
文件: Phone.php 项目: hguru/224Civi
 /**
  * build the form elements for a phone object
  *
  * @param CRM_Core_Form $form       reference to the form object
  * @param int           $addressBlockCount block number to build
  * @param boolean       $blockEdit         is it block edit
  *
  * @return void
  * @access public
  * @static
  */
 static function buildQuickForm(&$form, $addressBlockCount = NULL, $blockEdit = FALSE)
 {
     // passing this via the session is AWFUL. we need to fix this
     if (!$addressBlockCount) {
         $blockId = $form->get('Phone_Block_Count') ? $form->get('Phone_Block_Count') : 1;
     } else {
         $blockId = $addressBlockCount;
     }
     $form->applyFilter('__ALL__', 'trim');
     //phone type select
     $form->addElement('select', "phone[{$blockId}][phone_type_id]", ts('Phone'), CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'));
     //main phone number with crm_phone class
     $form->addElement('text', "phone[{$blockId}][phone]", ts('Phone'), array_merge(CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'), array('class' => 'crm_phone twelve')));
     // phone extension
     $form->addElement('text', "phone[{$blockId}][phone_ext]", ts('Extension'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone_ext'));
     if (isset($form->_contactType) || $blockEdit) {
         //Block type select
         $form->addElement('select', "phone[{$blockId}][location_type_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'));
         //is_Primary radio
         $js = array('id' => 'Phone_' . $blockId . '_IsPrimary', 'onClick' => 'singleSelect( this.id );');
         $form->addElement('radio', "phone[{$blockId}][is_primary]", '', '', '1', $js);
     }
     // TODO: set this up as a group, we need a valid phone_type_id if we have a  phone number
     // $form->addRule( "location[$locationId][phone][$locationId][phone]", ts('Phone number is not valid.'), 'phone' );
 }
 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->setPageTitle(ts('Relationship Type'));
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'label_a_b', ts('Relationship Label-A to B'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'label_a_b'), TRUE);
     $this->addRule('label_a_b', ts('Label already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'label_a_b'));
     $this->add('text', 'label_b_a', ts('Relationship Label-B to A'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'label_b_a'));
     $this->addRule('label_b_a', ts('Label already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'label_b_a'));
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'description'));
     $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, '__');
     // add select for contact type
     $contactTypeA =& $this->add('select', 'contact_types_a', ts('Contact Type A') . ' ', array('' => ts('All Contacts')) + $contactTypes);
     $contactTypeB =& $this->add('select', 'contact_types_b', ts('Contact Type B') . ' ', array('' => ts('All Contacts')) + $contactTypes);
     $isActive =& $this->add('checkbox', 'is_active', ts('Enabled?'));
     //only selected field should be allow for edit, CRM-4888
     if ($this->_id && CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $this->_id, 'is_reserved')) {
         foreach (array('contactTypeA', 'contactTypeB', 'isActive') as $field) {
             ${$field}->freeze();
         }
     }
     if ($this->_action & CRM_Core_Action::VIEW) {
         $this->freeze();
     }
 }
示例#19
0
 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     CRM_Utils_System::setTitle(ts('Dropdown Options'));
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'name'), TRUE);
     $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_OptionGroup', $this->_id));
     $this->add('text', 'title', ts('Group Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'title'));
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'description'));
     $element = $this->add('checkbox', 'is_active', ts('Enabled?'));
     if ($this->_action & CRM_Core_Action::UPDATE) {
         if (in_array($this->_values['name'], array('encounter_medium', 'case_type', 'case_status'))) {
             static $caseCount = NULL;
             if (!isset($caseCount)) {
                 $caseCount = CRM_Case_BAO_Case::caseCount(NULL, FALSE);
             }
             if ($caseCount > 0) {
                 $element->freeze();
             }
         }
         if (!empty($this->_values['is_reserved'])) {
             $this->freeze(array('name', 'is_active'));
         }
     }
     $this->assign('id', $this->_id);
 }
示例#20
0
 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium');
     $this->addElement('checkbox', 'premiums_active', ts('Premiums Section Enabled?'), NULL);
     $this->addElement('text', 'premiums_intro_title', ts('Title'), $attributes['premiums_intro_title']);
     $this->add('textarea', 'premiums_intro_text', ts('Introductory Message'), 'rows=5, cols=50');
     $this->add('text', 'premiums_contact_email', ts('Contact Email') . ' ', $attributes['premiums_contact_email']);
     $this->addRule('premiums_contact_email', ts('Please enter a valid email address for Contact Email') . ' ', 'email');
     $this->add('text', 'premiums_contact_phone', ts('Contact Phone'), $attributes['premiums_contact_phone']);
     $this->addRule('premiums_contact_phone', ts('Please enter a valid phone number.'), 'phone');
     $this->addElement('checkbox', 'premiums_display_min_contribution', ts('Display Minimum Contribution Amount?'));
     // CRM-10999 Control label and position for No Thank-you radio button
     $this->add('text', 'premiums_nothankyou_label', ts('No Thank-you Label'), $attributes['premiums_nothankyou_label']);
     $positions = array(1 => ts('Before Premiums'), 2 => ts('After Premiums'));
     $this->add('select', 'premiums_nothankyou_position', ts('No Thank-you Option'), $positions);
     $showForm = TRUE;
     if ($this->_single) {
         if ($this->_id) {
             $daoPremium = new CRM_Contribute_DAO_Premium();
             $daoPremium->entity_id = $this->_id;
             $daoPremium->entity_table = 'civicrm_contribution_page';
             $daoPremium->premiums_active = 1;
             if ($daoPremium->find(TRUE)) {
                 $showForm = FALSE;
             }
         }
     }
     $this->assign('showForm', $showForm);
     parent::buildQuickForm();
     $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Premium', 'formRule'), $this);
     $premiumPage = new CRM_Contribute_Page_Premium();
     $premiumPage->browse();
 }
示例#21
0
 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         $formatName = CRM_Core_BAO_PdfFormat::getFieldValue('CRM_Core_BAO_PdfFormat', $this->_id, 'name');
         $this->assign('formatName', $formatName);
         return;
     }
     $attributes = CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat');
     $this->add('text', 'name', ts('Name'), $attributes['name'], TRUE);
     $this->add('text', 'description', ts('Description'), array('size' => CRM_Utils_Type::HUGE));
     $this->add('checkbox', 'is_default', ts('Is this PDF Page Format the default?'));
     $this->add('select', 'paper_size', ts('Paper Size'), array(0 => ts('- default -')) + CRM_Core_BAO_PaperSize::getList(TRUE), FALSE, array('onChange' => "selectPaper( this.value );"));
     $this->add('static', 'paper_dimensions', NULL, ts('Width x Height'));
     $this->add('select', 'orientation', ts('Orientation'), CRM_Core_BAO_PdfFormat::getPageOrientations(), FALSE, array('onChange' => "updatePaperDimensions();"));
     $this->add('select', 'metric', ts('Unit of Measure'), CRM_Core_BAO_PdfFormat::getUnits(), FALSE, array('onChange' => "selectMetric( this.value );"));
     $this->add('text', 'margin_left', ts('Left Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
     $this->add('text', 'margin_right', ts('Right Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
     $this->add('text', 'margin_top', ts('Top Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
     $this->add('text', 'margin_bottom', ts('Bottom Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
     $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat', 'weight'), TRUE);
     $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_BAO_PdfFormat', $this->_id));
     $this->addRule('margin_left', ts('Margin must be numeric'), 'numeric');
     $this->addRule('margin_right', ts('Margin must be numeric'), 'numeric');
     $this->addRule('margin_top', ts('Margin must be numeric'), 'numeric');
     $this->addRule('margin_bottom', ts('Margin must be numeric'), 'numeric');
     $this->addRule('weight', ts('Weight must be integer'), 'integer');
 }
示例#22
0
 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     require_once 'CRM/Utils/Money.php';
     $this->_first = true;
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage');
     // name
     $this->add('text', 'title', ts('Title'), $attributes['title'], true);
     $this->add('select', 'contribution_type_id', ts('Contribution Type'), CRM_Contribute_PseudoConstant::contributionType(), true);
     $this->addWysiwyg('intro_text', ts('Introductory Message'), $attributes['intro_text']);
     $this->addWysiwyg('footer_text', ts('Footer Message'), $attributes['footer_text']);
     // is on behalf of an organization ?
     $this->addElement('checkbox', 'is_organization', ts('Allow individuals to contribute and / or signup for membership on behalf of an organization?'), null, array('onclick' => "showHideByValue('is_organization',true,'for_org_text','table-row','radio',false);showHideByValue('is_organization',true,'for_org_option','table-row','radio',false);"));
     $options = array();
     $options[] = HTML_QuickForm::createElement('radio', null, null, ts('Optional'), 1);
     $options[] = HTML_QuickForm::createElement('radio', null, null, ts('Required'), 2);
     $this->addGroup($options, 'is_for_organization', ts(''));
     $this->add('textarea', 'for_organization', ts('On behalf of Label'), $attributes['for_organization']);
     // collect goal amount
     $this->add('text', 'goal_amount', ts('Goal Amount'), array('size' => 8, 'maxlength' => 12));
     $this->addRule('goal_amount', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
     // is this page active ?
     $this->addElement('checkbox', 'is_active', ts('Is this Online Contribution Page Active?'));
     // should the honor be enabled
     $this->addElement('checkbox', 'honor_block_is_active', ts('Honoree Section Enabled'), null, array('onclick' => "showHonor()"));
     $this->add('text', 'honor_block_title', ts('Honoree Section Title'), $attributes['honor_block_title']);
     $this->add('textarea', 'honor_block_text', ts('Honoree Introductory Message'), $attributes['honor_block_text']);
     // add optional start and end dates
     $this->addDateTime('start_date', ts('Start Date'));
     $this->addDateTime('end_date', ts('End Date'));
     $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Settings', 'formRule'));
     parent::buildQuickForm();
 }
示例#23
0
 /**
  * This function provides the HTML form elements that are specific to the Individual Contact Type
  * 
  * @access public
  * @return None 
  */
 function buildQuickForm(&$form)
 {
     $form->applyFilter('__ALL__', 'trim');
     // prefix
     $form->addElement('select', 'prefix_id', ts('Prefix'), array('' => ts('- prefix -')) + CRM_Core_PseudoConstant::individualPrefix());
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Individual');
     // first_name
     $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']);
     //middle_name
     $form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']);
     // last_name
     $form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']);
     // suffix
     $form->addElement('select', 'suffix_id', ts('Suffix'), array('' => ts('- suffix -')) + CRM_Core_PseudoConstant::individualSuffix());
     // nick_name
     $form->addElement('text', 'nick_name', ts('Nick Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'nick_name'));
     // greeting type
     $form->addElement('select', 'greeting_type', ts('Greeting'), CRM_Core_SelectValues::greeting());
     // job title
     $form->addElement('text', 'job_title', ts('Job title'), $attributes['job_title']);
     // radio button for gender
     $genderOptions = array();
     $gender = CRM_Core_PseudoConstant::gender();
     foreach ($gender as $key => $var) {
         $genderOptions[$key] = HTML_QuickForm::createElement('radio', null, ts('Gender'), $var, $key);
     }
     $form->addGroup($genderOptions, 'gender_id', ts('Gender'));
     $form->addElement('checkbox', 'is_deceased', null, ts('Contact is deceased'));
     $form->addElement('date', 'birth_date', ts('Date of birth'), CRM_Core_SelectValues::date('birth'));
     $form->addRule('birth_date', ts('Select a valid date.'), 'qfDate');
     $form->addElement('text', 'home_URL', ts('Website'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'home_URL'));
     $form->addRule('home_URL', ts('Enter a valid Website.'), 'url');
     $config =& CRM_Core_Config::singleton();
     CRM_Core_ShowHideBlocks::links($this, 'demographics', '', '');
 }
示例#24
0
 /**
  * Build the form object - it consists of
  *    - displaying the QILL (query in local language)
  *    - displaying elements for saving the search
  *
  *
  * @return void
  */
 public function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Smart Group'));
     // get the qill
     $query = new CRM_Event_BAO_Query($this->get('formValues'));
     $qill = $query->qill();
     // Values from the search form
     $formValues = $this->controller->exportValues();
     // need to save qill for the smarty template
     $this->assign('qill', $qill);
     // the name and description are actually stored with the group and not the saved search
     $this->add('text', 'title', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), TRUE);
     $this->addElement('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
     // get the group id for the saved search
     $groupId = NULL;
     if (isset($this->_id)) {
         $params = array('saved_search_id' => $this->_id);
         CRM_Contact_BAO_Group::retrieve($params, $values);
         $groupId = $values['id'];
         $this->addDefaultButtons(ts('Update Smart Group'));
     } else {
         $this->addDefaultButtons(ts('Save Smart Group'));
         $this->assign('partiallySelected', $formValues['radio_ts'] != 'ts_all');
     }
     $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $groupId, 'title'));
 }
示例#25
0
 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->setPageTitle(ts('Contact Type'));
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'label', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_ContactType', 'label'), TRUE);
     $contactType = $this->add('select', 'parent_id', ts('Basic Contact Type'), CRM_Contact_BAO_ContactType::basicTypePairs(FALSE, 'id'));
     $enabled = $this->add('checkbox', 'is_active', ts('Enabled?'));
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $contactType->freeze();
         // We'll display actual "name" for built-in types (for reference) when editing their label / image_URL
         $contactTypeName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $this->_id, 'name');
         $this->assign('contactTypeName', $contactTypeName);
         $this->_parentId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $this->_id, 'parent_id');
         // Freeze Enabled field for built-in contact types (parent_id is NULL for these)
         if (is_null($this->_parentId)) {
             $enabled->freeze();
         }
     }
     $this->addElement('text', 'image_URL', ts('Image URL'));
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_ContactType', 'description'));
     $this->assign('cid', $this->_id);
     $this->addFormRule(array('CRM_Admin_Form_ContactType', 'formRule'), $this);
 }
示例#26
0
 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm($check = FALSE)
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $types = CRM_Booking_BAO_Resource::buildOptions('type_id', 'create');
     $this->add('select', 'type_id', ts('Resource type'), array('' => ts('- select -')) + $types, TRUE, array());
     $this->add('text', 'label', ts('Label'), array('size' => 50, 'maxlength' => 255), TRUE);
     $this->add('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'description'), FALSE);
     /*
         $this->addWysiwyg('description',
             ts('Description'),
             CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'description')
         );*/
     $this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'weight'), TRUE);
     $this->add('checkbox', 'is_active', ts('Enabled?'));
     $this->add('checkbox', 'is_unlimited', ts('Is Unlimited?'));
     $configSets = array('' => ts('- select -'));
     try {
         $activeSets = civicrm_api3('ResourceConfigSet', 'get', array('is_active' => 1, 'is_deleted' => 0));
         foreach ($activeSets['values'] as $key => $set) {
             $configSets[$key] = $set['title'];
         }
     } catch (CiviCRM_API3_Exception $e) {
     }
     $this->add('select', 'set_id', ts('Resource configuration set'), $configSets, TRUE);
     $locations = CRM_Booking_BAO_Resource::buildOptions('location_id', 'create');
     $this->add('select', 'location_id', ts('Resource Location'), array('' => ts('- select -')) + $locations, FALSE, array());
     $this->addFormRule(array('CRM_Admin_Form_Resource', 'formRule'), $this);
     $cancelURL = CRM_Utils_System::url('civicrm/admin/resource', "&reset=1");
     $cancelURL = str_replace('&amp;', '&', $cancelURL);
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'), 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"))));
 }
示例#27
0
 /**
  * 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_Core_DAO_PreferencesDate');
     $this->applyFilter('__ALL__', 'trim');
     $name =& $this->add('text', 'name', ts('Name'), $attributes['name'], true);
     $name->freeze();
     $this->add('text', 'description', ts('Description'), $attributes['description'], false);
     $this->add('text', 'start', ts('Start Offset'), $attributes['start'], true);
     $this->add('text', 'end', ts('End Offset'), $attributes['end'], true);
     $formatType = CRM_Core_Dao::getFieldValue('CRM_Core_DAO_PreferencesDate', $this->_id, 'name');
     if ($formatType == 'creditCard') {
         $this->add('text', 'date_format', ts('Format'), $attributes['date_format'], true);
     } else {
         $this->add('select', 'date_format', ts('Format'), array('' => ts('- default input format -')) + CRM_Core_SelectValues::getDatePluginInputFormats());
         $this->add('select', 'time_format', ts('Time'), array('' => ts('- none -')) + CRM_Core_SelectValues::getTimeFormats());
     }
     $this->addRule('start', ts('Value should be a positive number'), 'positiveInteger');
     $this->addRule('end', ts('Value should be a positive number'), 'positiveInteger');
     // add a form rule
     $this->addFormRule(array('CRM_Admin_Form_PreferencesDate', 'formRule'));
 }
示例#28
0
 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->setPageTitle(ts('Financial Type'));
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if ($this->_id) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'name');
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'name'), TRUE);
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'description'));
     $this->add('checkbox', 'is_deductible', ts('Tax-Deductible?'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'is_deductible'));
     $this->add('checkbox', 'is_active', ts('Enabled?'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'is_active'));
     $this->add('checkbox', 'is_reserved', ts('Reserved?'), CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialType', 'is_reserved'));
     if ($this->_action == CRM_Core_Action::UPDATE) {
         $this->assign('aid', $this->_id);
     }
     if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'is_reserved', 'vid')) {
         $this->freeze(array('is_active'));
     }
     $this->addRule('name', ts('A financial type with this name already exists. Please select another name.'), 'objectExists', array('CRM_Financial_DAO_FinancialType', $this->_id));
 }
 /**
  * Build the form object.
  *
  * @param bool $check
  *
  * @return void
  */
 public function buildQuickForm($check = FALSE)
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Job');
     $this->add('text', 'name', ts('Name'), $attributes['name'], TRUE);
     $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Job', $this->_id));
     $this->add('text', 'description', ts('Description'), $attributes['description']);
     $this->add('text', 'api_entity', ts('API Call Entity'), $attributes['api_entity'], TRUE);
     $this->add('text', 'api_action', ts('API Call Action'), $attributes['api_action'], TRUE);
     $this->add('select', 'run_frequency', ts('Run frequency'), CRM_Core_SelectValues::getJobFrequency());
     /************************************
      * begin com.klangsoft.flexiblejobs *
      ************************************/
     $this->addDateTime('schedule_at', ts(($this->_id ? 'Next' : 'First') . ' Run Date / Time'), FALSE, array('formatType' => 'activityDateTime'));
     $this->assign('schedule_at', $this->_id ? 'run next' : 'first be run');
     /**********************************
      * end com.klangsoft.flexiblejobs *
      **********************************/
     $this->add('textarea', 'parameters', ts('Command parameters'), "cols=50 rows=6");
     // is this job active ?
     $this->add('checkbox', 'is_active', ts('Is this Scheduled Job active?'));
     $this->addFormRule(array('CRM_Admin_Form_Job', 'formRule'));
 }
 function buildQuickForm()
 {
     // Details of User
     $this->_invitedTeamPcpID = $this->get('teamPcpId');
     $snippet = CRM_Utils_Request::retrieve('snippet', 'String', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'GET');
     if ($snippet == 'json') {
         $this->_invitedTeamPcpID = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'GET');
     }
     $name =& $this->add('text', 'from_name', ts('From'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'first_name'));
     $name->freeze();
     $email =& $this->add('text', 'from_email', ts('Your Email'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', 'email'), TRUE);
     $email->freeze();
     // $this->addWysiwyg('suggested_message', ts('Your Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'suggested_message'));
     $friend = array();
     $mailLimit = CRM_Pcpteams_Constant::C_INVITE_MAIL_LIMIT;
     $this->assign('mailLimit', $mailLimit + 1);
     for ($i = 1; $i <= 10; $i++) {
         $this->add('text', "friend[{$i}][first_name]", ts("Friend's First Name"));
         $this->add('text', "friend[{$i}][last_name]", ts("Friend's Last Name"));
         $this->add('text', "friend[{$i}][email]", ts("Friend's Email"));
         $this->addRule("friend[{$i}][email]", ts('The format of this email address is not valid.'), 'email');
     }
     $this->addFormRule(array('CRM_Pcpteams_Form_TeamConfirm', 'formRule'));
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Continue'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Skip'))));
     // export form elements
     $this->assign('elementNames', $this->getRenderableElementNames());
 }