/**
  * 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 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'));
         }
     }
 }
 /**
  * For pre-processing
  *
  * @return void
  */
 public function preProcess()
 {
     parent::preProcess();
     $this->_key = CRM_Utils_Request::retrieve('key', 'String', $this, FALSE, 0);
     $session = CRM_Core_Session::singleton();
     $url = CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1&action=browse');
     $session->pushUserContext($url);
     $this->assign('id', $this->_id);
     $this->assign('key', $this->_key);
     switch ($this->_action) {
         case CRM_Core_Action::ADD:
         case CRM_Core_Action::DELETE:
         case CRM_Core_Action::ENABLE:
         case CRM_Core_Action::DISABLE:
             $info = CRM_Extension_System::singleton()->getMapper()->keyToInfo($this->_key);
             $extInfo = CRM_Admin_Page_Extensions::createExtendedInfo($info);
             $this->assign('extension', $extInfo);
             break;
         case CRM_Core_Action::UPDATE:
             if (!CRM_Extension_System::singleton()->getBrowser()->isEnabled()) {
                 CRM_Core_Error::fatal(ts('The system administrator has disabled this feature.'));
             }
             $info = CRM_Extension_System::singleton()->getBrowser()->getExtension($this->_key);
             $extInfo = CRM_Admin_Page_Extensions::createExtendedInfo($info);
             $this->assign('extension', $extInfo);
             break;
         default:
             CRM_Core_Error::fatal(ts('Unsupported action'));
     }
 }
 /**
  * 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);
 }
Exemple #7
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?'));
 }
Exemple #8
0
 /**
  * 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('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);
 }
Exemple #10
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'));
 }
 /**
  * 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);
 }
 /**
  * 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'));
 }
 public function preProcess()
 {
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->assign('action', $this->_action);
     $this->_BAOName = 'CRM_Core_BAO_MessageTemplate';
     $this->set('BAOName', $this->_BAOName);
     parent::preProcess();
 }
 /**
  * Set default values.
  *
  * @return array
  */
 public function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if (empty($defaults['weight'])) {
         $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Event_DAO_ParticipantStatusType');
     }
     $this->_isReserved = CRM_Utils_Array::value('is_reserved', $defaults);
     if ($this->_isReserved) {
         $this->freeze(array('name', 'class', 'is_active'));
     }
     return $defaults;
 }
 /**
  * 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 setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if (!CRM_Utils_Array::value('weight', $defaults)) {
         $query = "SELECT max( `weight` ) as weight FROM `civicrm_booking_resource_config_option`";
         $dao = new CRM_Core_DAO();
         $dao->query($query);
         $dao->fetch();
         $defaults['weight'] = $dao->weight + 1;
     }
     return $defaults;
 }
 /**
  * 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');
 }
Exemple #18
0
 /**
  * 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();
     }
 }
Exemple #19
0
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if (!CRM_Utils_Array::value('weight', $defaults)) {
         require_once 'CRM/Utils/Weight.php';
         $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Event_DAO_ParticipantStatusType');
     }
     $this->_isReserved = $defaults['is_reserved'];
     if ($this->_isReserved) {
         $this->freeze(array('name', 'class', 'is_active'));
     }
     return $defaults;
 }
 /**
  * Function to for pre-processing
  *
  * @return None
  * @access public
  */
 public function preProcess()
 {
     parent::preProcess();
     $this->_key = CRM_Utils_Request::retrieve('key', 'String', $this, FALSE, 0);
     $session = CRM_Core_Session::singleton();
     $url = CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1&action=browse');
     $session->pushUserContext($url);
     $this->assign('id', $this->_id);
     $this->assign('key', $this->_key);
     $ext = new CRM_Core_Extensions();
     $extension = $ext->getExtensions();
     $this->assign('extension', get_object_vars($extension[$this->_key]));
 }
 /**
  * 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
  */
 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?'));
 }
 /**
  * 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?'));
 }
 /**
  * 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?'));
 }
Exemple #25
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'));
     $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);
 }
 /**
  * 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'));
     }
 }
 /**
  * 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'));
 }
Exemple #28
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', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_ContactType', 'label'), true);
     $this->addRule('label', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_ContactType', $this->_id));
     $contactType = $this->add('select', 'parent_id', ts('Basic Contact Type'), array('1' => 'Individual', '2' => 'Household', '3' => 'Organization'));
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $contactType->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->add('checkbox', 'is_active', ts('Enabled?'));
     $this->assign('id', $this->_id);
 }
 /**
  * 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());
 }
Exemple #30
0
 /**
  * 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'));
 }