/** * 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('&', '&', $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;")))); }
/** * 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 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); }
/** * 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'); }
/** * 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->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(); } }
/** * 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)); } }
/** * 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); }
/** * 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); } }
/** * 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?')); }
/** * 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')); }
/** * 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); }
/** * 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(); } }
/** * 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); }
/** * Function to actually build the form * * @return None * @access 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_IMProvider', 'name')); $this->addRule('name', ts('Please enter a valid name.'), 'required'); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_IMProvider', $this->_id)); $this->add('checkbox', 'is_active', ts('Enabled?')); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::COPY)) { $formatName = CRM_Core_BAO_LabelFormat::getFieldValue('CRM_Core_BAO_LabelFormat', $this->_id, 'label'); $this->assign('formatName', $formatName); return; } $disabled = array(); $required = TRUE; $is_reserved = $this->_id ? CRM_Core_BAO_LabelFormat::getFieldValue('CRM_Core_BAO_LabelFormat', $this->_id, 'is_reserved') : FALSE; if ($is_reserved) { $disabled['disabled'] = 'disabled'; $required = FALSE; } $attributes = CRM_Core_DAO::getAttribute('CRM_Core_BAO_LabelFormat'); $this->add('text', 'label', ts('Name'), $attributes['label'] + $disabled, $required); $this->add('text', 'description', ts('Description'), array('size' => CRM_Utils_Type::HUGE)); $this->add('checkbox', 'is_default', ts('Is this Label Format the default?')); $this->add('select', 'paper_size', ts('Sheet Size'), array(0 => ts('- default -')) + CRM_Core_BAO_PaperSize::getList(TRUE), FALSE, array('onChange' => "selectPaper( this.value );") + $disabled); $this->add('static', 'paper_dimensions', NULL, ts('Sheet Size (w x h)')); $this->add('select', 'orientation', ts('Orientation'), CRM_Core_BAO_LabelFormat::getPageOrientations(), FALSE, array('onChange' => "updatePaperDimensions();") + $disabled); $this->add('select', 'font_name', ts('Font Name'), CRM_Core_BAO_LabelFormat::getFontNames()); $this->add('select', 'font_size', ts('Font Size'), CRM_Core_BAO_LabelFormat::getFontSizes()); $this->add('static', 'font_style', ts('Font Style')); $this->add('checkbox', 'bold', ts('Bold')); $this->add('checkbox', 'italic', ts('Italic')); $this->add('select', 'metric', ts('Unit of Measure'), CRM_Core_BAO_LabelFormat::getUnits(), FALSE, array('onChange' => "selectMetric( this.value );")); $this->add('text', 'width', ts('Label Width'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'height', ts('Label Height'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'NX', ts('Labels Per Row'), array('size' => 3, 'maxlength' => 3) + $disabled, $required); $this->add('text', 'NY', ts('Labels Per Column'), array('size' => 3, 'maxlength' => 3) + $disabled, $required); $this->add('text', 'tMargin', ts('Top Margin'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'lMargin', ts('Left Margin'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'SpaceX', ts('Horizontal Spacing'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'SpaceY', ts('Vertical Spacing'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'lPadding', ts('Left Padding'), array('size' => 8, 'maxlength' => 8), $required); $this->add('text', 'tPadding', ts('Top Padding'), array('size' => 8, 'maxlength' => 8), $required); $this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_LabelFormat', 'weight'), TRUE); $this->addRule('label', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_BAO_LabelFormat', $this->_id)); $this->addRule('NX', ts('Must be an integer'), 'integer'); $this->addRule('NY', ts('Must be an integer'), 'integer'); $this->addRule('tMargin', ts('Must be numeric'), 'numeric'); $this->addRule('lMargin', ts('Must be numeric'), 'numeric'); $this->addRule('SpaceX', ts('Must be numeric'), 'numeric'); $this->addRule('SpaceY', ts('Must be numeric'), 'numeric'); $this->addRule('lPadding', ts('Must be numeric'), 'numeric'); $this->addRule('tPadding', ts('Must be numeric'), 'numeric'); $this->addRule('width', ts('Must be numeric'), 'numeric'); $this->addRule('height', ts('Must be numeric'), 'numeric'); $this->addRule('weight', ts('Weight must be integer'), 'integer'); }
/** * Function to build the form * * @return None * @access 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')))); } else { $this->applyFilter('__ALL__', 'trim'); $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'name')); $this->addRule('name', ts('Please enter a valid name.'), 'required'); $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')); parent::buildQuickForm(); } }
/** * Function to build the form * * @return None * @access 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_IndividualPrefix', 'name')); $this->addRule('name', ts('Please enter a valid individual prefix name.'), 'required'); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_IndividualPrefix', $this->_id)); $this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_IndividualPrefix', 'weight'), true); $this->addRule('weight', ts(' is a numeric field'), 'numeric'); $this->add('checkbox', 'is_active', ts('Enabled?')); }
/** * Function to build the form * * @return void * @access public */ public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } $attributes = CRM_Core_DAO::getAttribute('CRM_ACL_DAO_EntityRole'); $aclRoles = array('' => ts('- select -')) + CRM_Core_OptionGroup::values('acl_role'); $this->add('select', 'acl_role_id', ts('ACL Role'), $aclRoles, TRUE); $label = ts('Assigned To'); $group = array('' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup(FALSE, 'Access'); $this->add('select', 'entity_id', $label, $group, TRUE, array('class' => 'crm-select2 huge')); $this->add('checkbox', 'is_active', ts('Enabled?')); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm($check = FALSE) { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } $this->add('text', 'title', ts('Title'), array('size' => 50, 'maxlength' => 255), TRUE); $this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_ResourceConfigSet', 'weight'), TRUE); $this->add('checkbox', 'is_active', ts('Enabled?')); $this->addFormRule(array('CRM_Admin_Form_Resource', 'formRule'), $this); $cancelURL = CRM_Utils_System::url('civicrm/admin/resource/config_set', "&reset=1"); $cancelURL = str_replace('&', '&', $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;")))); }
/** * 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_Queryrunner_DAO_Query'); $this->add('text', 'name', ts('Name'), $attributes['name'], TRUE); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Queryrunner_DAO_Query', $this->_id)); $this->add('text', 'description', ts('Description'), $attributes['description']); $this->add('textarea', 'query', ts('Query'), "cols=80 rows=10", true); $this->add('select', 'run_frequency', ts('Run Frequency'), CRM_Queryrunner_Query::getQueryFrequency(), true); $this->addDateTime('scheduled_run_date', ts('Scheduled Run Date'), FALSE, array('formatType' => 'activityDateTime')); $this->add('checkbox', 'is_active', ts('Is this Query active?')); }
public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action == CRM_Core_Action::DELETE) { return; } else { $this->applyFilter('__ALL__', 'trim'); $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'name'), TRUE); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Mapping', $this->_id)); $this->addElement('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'description')); $mappingType = $this->addElement('select', 'mapping_type_id', ts('Mapping Type'), CRM_Core_PseudoConstant::mappingTypes()); if ($this->_action == CRM_Core_Action::UPDATE) { $mappingType->freeze(); } } }
/** * 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')); $this->add('checkbox', 'is_active', ts('Enabled?')); if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_id, 'is_reserved')) { $this->freeze(array('name', 'description', 'is_active')); } $this->assign('id', $this->_id); }
public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } $this->applyFilter('__ALL__', 'trim'); $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_ParticipantStatusType'); $this->add('text', 'name', ts('Name'), NULL, TRUE); $this->add('text', 'label', ts('Label'), $attributes['label'], TRUE); $this->addSelect('class', array('required' => TRUE)); $this->add('checkbox', 'is_active', ts('Active?')); $this->add('checkbox', 'is_counted', ts('Counted?')); $this->add('text', 'weight', ts('Order'), $attributes['weight'], TRUE); $this->addSelect('visibility_id', array('label' => ts('Visibility'), 'required' => TRUE)); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } $attributes = CRM_Core_DAO::getAttribute('CRM_ACL_DAO_EntityRole'); require_once 'CRM/Core/OptionGroup.php'; $aclRoles = array('' => ts('- select -')) + CRM_Core_OptionGroup::values('acl_role'); $this->add('select', 'acl_role_id', ts('ACL Role'), $aclRoles, true); require_once 'CRM/ACL/BAO/EntityRole.php'; $label = ts('Assigned To'); $group = array('' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup(false, 'Access'); $this->add('select', 'entity_id', $label, $group, true); $this->add('checkbox', 'is_active', ts('Enabled?')); }
/** * Function to build the form * * @return None * @access 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_ActivityType', 'name')); $this->addRule('name', ts('Please enter a valid activity type name.'), 'required'); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_ActivityType', $this->_id)); $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_ActivityType', 'description')); $this->add('checkbox', 'is_active', ts('Enabled?')); if ($this->_action == CRM_CORE_ACTION_UPDATE && CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActivityType', $this->_id, 'is_reserved')) { $this->freeze(array('name', 'description', 'is_active')); } }
public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } $this->applyFilter('__ALL__', 'trim'); $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_ParticipantStatusType'); $this->add('text', 'name', ts('Name'), NULL, TRUE); $this->add('text', 'label', ts('Label'), $attributes['label'], TRUE); $classes = array('Positive' => ts('Positive'), 'Pending' => ts('Pending'), 'Waiting' => ts('Waiting'), 'Negative' => ts('Negative')); $this->add('select', 'class', ts('Class'), $classes, TRUE); $this->add('checkbox', 'is_active', ts('Active?')); $this->add('checkbox', 'is_counted', ts('Counted?')); $this->add('text', 'weight', ts('Weight'), $attributes['weight'], TRUE); $this->add('select', 'visibility_id', ts('Visibility'), CRM_Core_PseudoConstant::visibility(), TRUE); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } $permissions = array_flip(CRM_Core_Permission::basicPermissions()); $this->addCheckBox('object_table', ts('ACL Type'), $permissions, NULL, NULL, TRUE, NULL, array('</td><td>', '</td></tr><tr><td>')); $label = ts('Role'); $role = array('-1' => ts('- select role -'), '0' => ts('Everyone')) + CRM_Core_OptionGroup::values('acl_role'); $entityID =& $this->add('select', 'entity_id', $label, $role, TRUE); if ($this->_id) { $entityID->freeze(); } $this->add('checkbox', 'is_active', ts('Enabled?')); $this->addFormRule(array('CRM_ACL_Form_ACLBasic', 'formRule')); }
/** * 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'); $attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Batch'); $this->add('text', 'title', ts('Batch Name'), $attributes['name'], TRUE); $type = $this->add('select', 'type_id', ts('Type'), CRM_Core_PseudoConstant::getBatchType()); if ($this->_action & CRM_Core_Action::UPDATE) { $type->freeze(); } $this->add('textarea', 'description', ts('Description'), $attributes['description']); $this->add('text', 'item_count', ts('Number of items'), $attributes['item_count'], TRUE); $this->add('text', 'total', ts('Total Amount'), $attributes['total'], TRUE); $this->add('select', 'status_id', ts('Status'), CRM_Core_PseudoConstant::getBatchStatus()); }
/** * Function to build the form * * @param bool $check * * @return void * @access public */ 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()); $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')); }