예제 #1
0
파일: Field.php 프로젝트: hguru/224Civi
 /**
  * Function to set variables up before form is built
  *
  * @param null
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     if (!self::$_dataTypeKeys) {
         self::$_dataTypeKeys = array_keys(CRM_Core_BAO_CustomField::dataType());
         self::$_dataTypeValues = array_values(CRM_Core_BAO_CustomField::dataType());
     }
     if (!self::$_dataToHTML) {
         self::$_dataToHTML = CRM_Core_BAO_CustomField::dataToHtml();
     }
     //custom group id
     $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
     if ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_reserved', 'id')) {
         CRM_Core_Error::fatal("You cannot add or edit fields in a reserved custom field-set.");
     }
     if ($this->_gid) {
         $url = CRM_Utils_System::url('civicrm/admin/custom/group/field', "reset=1&action=browse&gid={$this->_gid}");
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext($url);
     }
     //custom field id
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     //get the values form db if update.
     $this->_values = array();
     if ($this->_id) {
         $params = array('id' => $this->_id);
         CRM_Core_BAO_CustomField::retrieve($params, $this->_values);
         // note_length is an alias for the text_length field
         $this->_values['note_length'] = CRM_Utils_Array::value('text_length', $this->_values);
     }
     if (self::$_dataToLabels == NULL) {
         self::$_dataToLabels = array(array('Text' => ts('Text'), 'Select' => ts('Select'), 'Radio' => ts('Radio'), 'CheckBox' => ts('CheckBox'), 'Multi-Select' => ts('Multi-Select'), 'AdvMulti-Select' => ts('Advanced Multi-Select'), 'Autocomplete-Select' => ts('Autocomplete Select')), array('Text' => ts('Text'), 'Select' => ts('Select'), 'Radio' => ts('Radio')), array('Text' => ts('Text'), 'Select' => ts('Select'), 'Radio' => ts('Radio')), array('Text' => ts('Text'), 'Select' => ts('Select'), 'Radio' => ts('Radio')), array('TextArea' => ts('TextArea'), 'RichTextEditor' => 'RichTextEditor'), array('Date' => ts('Select Date')), array('Radio' => ts('Radio')), array('StateProvince' => ts('Select State/Province'), 'Multi-Select' => ts('Multi-Select State/Province')), array('Country' => ts('Select Country'), 'Multi-Select' => ts('Multi-Select Country ')), array('File' => ts('Select File')), array('Link' => ts('Link')), array('ContactReference' => ts('Autocomplete Select')));
     }
 }
예제 #2
0
파일: Field.php 프로젝트: ksecor/civicrm
 /**
  * Function to set variables up before form is built
  * 
  * @param null
  * 
  * @return void
  * @access public
  */
 public function preProcess()
 {
     require_once 'CRM/Core/BAO/CustomField.php';
     if (!self::$_dataTypeKeys) {
         self::$_dataTypeKeys = array_keys(CRM_Core_BAO_CustomField::dataType());
         self::$_dataTypeValues = array_values(CRM_Core_BAO_CustomField::dataType());
     }
     //custom group id
     $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
     //custom field id
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     //get the values form db if update.
     $this->_values = array();
     if ($this->_id) {
         $params = array('id' => $this->_id);
         CRM_Core_BAO_CustomField::retrieve($params, $this->_values);
     }
     if (self::$_dataToLabels == null) {
         self::$_dataToLabels = array(array('Text' => ts('Text'), 'Select' => ts('Select'), 'Radio' => ts('Radio'), 'CheckBox' => ts('CheckBox'), 'Multi-Select' => ts('Multi-Select'), 'AdvMulti-Select' => ts('Advanced Multi-Select'), 'Autocomplete-Select' => ts('Autocomplete Select')), array('Text' => ts('Text'), 'Select' => ts('Select'), 'Radio' => ts('Radio')), array('Text' => ts('Text'), 'Select' => ts('Select'), 'Radio' => ts('Radio')), array('Text' => ts('Text'), 'Select' => ts('Select'), 'Radio' => ts('Radio')), array('TextArea' => ts('TextArea'), 'RichTextEditor' => 'RichTextEditor'), array('Date' => ts('Select Date')), array('Radio' => ts('Radio')), array('StateProvince' => ts('Select State/Province'), 'Multi-Select' => ts('Multi-Select State/Province')), array('Country' => ts('Select Country'), 'Multi-Select' => ts('Multi-Select Country ')), array('File' => ts('Select File')), array('Link' => ts('Link')), array('ContactReference' => ts('Autocomplete Select')));
     }
 }