/** * Browse all options value. * * * @return void * @access public * @static */ function browse() { $dao = new CRM_Core_DAO_OptionValue(); $dao->option_group_id = $this->_gid; if (in_array($this->_gName, CRM_Core_OptionGroup::$_domainIDGroups)) { $dao->domain_id = CRM_Core_Config::domainID(); } if ($this->_gName == 'encounter_medium') { $mediumIds = CRM_Case_BAO_Case::getUsedEncounterMediums(); } elseif ($this->_gName == 'case_status') { $caseStatusIds = CRM_Case_BAO_Case::getUsedCaseStatuses(); } elseif ($this->_gName == 'case_type') { $caseTypeIds = CRM_Case_BAO_Case::getUsedCaseType(); } $dao->orderBy('name'); $dao->find(); $optionValue = array(); while ($dao->fetch()) { $optionValue[$dao->id] = array(); CRM_Core_DAO::storeValues($dao, $optionValue[$dao->id]); // form all action links $action = array_sum(array_keys($this->links())); if ($dao->is_default) { $optionValue[$dao->id]['default_value'] = '[x]'; } //do not show default option for email/postal greeting and addressee, CRM-4575 if (!in_array($this->_gName, array('email_greeting', 'postal_greeting', 'addressee'))) { $this->assign('showIsDefault', TRUE); } // update enable/disable links depending on if it is is_reserved or is_active if ($dao->is_reserved) { $action = CRM_Core_Action::UPDATE; } else { if ($dao->is_active) { $action -= CRM_Core_Action::ENABLE; } else { $action -= CRM_Core_Action::DISABLE; } if ($this->_gName == 'encounter_medium' && in_array($dao->value, $mediumIds) || $this->_gName == 'case_status' && in_array($dao->value, $caseStatusIds) || $this->_gName == 'case_type' && in_array($dao->value, $caseTypeIds)) { $action -= CRM_Core_Action::DELETE; } } $optionValue[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id, 'gid' => $this->_gid)); } $this->assign('rows', $optionValue); }