Example #1
0
 /**
  * Browse all uf data groups.
  *
  * @param
  * @return void
  * @access public
  * @static
  */
 function browse($action = null)
 {
     $ufGroup = array();
     $allUFGroups = array();
     require_once 'CRM/Core/BAO/UFGroup.php';
     $allUFGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup();
     if (empty($allUFGroups)) {
         return;
     }
     foreach ($allUFGroups as $id => $value) {
         $ufGroup[$id] = array();
         $ufGroup[$id]['id'] = $id;
         $ufGroup[$id]['title'] = $value['title'];
         $ufGroup[$id]['weight'] = $value['weight'];
         $ufGroup[$id]['is_active'] = $value['is_active'];
         // form all action links
         $action = array_sum(array_keys($this->actionLinks()));
         // update enable/disable links depending on uf_group properties.
         if ($value['is_active']) {
             $action -= CRM_CORE_ACTION_ENABLE;
         } else {
             $action -= CRM_CORE_ACTION_DISABLE;
         }
         $ufGroup[$id]['action'] = CRM_Core_Action::formLink(CRM_UF_Page_Group::actionLinks(), $action, array('id' => $id));
         //get the "Used For" from uf_join
         $ufGroup[$id]['module'] = implode(', ', CRM_Core_BAO_UFGroup::getUFJoinRecord($id, true));
     }
     $this->assign('rows', $ufGroup);
 }