/** * Get action Links * * @return array (reference) of action links */ function &links() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/contribute/contributionType', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Contribution Type')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Contribute_BAO_ContributionType' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Contribution Type')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Contribute_BAO_ContributionType' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Contribution Type')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/contribute/contributionType', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Contribution Type'))); } return self::$_links; }
/** * Browse all custom data groups. * * * @return void * @access public * @static */ function browse() { // get all custom groups sorted by weight $contributionType = array(); require_once 'CRM/Contribute/DAO/ContributionType.php'; $dao =& new CRM_Contribute_DAO_ContributionType(); // set the domain_id parameter $config =& CRM_Core_Config::singleton(); $dao->domain_id = $config->domainID(); $dao->orderBy('name'); $dao->find(); while ($dao->fetch()) { $contributionType[$dao->id] = array(); CRM_Core_DAO::storeValues($dao, $contributionType[$dao->id]); // form all action links $action = array_sum(array_keys($this->links())); // update enable/disable links depending on if it is is_reserved or is_active if ($dao->is_reserved) { continue; } else { if ($dao->is_active) { $action -= CRM_CORE_ACTION_ENABLE; } else { $action -= CRM_CORE_ACTION_DISABLE; } } $contributionType[$dao->id]['action'] = CRM_Core_Action::formLink(CRM_Contribute_Page_ContributionType::links(), $action, array('id' => $dao->id)); } $this->assign('rows', $contributionType); }