/** * Get action Links. * * @return array * (reference) of action links */ public function &links() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/contribute/managePremiums', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Premium')), CRM_Core_Action::PREVIEW => array('name' => ts('Preview'), 'url' => 'civicrm/admin/contribute/managePremiums', 'qs' => 'action=preview&id=%%id%%', 'title' => ts('Preview Premium')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'ref' => 'crm-enable-disable', 'title' => ts('Disable Premium')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'ref' => 'crm-enable-disable', 'title' => ts('Enable Premium')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/contribute/managePremiums', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Premium'))); } return self::$_links; }
/** * 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/managePremiums', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Premium')), CRM_Core_Action::PREVIEW => array('name' => ts('Preview'), 'url' => 'civicrm/admin/contribute/managePremiums', 'qs' => 'action=preview&id=%%id%%', 'title' => ts('Preview Premium')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Contribute_BAO_ManagePremiums' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Premium')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Contribute_BAO_ManagePremiums' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Premium')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/contribute/managePremiums', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Premium'))); } return self::$_links; }
/** * Browse all custom data groups. * * * @return void * @access public * @static */ function browse() { // get all custom groups sorted by weight $premiums = array(); require_once 'CRM/Contribute/DAO/Product.php'; $dao =& new CRM_Contribute_DAO_Product(); // set the domain_id parameter $config =& CRM_Core_Config::singleton(); $dao->orderBy('name'); $dao->find(); while ($dao->fetch()) { $premiums[$dao->id] = array(); CRM_Core_DAO::storeValues($dao, $premiums[$dao->id]); // form all action links $action = array_sum(array_keys($this->links())); if ($dao->is_active) { $action -= CRM_CORE_ACTION_ENABLE; } else { $action -= CRM_CORE_ACTION_DISABLE; } $premiums[$dao->id]['action'] = CRM_Core_Action::formLink(CRM_Contribute_Page_ManagePremiums::links(), $action, array('id' => $dao->id)); } $this->assign('rows', $premiums); }