<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_Custom_Form_Option extends CRM_Core_Form {
/**
- * the custom field id saved to the session for an update
+ * The custom field id saved to the session for an update
*
* @var int
- * @access protected
*/
protected $_fid;
/**
- * the custom group id saved to the session for an update
+ * The custom group id saved to the session for an update
*
* @var int
- * @access protected
*/
protected $_gid;
* The Option id, used when editing the Option
*
* @var int
- * @access protected
*/
protected $_id;
/**
- * set variables up before form is built
- *
- * @param null
+ * Set variables up before form is built
*
* @return void
- * @access public
*/
public function preProcess() {
$this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this);
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @param null
- *
- * @return array array of default values
- * @access public
+ * @return array
+ * array of default values
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $fieldDefaults = array();
if (isset($this->_id)) {
$params = array('id' => $this->_id);
/**
* Build the form object
*
- * @param null
- *
* @return void
- * @access public
*/
public function buildQuickForm() {
if ($this->_action == CRM_Core_Action::DELETE) {
)
);
-
// if view mode pls freeze it with the done button.
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
}
/**
- * global validation rules for the form
+ * Global validation rules for the form
*
- * @param array $fields posted values of the form
+ * @param array $fields
+ * Posted values of the form.
*
* @param $files
* @param CRM_Core_Form $form
*
- * @return array list of errors to be posted back to the form
- * @static
- * @access public
+ * @return array
+ * list of errors to be posted back to the form
*/
- static function formRule($fields, $files, $form) {
- $optionLabel = $fields['label'];
- $optionValue = $fields['value'];
- $fieldId = $form->_fid;
+ public static function formRule($fields, $files, $form) {
+ $optionLabel = $fields['label'];
+ $optionValue = $fields['value'];
+ $fieldId = $form->_fid;
$optionGroupId = $form->_optionGroupID;
$temp = array();
/**
* Process the form
*
- * @param null
- *
* @return void
- * @access public
*/
public function postProcess() {
// store the submitted values in an array
}
$fieldValues = array('option_group_id' => $this->_optionGroupID);
- $customOption->weight =
- CRM_Utils_Weight::updateOtherWeights(
+ $customOption->weight
+ = CRM_Utils_Weight::updateOtherWeights(
'CRM_Core_DAO_OptionValue',
$oldWeight,
$params['weight'],
else {
$defVal[] = $customOption->value;
}
- $customField->default_value =
- CRM_Core_DAO::VALUE_SEPARATOR .
+ $customField->default_value
+ = CRM_Core_DAO::VALUE_SEPARATOR .
implode(CRM_Core_DAO::VALUE_SEPARATOR, $defVal) .
CRM_Core_DAO::VALUE_SEPARATOR;
$customField->save();
}
}
- $customField->default_value =
- CRM_Core_DAO::VALUE_SEPARATOR .
+ $customField->default_value
+ = CRM_Core_DAO::VALUE_SEPARATOR .
implode(CRM_Core_DAO::VALUE_SEPARATOR, $tempVal) .
CRM_Core_DAO::VALUE_SEPARATOR;
$customField->save();
}
}
}
-