/** * Browse all price sets * * @param string $action the action to be invoked * * @return void * @access public */ function browse($action = NULL) { // get all price sets $priceSet = array(); $comps = array('CiviEvent' => ts('Event'), 'CiviContribute' => ts('Contribution'), 'CiviMember' => ts('Membership')); $dao = new CRM_Price_DAO_Set(); if (CRM_Price_BAO_Set::eventPriceSetDomainID()) { $dao->domain_id = CRM_Core_Config::domainID(); } $dao->is_quick_config = 0; $dao->find(); while ($dao->fetch()) { $priceSet[$dao->id] = array(); CRM_Core_DAO::storeValues($dao, $priceSet[$dao->id]); $compIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('extends', $priceSet[$dao->id])); $extends = array(); foreach ($compIds as $compId) { $extends[] = $comps[CRM_Core_Component::getComponentName($compId)]; } $priceSet[$dao->id]['extends'] = implode(', ', $extends); // form all action links $action = array_sum(array_keys($this->actionLinks())); // update enable/disable links depending on price_set properties. if ($dao->is_reserved) { $action -= CRM_Core_Action::UPDATE + CRM_Core_Action::DISABLE + CRM_Core_Action::ENABLE + CRM_Core_Action::DELETE + CRM_Core_Action::COPY; } else { if ($dao->is_active) { $action -= CRM_Core_Action::ENABLE; } else { $action -= CRM_Core_Action::DISABLE; } } $actionLinks = self::actionLinks(); //CRM-10117 if ($dao->is_reserved) { $actionLinks[CRM_Core_Action::BROWSE]['name'] = 'View Price Fields'; } $priceSet[$dao->id]['action'] = CRM_Core_Action::formLink($actionLinks, $action, array('sid' => $dao->id)); } $this->assign('rows', $priceSet); }