Merge pull request #4880 from totten/master-cs3
[civicrm-core.git] / CRM / Custom / Form / Group.php
index e958eee177a327e1752f4f4cbf10fe36626ee598..0e7ee54da2071c8b356c23d5d0e0423de10b5fc0 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -42,7 +42,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * The set id saved to the session for an update
    *
    * @var int
-   * @access protected
    */
   protected $_id;
 
@@ -50,7 +49,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    *  set is empty or not
    *
    * @var bool
-   * @access protected
    */
   protected $_isGroupEmpty = TRUE;
 
@@ -58,7 +56,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * Array of existing subtypes set for a custom set
    *
    * @var array
-   * @access protected
    */
   protected $_subtypes = array();
 
@@ -66,7 +63,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * Array of default params
    *
    * @var array
-   * @access protected
    */
   protected $_defaults = array();
 
@@ -76,7 +72,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * @param null
    *
    * @return void
-   * @access public
    */
   public function preProcess() {
     // current set id
@@ -112,25 +107,27 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
   /**
    * Global form rule
    *
-   * @param array $fields the input form values
-   * @param array $files the uploaded files if any
+   * @param array $fields
+   *   The input form values.
+   * @param array $files
+   *   The uploaded files if any.
    * @param $self
    *
    *
    * @return true if no errors, else array of errors
-   * @access public
    * @static
    */
-  static function formRule($fields, $files, $self) {
+  public static function formRule($fields, $files, $self) {
     $errors = array();
 
     //validate group title as well as name.
     $title  = $fields['title'];
     $name   = CRM_Utils_String::munge($title, '_', 64);
     $query  = 'select count(*) from civicrm_custom_group where ( name like %1 OR title like %2 ) and id != %3';
-    $grpCnt = CRM_Core_DAO::singleValueQuery($query, array(1 => array($name, 'String'),
+    $grpCnt = CRM_Core_DAO::singleValueQuery($query, array(
+    1 => array($name, 'String'),
         2 => array($title, 'String'),
-        3 => array((int)$self->_id, 'Integer'),
+        3 => array((int) $self->_id, 'Integer'),
       ));
     if ($grpCnt) {
       $errors['title'] = ts('Custom group \'%1\' already exists in Database.', array(1 => $title));
@@ -153,7 +150,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
     }
 
     if (!empty($fields['is_multiple'])) {
-        $self->assign('showMultiple', TRUE);
+      $self->assign('showMultiple', TRUE);
     }
 
     if (empty($fields['is_multiple']) && $fields['style'] == 'Tab with table') {
@@ -180,10 +177,9 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * @param null
    *
    * @return void
-   * @access public
    * @see valid_date
    */
-  function addRules() {
+  public function addRules() {
     $this->addFormRule(array('CRM_Custom_Form_Group', 'formRule'), $this);
   }
 
@@ -193,7 +189,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * @param null
    *
    * @return void
-   * @access public
    */
   public function buildQuickForm() {
     $this->applyFilter('__ALL__', 'trim');
@@ -297,7 +292,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
       ts('Used For'),
       array(
         'name' => 'extends[0]',
-        'style' => 'vertical-align: top;'
+        'style' => 'vertical-align: top;',
       ),
       TRUE
     );
@@ -410,9 +405,8 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * @param null
    *
    * @return array   array of default values
-   * @access public
    */
-  function setDefaultValues() {
+  public function setDefaultValues() {
     $defaults = &$this->_defaults;
     $this->assign('showMaxMultiple', TRUE);
     if ($this->_action == CRM_Core_Action::ADD) {
@@ -462,7 +456,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * @param null
    *
    * @return void
-   * @access public
    */
   public function postProcess() {
     // get the submitted form values.
@@ -531,11 +524,12 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
   /**
    * Return a formatted list of relationship name.
    *
-   * @param array $list array of relationship name.
+   * @param array $list
+   *   Array of relationship name.
    *
    * @return array of relationship name.
    */
-  static function getFormattedList(&$list) {
+  public static function getFormattedList(&$list) {
     $relName = array();
 
     foreach ($list as $listItemKey => $itemValue) {
@@ -559,4 +553,3 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
     return $relName;
   }
 }
-